3

I have lots of large mjpeg timelapse videos, and I would like to speed them up with ffmpeg without loosing quality, dropping or creating frames.

Video: mjpeg (MJPG / 0x47504A4D), yuvj420p(pc, bt470bg/unknown/unknown), 1280x720, 605 kb/s, 1 fps, 1 tbr, 1 tbn, 1 tbc

The only way I got it working is ffmpeg -r 10 -i video.avi -vsync 0 output.mp4, but this encodes the output with mpeg4. If I use -vcodec copy, the -r 10 looses its power. The PTS rescaling method creates and drops frames. I do not care about timestamps, I want a file with all of the input frames at a fixed (higher) frame rate. Is there a simpler solution than this? Maybe with image2pipe?

3

This can't normally be done, but luckily for you, MJPEG is a codec for which streamcopy + piping can work

ffmpeg -i in.avi -c copy -f image2pipe - | ffmpeg -f image2pipe -framerate 50 -i - -c copy out.mp4

The JPEG frames in your input are malformed. For such streams, it's a two step process

ffmpeg -i in.avi -c copy frames%d.jpg

ffmpeg -framerate 50 -i frames%d.jpg -c copy out.mp4
  • Thanks, I've tried this approach, but although the input and output file are almost the same size, there are (pretty big) jumps in the output video. (Even when stepping frame by frame in VLC). – Balint Mar 30 '18 at 20:34
  • Share the full log. Is the input variable framerate? By jumps in output - do you mean missing frames? – Gyan Mar 31 '18 at 5:22
  • Here is the log. I think the input is constant 1 FPS. By jumps I mean missing frames, as you can see at the bottom of the log: only 286 remained from the 1000 input frames. – Balint Mar 31 '18 at 11:08
  • Can you share this sample? I suspect packet parsing issues. You can also dump frames to an image sequence instead of pipe and then use them in step 2. – Gyan Mar 31 '18 at 14:59
  • Sure, here it is. – Balint Mar 31 '18 at 20:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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