VideoHelp Forum

Our website is made possible by displaying online advertisements to our visitors.
Please consider supporting us by disabling your ad blocker or buy a VSO converter software :)
+ Reply to Thread
Results 1 to 16 of 16
Thread
  1. Hi! I am trying to compare output of two programs,
    one is ffmpeg.exe and another is my test program based on same version of ffmpeg lib.

    Doing simple encode and trying to set same options with ffmpeg lib (preset medium, crf 23).
    Code:
    ffmpeg.exe -i "input.avi" -c:v libx264 -preset medium -crf 23 -keyint_min 1 test.avi
    However the resulting file from ffmpeg.exe is roughly 2x smaller and worse quality.
    Tried to compare mediainfo reports of both files: all relevant parameters are identical (lib version, x264 options, profile, level etc.) Only bitrate values are different.
    Tried to compare ffprobe outputs - no clue.

    So if they both are encoded with crf 23 how is it possible to get different quality/bitrate?
    Any ideas.
    Quote Quote  
  2. Show the mediainfo reports for both files.
    Quote Quote  
  3. also post the log output of the encodes - it will give the frametypes , avg frame quantizers
    Quote Quote  
  4. test1 from ffmpeg.exe
    I slightly changed experiment but avi/mp4 makes no interesting difference.
    Image Attached Files
    Quote Quote  
  5. Why would mediainfo report range and matrix info for test2, but not test1 - unless you copy/pasted incorrectly ?

    Post the console output
    Quote Quote  
  6. add -loglevel verbose -report , upload the log files for each run
    Quote Quote  
  7. range and matrix are set in my code, should have no effect?
    ok I can remove it and extract log output.
    Quote Quote  
  8. How and what did you set as fps for libx264?
    Quote Quote  
  9. range and matrix should have no effect if input format and output format are the same ; if --input-range and --range differ, there is a change made by x264 . So is your code doing "something else" to the input before libx264 ?
    Quote Quote  
  10. Originally Posted by poisondeathray View Post
    if --input-range and --range differ, there is a change made by x264
    That only applies to x264cli, doesn't it?
    Quote Quote  
  11. Originally Posted by sneaker View Post
    Originally Posted by poisondeathray View Post
    if --input-range and --range differ, there is a change made by x264
    That only applies to x264cli, doesn't it?
    Yes , the "--" syntax is x264cli, but ffmpeg libx264 behaviour auto scales too . e.g. if it detects source as yuvj420p (sent as full range) , it will scale the output unless you explicitly force full range output
    Quote Quote  
  12. test1.log is complete from this cmd

    ffmpeg.exe -i "input.avi" -c:v libx264 -preset medium -crf 23 -keyint_min 1 -loglevel verbose test1.avi 2>test1.log
    test2.log I had to clean, was too much noise like "frame= 86 QP=10.07 NAL=2 Slice:B Poc:172 I:59 P:214 SKIP:904 size=3043 bytes"
    Image Attached Files
    Quote Quote  
  13. Originally Posted by sneaker View Post
    How and what did you set as fps for libx264?
    Interesting question. Will take some time. Does it estimate quality with relation to fps?
    Quote Quote  
  14. One thing I can think of that could cause this is the frame rate. If x264 thinks the frame rates are different it will allocate different numbers of bits per frame. For example, I just CRF encoded a 12 fps animated video and got a 17 MB file. After adding AssumeFPS(60) to the script and encoding with the exact same settings I got an 8 MB file. The encoding log shows a difference (much high average quantizers at 60 fps, and other small differences) but the MediaInfo report of the x264 options is identical. Remuxing the 60 fps stream and flagging it as 12 fps makes it play at 12 fps and the MediaInfo report looks the same except fot the bitrate related fields -- and one additional field "original frame rate: 60". But I suspect one might be able to remux in a way that doesn't show that.

    After posting I noticed some discussion of frame rate has started. From you logs I suspect this is what's going on.
    Last edited by jagabo; 21st Apr 2017 at 10:54.
    Quote Quote  
  15. test2.log is messed up

    Don't edit it. Post the full logs . You're missing some of the important parts

    again, add

    Code:
    -report -loglevel verbose
    You don't need to specify a logfile or text output, -report will automatically output ffmpeg_date_blah_blah.txt
    Last edited by poisondeathray; 21st Apr 2017 at 10:51.
    Quote Quote  
  16. But log2 is from ffmpeg lib rather than ffmpeg.exe, is has no rules, there are loads of crap from all threads.

    Anyway, problem solved: had time_base set incorrectly (upside-down). Also explains how it decided for "keyint_min 1".
    Thanks all!
    Quote Quote  



Similar Threads