Producing stable video from slow images with FFmpeg

geotheory

I'm struggling to achieve stable ffmpeg outputs that work across players and platforms for a video produced from a series of images that need to roll at about 1 fps.

ffmpeg -f image2 -r 1 -i %02d.png video.avi takes files named '01.png, 02.png' etc and outputs at 1 fps. But the result won't play on VLC or Quicktime - only WMP seems to handle it.

ffmpeg -f image2 -r 25 -i %02d.png video.mp4 does produce more stable output, but only at speeds around 25 fps - much too fast for my data viz.

Very grateful for assistance. It seems pointless to create duplicate images to resolve this.


The console output:

ffmpeg version N-53284-gd0a34ae Copyright (c) 2000-2013 the FFmpeg developers
  built on May 20 2013 01:07:40 with gcc 4.7.3 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzli
b --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libblu
ray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libr
tmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwola
me --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264
 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 33.100 / 52. 33.100
  libavcodec     55. 10.101 / 55. 10.101
  libavformat    55.  7.100 / 55.  7.100
  libavdevice    55.  1.100 / 55.  1.100
  libavfilter     3. 68.101 /  3. 68.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[image2 @ 00000000025977e0] max_analyze_duration 5000000 reached at 5000000 microseconds
Input #0, image2, from '%02d.png':
  Duration: 00:00:40.00, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: png, pal8, 1300x1100, 1 fps, 1 tbr, 1 tbn, 1 tbc
Output #0, avi, to 'video.avi':
  Metadata:
    ISFT            : Lavf55.7.100
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1300x1100, q=2-31, 200 kb/s, 1 tbn, 1 tb
c
Stream mapping:
  Stream #0:0 -> #0:0 (png -> mpeg4)
Press [q] to stop, [?] for help
frame=   40 fps=6.6 q=31.0 Lsize=    3754kB time=00:00:40.00 bitrate= 768.9kbits/s
video:3748kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.173624%
llogan

I'm not sure why the players won't work with 1 fps, but you can use -framerate for your input, and -r for your output to set different frame rates:

Example

ffmpeg -framerate 1 -i %02d.png -r 25 -pix_fmt yuv420p video.mp4

Notes

  • Image inputs use -framerate to set frame rate, while video output uses -r.

  • -f image2 is usually not required since the demuxer will recognize your inputs as images.

  • In this example ffmpeg will duplicate frames to reach the higher output frame rate, but it will still show the same "image" for each second.

  • Some encoders and containers may be limited in the frame rates that they support, but they will often let you know in the ffmpeg console output.

  • By default ffmpeg will use libx264 (H.264 video) as the encoder for MP4 container output. If it is unavailable then mpeg4 (MPEG-4 Part 2 video) will be used.

  • -pix_fmt yuv420p will output a widely compatible chroma subsampled output.

Just out of curiosity it might be interesting to find out the lowest output -framerate value that works in all of your players.

Also see

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

FFmpeg producing a flickering video from images

From Dev

Producing lossless video from set of .png images using ffmpeg

From Dev

Creating video from images with different SARs with FFMPEG

From

How to create a video from images with FFmpeg?

From Dev

ffmpeg how to output images from a video

From Dev

ffmpeg pipe images extracted from video

From Dev

Make video from images with ffmpeg/imagemagic

From Dev

Can FFMPEG extract images from a video with timestamps?

From Dev

create video from jpg images using ffmpeg

From Dev

Slow Video rotation in FFMPEG

From Dev

FFMpeg : Converting a video file to a gif with multiple images from video

From Dev

ffmpeg - merge images with video

From Dev

FFmpeg. Video to images

From Dev

ffmpeg slow motion video with audio

From Dev

FFMPEG - Create a slideshow video from images in a directory, sorted alphabetically

From Dev

Create video from images and audio with varying image durations using FFMPEG?

From Dev

Combining images into video with ffmpeg, but from multiple folders into the same frames

From Dev

ffmpeg slideshow video from images creating empty mp4

From Dev

ffmpeg: Is there a way to create video from images and overlay on image at same time?

From Dev

ffmpeg- make video from images in different folders

From Dev

FFmpeg make video from images skip middle or rear range

From Dev

ffmpeg: video from images - handling a zero length image file

From Dev

FFmpeg making video from images placed in different folders

From Dev

Android ffmpeg: create video from sequence of images using jni

From Dev

How to extract images from video files using FFmpeg without blur?

From Dev

ffmpeg: overlay multiple images to a video

From Dev

FFMPEG: Convert .rgb images to video

From

FFMPEG- Convert video to images

From Dev

FFMpeg convert jpeg images to video

Related Related

  1. 1

    FFmpeg producing a flickering video from images

  2. 2

    Producing lossless video from set of .png images using ffmpeg

  3. 3

    Creating video from images with different SARs with FFMPEG

  4. 4

    How to create a video from images with FFmpeg?

  5. 5

    ffmpeg how to output images from a video

  6. 6

    ffmpeg pipe images extracted from video

  7. 7

    Make video from images with ffmpeg/imagemagic

  8. 8

    Can FFMPEG extract images from a video with timestamps?

  9. 9

    create video from jpg images using ffmpeg

  10. 10

    Slow Video rotation in FFMPEG

  11. 11

    FFMpeg : Converting a video file to a gif with multiple images from video

  12. 12

    ffmpeg - merge images with video

  13. 13

    FFmpeg. Video to images

  14. 14

    ffmpeg slow motion video with audio

  15. 15

    FFMPEG - Create a slideshow video from images in a directory, sorted alphabetically

  16. 16

    Create video from images and audio with varying image durations using FFMPEG?

  17. 17

    Combining images into video with ffmpeg, but from multiple folders into the same frames

  18. 18

    ffmpeg slideshow video from images creating empty mp4

  19. 19

    ffmpeg: Is there a way to create video from images and overlay on image at same time?

  20. 20

    ffmpeg- make video from images in different folders

  21. 21

    FFmpeg make video from images skip middle or rear range

  22. 22

    ffmpeg: video from images - handling a zero length image file

  23. 23

    FFmpeg making video from images placed in different folders

  24. 24

    Android ffmpeg: create video from sequence of images using jni

  25. 25

    How to extract images from video files using FFmpeg without blur?

  26. 26

    ffmpeg: overlay multiple images to a video

  27. 27

    FFMPEG: Convert .rgb images to video

  28. 28

    FFMPEG- Convert video to images

  29. 29

    FFMpeg convert jpeg images to video

HotTag

Archive