I have noticed today that when I use ffmpeg 4.0 stable to decode some TS files into y4m or ffv1 it occasionally skips some frames. My input file has all the frames burned into the picture and I am extracting some frames at regular intervals. Sometimes it works just fine without any skipped frames but sometimes it skips one or two frames. I am using the following command to decode my input:

ffmpeg -i input.ts -vsync 0 output.y4m

and I am extracting the frames using:

ffmpeg -ss xxx -i output.y4m -vframes 1 xxx.png

I am substituting xxx with 0, 100, 200, etc and sometimes I see 1-2-3 frame dropped which is very annoying since I am trying to evaluate the PSNR afterwards and this is messing up the whole PSNR/SSIM evaluation.

[EDIT] I have executed the command which @Gyan suggested:

ffmpeg -v 99 -loglevel 99 -i test.ts \
-c:v rawvideo -vsync 0 \
-enc_time_base 1/1000 output.nut &> test.log

And here is the log file test.log

1 Answer 1


Y4M has no timestamps, only framerate in its header. So, if your source has any variability in its framerate, you'll see a shift in apparent timestamp in the Y4M.


n     src     y4m
0       0       0
1    0.04    0.04 
2    0.07    0.08
3    0.12    0.12
4    0.21    0.16
5    0.24    0.20
6    0.27    0.24 

Over a long period, these perturbations can add up. Here frame #6 in src is at TS of src #5 in Y4M.

Edit: the sample TS file has VFR timestamps.

Use -c:v rawvideo -vsync 0 -vf setpts=N/FRAME_RATE/TB -an and save to .nut.

  • I have tested your solution and executed ffmpeg -i input.ts -c:v rawvideo -vsync 0 -enc_time_base 1/1000 output.nut but unfortunately I am losing one frame every ~1000 frames and this is pretty consistent loss. I have tried to add -an, remove the -enc-time-base but it is always dropping a frame every ~1000 frames. As a matter of fact ffmpeg 3.2.4 works better in this regard and not dropping frames with the same input. Commented Jun 7, 2018 at 12:15
  • Share the full log of your command.
    – Gyan
    Commented Jun 7, 2018 at 12:28
  • I have uploaded the test.log file using a link from wetransfer. It is rather bulky: 19Mb and my original video sequence has ~37000 frames. The link and the command could be seen in my original post, in the EDIT section. Commented Jun 7, 2018 at 13:04
  • Can you share the source file?
    – Gyan
    Commented Jun 9, 2018 at 4:07
  • you can download it from here @Gyan Commented Jun 11, 2018 at 8:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.