I am creating a short video from a sequence of 100 images using ffmpeg. There are several articles that helped me put together a command, but the one I'm using is directly taken from ffmpeg images-to-video script anyone?.
The following command produces a video file that plays well in all video players I have (OS X).
cat input/*.jpg | ffmpeg -f image2pipe -r 10 -vcodec mjpeg -i - out.mp4
But if I change it to,
cat input/*.jpg | ffmpeg -f image2pipe -r 1 -vcodec mjpeg -i - out.mp4
It plays well in all but VLC media player. VLC displays the initial 1 to 3 images, then just freezes on the frame. I've tested a few different frame rates, and it seems the cutoff that breaks the video playback in VLC lies somewhere between 1.125 and 1.175.
Any advice on what I'm dealing with here would be much appreciated.
It's a long known bug in VLC: https://trac.videolan.org/vlc/ticket/3625 (https://trac.videolan.org/vlc/ticket/214)
It has been reported by many users with various thresholds, but from what I found and experienced myself, the threshold is somewhere around a couple of FPS.
Currently I am sadly looking at frozen first frame of a 2 FPS video that won't play in the current version of VLC (2.2.4) I remember it working on some 1.1.x version (even though the bug was reported much earlier) but after update to 2.x it stopped working for me.
Me and my colleague have actually compared the behavior with the very same video files (2 FPS) some time ago and while I could play all of them without problems with 1.1.x (I think it was 1.1.1 but I am not 100% sure anymore), he couldn't play any of them with 2.x. After he downgraded VLC to 1.1.x, he could play them as well.
So maybe downgrade is the way to go, if you're desperate to use VLC and will not miss anything from 2.x. Otherwise I'd say save yourself the painful hours of fiddling with VLC settings and simply use a different player.
Update: This now seems to be fixed in VLC 3.0.4 (see https://trac.videolan.org/vlc/ticket/214) I did not test it myself though.
Use both
-framerate
and-r
E.g., to have a final video that looks like 1FPS:
This is mentioned on the wiki at: http://trac.ffmpeg.org/wiki/Slideshow#Framerates
It sets the output framerate to
30
, which VLC can handle, and copies each images 30 times, so that the output video appears to be at 1 FPS.VLC is then able to play the video normally.
See also: https://unix.stackexchange.com/questions/68770/converting-png-frames-to-video-at-1-fps
Tested on Ubuntu 16.10, VLC 2.2.4,
ffmpeg
3.0.5, in a directory with 10 PNGs.