Render options have no effect on render quality


#1

I am using “SynfigStudio-1.3.11-testing-19.02.09-win64-9583a” on Windows 7 (x64).
I started a new project, imported a png image:


then I tried to render the project as an “mp4” video with ffmpeg using H264/AVC/MPEG-4 AVC (LossLess) codec. But no matter what values I choose for “Quality”, “Anti-Aliasing” and “Resolution”, the result always looks the same: low quality video.
Test.zip (110.4 KB)

I get the same result with Synfig Studio 1.2.2.

Is this a bug or I am missing something?


#2

FFMPEG rendering is “a bit buggy” at the moment.
There are other ways to create a clean video, let’s check the explanations by Lobozamora :slight_smile:


#3

While searching for a solution I have tried to render an “animation” as a series of png images, and then I tried to convert these images into a video with FFmpeg using a lossless H.264 encoding. The result looks better, than when I was rendering with Synfig Studio straight to the video, albeit still not as good as the original png image. I am wondering if I could further tune the settings to improve the output quality.

I used the following settings (in a batch file):

"C:\Programs Portable\FFmpeg v3.3.2 (x64)\bin\ffmpeg.exe" -framerate 24 -i "Test Animation.%%04d.png" -c:v libx264 -preset veryslow -crf 0 "video.mp4"

So, if anybody has found a better way, please let me know.

Seeing as this appears to be about the only way to get a better quality, I am thinking about creating a GUI for FFmpeg to facilitate the task. Although, I can only code for Windows.

@BobSynfig, what rendering method currently ensures the best video quality?


#4

fmpeg -i "Test Animation.%%04d.png" ... -b:v 10M ... "video.mp4"


#5

Thank you, @bazza I will try that too.

In the meantime I found what the problem was. My original image was in the RGB color space and in that case a different codec has to be used, namely the libx264rgb codec. Otherwise, FFmpeg converts RGB to YUV and the colors are messed up in the output. Encoding in RGB results in a somewhat bigger video files and their compatibility decreases (say, the VLC player can play them correctly, but Avidemux fails to open them).

So, yet a better option would probably be to create images directly in the YUV color space, but I have not yet figured out how that could be achieved. Do not see such an option in GIMP.

If anybody knows how to do that, please let me know.

But as of now, with the libx264rgb codec, my lossless video output looks exactly like the original image. But if video editors can not work with RGB videos, then there is little point in producing them at all.


#6

try this:

ffmpeg -i ... -b:v 10M -b:a 256k -acodec ac3 -vcodec mpeg4 -g 30 ..

mp4 is a format complicated. I prefer webm

ffmpeg -i ... -b 2M -vcodec libvpx -acodec libvorbis -ab 160000 -f webm -g 30 ...

PD: In editor of video always is convenient to use sequencer of archives


#7

Thanks for some more hints, @bazza.
I tested what you suggested.
Option “-b:v 10M” has no effect at all.
Options “-b:v 10M -vcodec mpeg4 -g 30” make things look even worse.
And these settings “-b 2M -vcodec libvpx -acodec libvorbis -ab 160000 -f webm -g 30” have failed to produce any output at all.

Could you please explain what the “-g 30” option is supposed to do?

I wonder why the developers remain silent about this issue.


#8

try with more megabits -b:v 100M o 500M…

-g

Use a 2 second GOP (Group of Pictures), so simply multiply your output frame rate * 2. For example, if your input is -framerate 30, then use -g 60.

in PAL HD 25 in NTSC HD 30… normal 50, 60… poor …500, 600…


#9

@bazza, I tried to run this:

"C:\Programs Portable\FFmpeg v3.3.2 (x64)\bin\ffmpeg.exe" -framerate 24 -i "Test Animation.%%04d.png" -b:v 500M -vcodec mpeg4 -g 48 "video.mp4"
But the output video, while more than three times larger than that, encoded with the libx264 codec, has a notably worse quality than the latter.

It seems to me that the problem is not in the bitrate, but rather in the RGB to YUV color conversion.


#10

24 framerate is for Film. Don’t work fine in TV

Where have this problem. They can send screenshot
try:

ffmpeg -i video.mp4 video.yuv

But this is a RAW format


#12

#13

Original image:

"C:\Programs Portable\FFmpeg v3.3.2 (x64)\bin\ffmpeg.exe" -y -i "Test Animation.%%04d.png" -r 25 -b:v 1M -vcodec libx264 1.mp4

"C:\Programs Portable\FFmpeg v3.3.2 (x64)\bin\ffmpeg.exe" -y -i "Test Animation.%%04d.png" -r 25 -b:v 500M -vcodec libx264 500.mp4


"C:\Programs Portable\FFmpeg v3.3.2 (x64)\bin\ffmpeg.exe" -framerate 24 -i "Test Animation.%%04d.png" -c:v libx264rgb -preset veryslow -crf 0 "video.mp4"

The last video is lossless, but not compatible with editors, hence the problem.


#14

my result:

ffmpeg -i 29dddca19e5a5b6f97d7f243321650fe540141e9.png -r 25 -b:v 500M -vcodec libx264 500.mp4

ffmpeg -i 29dddca19e5a5b6f97d7f243321650fe540141e9.png -r 25 -b:v 500M -vcodec libx264rgb 500rgb.mp4

#15

How big is the video file? Can you attach it?


#16

500rgb.mp4.zip (156,9 KB)

ffmpeg version 2.8.15-0ubuntu0.16.04.1 (x64)


#17

Thanks, but I cannot open either of the videos. Neither with VLC, nor with Avidemux. Windows Explorer says they have zero length. If it is not too much trouble, could you please make them like 2-3 seconds long, and attach them again?


#18

500rgb.mp4.zip (486,7 KB)

Download official version of ffmpeg: https://ffmpeg.org/download.html


#19

Thank you!
This is your video info:


This is my video info:

I can not understand why the quality is so different. I will try tomorrow with a new version of FFmpeg.
Could you please give the exact commands that you used to create two last videos?


#20

I happen you order them exact.
Explain your advances


#21

@bazza, what do you mean?

This is for your video:
Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/iso2/avc1/mp41)
File size : 237 KiB
Duration : 30 s 0 ms
Overall bit rate : 64.8 kb/s
Writing application : Lavf56.40.101

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High 4:4:4 Predictive@L5.2
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, RefFrames               : 4 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 30 s 0 ms
Bit rate                                 : 62.2 kb/s
Nominal bit rate                         : 500 Mb/s
Width                                    : 901 pixels
Height                                   : 479 pixels
Display aspect ratio                     : 1.881
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Chroma subsampling                       : 4:4:4
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.006
Stream size                              : 228 KiB (96%)
Writing library                          : x264 core 148 r2643 5c65704
Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=4 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=abr / mbtree=1 / bitrate=500000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00

This is for my video:
Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/iso2/avc1/mp41)
File size : 50.5 KiB
Duration : 4 s 840 ms
Overall bit rate : 85.5 kb/s
Writing application : Lavf57.76.100

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High 4:4:4 Predictive@L6.1
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, RefFrames               : 4 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 4 s 840 ms
Bit rate                                 : 81.7 kb/s
Nominal bit rate                         : 500 Mb/s
Width                                    : 960 pixels
Height                                   : 540 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Chroma subsampling                       : 4:4:4
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.006
Stream size                              : 48.2 KiB (96%)
Writing library                          : x264 core 152 r2851 ba24899
Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x1:0x111 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=0 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=4 / threads=3 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=abr / mbtree=1 / bitrate=500000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00