cdgriffith / FastFlix

FastFlix is a free GUI for HEVC and AV1 encoding, GIF/WebP/AVIF creation, and more!
MIT License
1.08k stars 54 forks source link

Frame rate change in 2 pass mode ("Bitrate" mode) results in error for AVC x264 encoder #494

Closed ivan-gorin closed 1 year ago

ivan-gorin commented 1 year ago

FastFlix Version: 5,5,5

Operating System: Windows 10

Describe the bug When using AVC x264 encoder in 2 pass mode, changing the output frame rate results in error after first pass. To Reproduce

  1. Choose the AVC x264 encoder.
  2. Choose the "Bitrate" mode in the "Quality" tab (This will use the 2 pass encoding method, where the first pass generates a log file and the second pass uses it to closely match the desired bitrate).
  3. In the "Advanced" tab, uncheck the "Same as Source" option to the right of "Output FPS" and then enter fps number into the box to the box. Choose a number different to the source file frame rate.
  4. Start the encoding. Wait until the first pass finishes, right after that the error will happen.

Screenshots error

Logs The problem is that FastFlix applies the -r frame rate option only to the second pass. Here you can see the command FastFlix runs for the first pass:

Running command: "C:\Ffmpeg\bin\ffmpeg.exe"   -y  -to 605.2    -i "<input_file>"   -max_muxing_queue_size 1024 -map 0:0   -c:v libx264 -pix_fmt yuv420p      -color_primaries bt709 -color_trc bt709 -colorspace bt709  -pass 1 -passlogfile "C:\Users\<username>\AppData\Roaming\FastFlix\temp_527689e7bd50dcfbb96cf489\pass_log_file_04347fffe2c2ab34e06f" -b:v 5000k -preset:v ultrafast  -an -sn -dn -f mp4 NUL

The bug can be worked around by putting the option -r <desired frame rate> in the "Custom ffmpeg options" box in the "Quality" tab, however that is not ideal since it puts the option twice in the second pass, and in general the frame rate selection field should work without this.

ivan-gorin commented 1 year ago

I think the bug is here, the output_fps information is part of the ending string generated by generate_all function but it is not concatenated to the first pass command.

cdgriffith commented 1 year ago

Good call on the fix! Re-did that logic hopefully everwhere it was used https://github.com/cdgriffith/FastFlix/releases/tag/5.5.6