<p>There may be multiple questions in here, so please bear with me ...</p>

<p>I am experimenting with rendering animations (from scientific data / simulations). My code produces individual frames as PNGs - at a frame rate of my choosing &amp; at a resolution of my choosing. I want to convert it to something that can be uploaded to Youtube as 1080p / 1k footage offering an as-smooth-as-possible experience for a potential audience at Youtube. I have made the basics work, but I am not (yet) happy with the results. </p>

<p><strong>What are optimal settings for what I am doing?</strong> What directions do I have to explore to improve the result?</p>

<hr>

<p>I have written <a href="https://gist.github.com/s-m-e/821f23a76ff03186d2c90797bcfe05d8" rel="nofollow noreferrer">a little script in Python</a> which generates frames for a rather simplistic test animation. I can tune the resolution of every frame as well as the frame rate. Rendering is based on <a href="https://www.cairographics.org/" rel="nofollow noreferrer">Cairo</a>. Beyond that, it always generates the same 10 second animation.</p>

<h1>Test 1</h1>

<p><a href="https://youtu.be/rFJmMjHwgrY" rel="nofollow noreferrer">Video</a>, 60 fps, PNGs at 1k</p>

<p>Command: <code>ffmpeg -framerate 60 -i images/frame_%04d.png -s:v 1920x1080 -c:v libx264 -profile:v high -pix_fmt yuv420p video.mp4</code></p>

<h1>Test 2</h1>

<p><a href="https://youtu.be/8JQCYvXw6EQ" rel="nofollow noreferrer">Video</a>, 60 fps, PNGs at 1k</p>

<p>Command: <code>ffmpeg -framerate 60 -i images/frame_%04d.png -s:v 1920x1080 -c:v libx264 -preset veryslow -crf 0 video.mp4</code></p>

<h1>Test 3</h1>

<p><a href="https://youtu.be/kFZdLOmb1Y8" rel="nofollow noreferrer">Video</a>, 60 fps, PNGs at 4k</p>

<p>Command: <code>ffmpeg -framerate 60 -i images/frame_%04d.png -s:v 1920x1080 -c:v libx264 -preset veryslow -crf 0 video.mp4</code></p>

<h1>Test 4</h1>

<p><a href="https://youtu.be/RrIHbtiPzuc" rel="nofollow noreferrer">Video</a>, 120 fps, PNGs at 1k</p>

<p>Command: <code>ffmpeg -framerate 120 -i images/frame_%04d.png -s:v 1920x1080 -c:v libx264 -preset veryslow -crf 0 video.mp4</code></p>

CC BY-SA 4.0
2020-04-24T19:41:24.690Z
What specifically are you unhappy with?
Gyan
CC BY-SA 4.0
2020-04-24T19:43:41.377Z
@Gyan I tested the videos on two different computers and a recent tablet (so far) and they all appear to stutter. Maybe it actually is due to video playback on those systems, but the raw video files when played back with VLC show similar stutters at about the same times. Do they look smooth to you?
s-m-e
CC BY-SA 4.0
2020-04-24T19:46:33.430Z
@Gyan I can not help it, maybe it is very insignificant, but I think that I have seen stuff like this smoother before.
s-m-e
CC BY-SA 4.0
2020-04-24T19:49:03.273Z
In terms of fluidity, 1 and 2 look fine. 4 is stuttery. 3 is ok.
Gyan
CC BY-SA 4.0
2020-04-24T19:53:47.063Z
@Gyan Thanks for checking. What kind of configuration would you go for then?
s-m-e
CC BY-SA 4.0
2020-04-25T06:11:56.177Z
2 seems fine...
Gyan
CC BY-SA 4.0
2020-05-04T09:03:12.053Z
The 120fps file is converted to 60fps by youtube, and most likely people do not have the monitor with a refresh rate beyond 60. I do not.
Rafael
CC BY-SA 4.0
2020-05-04T15:00:11.977Z
@Rafael Yep, correct. But this still begs the question: Is their conversion from 120 to 60fps giving better overall results than uploading 60 fps (for animated graphics) directly? Youtube's conversion is a bit of a black box to me ...
s-m-e
<ffmpeg><video-quality><animation><animation-rendering>
Optimal ffmpeg input and settings for 1080p Youtube video from individually rendered frames (PNG files)
s-m-e
# Optimal ffmpeg input and settings for 1080p Youtube video from individually rendered frames (PNG files)

(Asked by: username_0 on 2020-04-24)

There may be multiple questions in here, so please bear with me ...

I am experimenting with rendering animations (from scientific data / simulations). My code produces individual frames as PNGs - at a frame rate of my choosing & at a resolution of my choosing. I want to convert it to something that can be uploaded to Youtube as 1080p / 1k footage offering an as-smooth-as-possible experience for a potential audience at Youtube. I have made the basics work, but I am not (yet) happy with the results.

**What are optimal settings for what I am doing?** What directions do I have to explore to improve the result?

---

I have written [a little script in Python](https://gist.github.com/username_0/821f23a76ff03186d2c90797bcfe05d8) which generates frames for a rather simplistic test animation. I can tune the resolution of every frame as well as the frame rate. Rendering is based on [Cairo](https://www.cairographics.org/). Beyond that, it always generates the same 10 second animation.

# Test 1

[Video](https://youtu.be/rFJmMjHwgrY), 60 fps, PNGs at 1k

Command: `ffmpeg -framerate 60 -i images/frame_%04d.png -s:v 1920x1080 -c:v libx264 -profile:v high -pix_fmt yuv420p video.mp4`

# Test 2

[Video](https://youtu.be/8JQCYvXw6EQ), 60 fps, PNGs at 1k

Command: `ffmpeg -framerate 60 -i images/frame_%04d.png -s:v 1920x1080 -c:v libx264 -preset veryslow -crf 0 video.mp4`

# Test 3

[Video](https://youtu.be/kFZdLOmb1Y8), 60 fps, PNGs at 4k

Command: `ffmpeg -framerate 60 -i images/frame_%04d.png -s:v 1920x1080 -c:v libx264 -preset veryslow -crf 0 video.mp4`

# Test 4

[Video](https://youtu.be/RrIHbtiPzuc), 120 fps, PNGs at 1k

Command: `ffmpeg -framerate 120 -i images/frame_%04d.png -s:v 1920x1080 -c:v libx264 -preset veryslow -crf 0 video.mp4`

**Tags:** ffmpeg, video-quality, animation, animation-rendering

> **Comments:**
> **username_1**: What specifically are you unhappy with?  
> **username_0**: @username_1 I tested the videos on two different computers and a recent tablet (so far) and they all appear to stutter. Maybe it actually is due to video playback on those systems, but the raw video files when played back with VLC show similar stutters at about the same times. Do they look smooth to you?  
> **username_0**: @username_1 I can not help it, maybe it is very insignificant, but I think that I have seen stuff like this smoother before.  
> **username_1**: In terms of fluidity, 1 and 2 look fine. 4 is stuttery. 3 is ok.  
> **username_0**: @username_1 Thanks for checking. What kind of configuration would you go for then?  
> **username_1**: 2 seems fine...  
> **username_2**: The 120fps file is converted to 60fps by youtube, and most likely people do not have the monitor with a refresh rate beyond 60. I do not.  
> **username_0**: @username_2 Yep, correct. But this still begs the question: Is their conversion from 120 to 60fps giving better overall results than uploading 60 fps (for animated graphics) directly? Youtube's conversion is a bit of a black box to me ...  

---

## 0 answers

