1

How do I modify this ffmpeg string to generate multiple outputs with different video bitrates? This to save time when yadif=1 take a lot of power. Also, can't get it to accept yadif_cuda in windows.

ffmpeg -y -f lavfi -i anullsrc=cl=mono:sample_rate=48000 -i "test.mxf" -vf yadif=1 -s 1920:1080 -c:v h264_nvenc -force_key_frames "expr:gte(t,n_forced*10)" -pix_fmt yuv420p -preset slow -rc vbr_hq -b:v 4.5M -map 1:v -map 0:a -c:a aac -b:a 192k -shortest "test.mp4"

talonmies
  • 70,661
  • 34
  • 192
  • 269

2 Answers2

1

Implementing my comment

shortest is an output option. Your command deinterlaces and scales the video twice. Use filter_complex, deint and scale once, thn use split to produce two outputs. Map one each per output.

ffmpeg -y -i "test.mxf" -f lavfi -i anullsrc=cl=mono:sample_rate=48000 -filter_complex "yadif=1,scale=1920x1080,format=yuv420p,split=2[90m][45m]" -map "[90m]" -map 1:a -force_key_frames "expr:gte(t,n_forced*10)" -c:v h264_nvenc -preset slow -rc vbr_hq -b:v 9.0M -c:a aac -b:a 192k -shortest -fflags +shortest -max_interleave_delta 200M "test90m.mp4" -map "[45m]" -map 1:a -force_key_frames "expr:gte(t,n_forced*10)" -c:v h264_nvenc -preset slow -rc vbr_hq -b:v 4.5M -c:a aac -b:a 192k -shortest -fflags +shortest -max_interleave_delta 200M "test45m.mp4"

Gyan
  • 85,394
  • 9
  • 169
  • 201
0

Everything after the last "-i" option defines output options, so you have to repeat all output options changing only those you want to differ.

E.g.

ffmpeg -y -f lavfi -i anullsrc=cl=mono:sample_rate=48000 -i "test.mxf" -shortest \
-vf yadif=1 -s 1920:1080 -c:v h264_nvenc -force_key_frames "expr:gte(t,n_forced*10)" -pix_fmt yuv420p -preset slow -rc vbr_hq -b:v 4.5M -map 1:v -map 0:a -c:a aac -b:a 192k "test.mp4" \
-vf yadif=1 -s 1920:1080 -c:v h264_nvenc -force_key_frames "expr:gte(t,n_forced*10)" -pix_fmt yuv420p -preset slow -rc vbr_hq -b:v 9.0M -map 1:v -map 0:a -c:a aac -b:a 192k "test2.mp4"

Please note that -shortest is an input option so it should be specified only once.

pszemus
  • 375
  • 2
  • 10
  • shortest is an output option. Your command deinterlaces and scales the video twice. Use filter_complex, deint and scale once, thn use split to produce two outputs. Map one each per output. – Gyan Sep 25 '21 at 03:51
  • Can you please give me an example of my string with filter_complex split and map. – Christian R Sep 26 '21 at 07:41
  • Think I got it (sort of); ffmpeg -y -hwaccel cuvid -i test.mxf -shortest -filter_complex "[0:v]yadif=1, scale=1920:1080,split=2[out1][out2]" -map "[out1]" -c:v h264_nvenc -force_key_frames "expr:gte(t,n_forced*10)" -pix_fmt yuv420p -preset slow -rc vbr_hq -b:v 4.5M test2.mp4 -map "[out2]" -c:v h264_nvenc -force_key_frames "expr:gte(t,n_forced*10)" -pix_fmt yuv420p -preset slow -rc vbr_hq -b:v 9M test3.mp4 But how do I encode the audio once and map it? – Christian R Sep 27 '21 at 08:05