FFMPEG changing output framerate issues

Viewed 61

I want to take the input, blend N frames, decimate the other frames and use those for the output with the fps of my choice.

I used this line:

ffmpeg -y -i input.mp4 -vf tmix=frames=15:weights="1",select='not(mod(n\,15))'  -vsync vfr frames/output-%05d.tif

That generated images, which I combined into the video. So far, so good. But I'd like to skip the image output and go straight to video, so I tried this:

ffmpeg -y -i input.mp4 -vf tmix=frames=15:weights="1",select='not(mod(n\,15))'  -vsync vfr -r 30 -c:v prores_ks -profile:v 3 -vendor apl0 -bits_per_mb 8000 -pix_fmt yuv422p10le output.mov

That produces 1.62 fps video, instead of 30 fps.

I'm at a loss on how to get it to output 30fps without the intermediate step of outputting images.

Thanks

1 Answers

I think the simplest way to achieve this is to feed the input at the 15-times the desired rate and drop all intermediate frames with -r 30:

ffmpeg -y -r 450 -i input.mp4 \
  -vf tmix=frames=15:weights="1" \
  -r 30 sandbox/out.mp4

However, a tmix solution is somewhat inefficient for your use case because it's mixing for all frames, including those dropped. If you don't mind a longer expression, you can try:

ffmpeg -i in.mp4 \
  -vf 
    setpts=\'floor(N/15)/(30*TB)\',select=\'mod(n,15)+1\':n=15[v0][v1][v2][v3][v4][v5][v6][v7][v8][v9][v10][v11][v12][v13][v14];\
    [v0][v1][v2][v3][v4][v5][v6][v7][v8][v9][v10][v11][v12][v13][v14]mix=inputs=15:weights=1 \
  -r 30 sandbox/out.mp4

[edit] setpts expression should be floor(N/15)/(30*TB) not mod(n,15)+1 for 15 successive frames to have the same pts.

Related