Changes between Version 11 and Version 12 of Slideshow


Ignore:
Timestamp:
Nov 25, 2013, 11:48:18 AM (6 years ago)
Author:
llogan
Comment:

make important note more noticable; genericize yuv420p issues; show alternative using format filter; add -start_number example

Legend:

Unmodified
Added
Removed
Modified
  • Slideshow

    v11 v12  
    11== Frame rates ==
    22
    3 This will create a video slideshow (using the encoder `libx264`) from series of numerically sequential PNG images named `img001.png`, `img002.png`, `img003.png`, etc. '''Important:''' All images in a series need to be of the same size and format.
     3This will create a video slideshow (using the encoder `libx264`) from series of numerically sequential PNG images named `img001.png`, `img002.png`, `img003.png`, etc.
     4
     5{{{
     6#!div style="border: 1pt dotted; margin: 1em"
     7'''Important:''' All images in a series need to be the same size and format.
     8}}}
    49
    510You can specify two frame rates:
    611
    712* The rate according to which the images are read, by setting `-r` before `-i`. The default for reading input is `-r 25` which will be set if no `-r` is specified.
    8 * The output frame rate for the video stream, by setting `-r` after `-i`, or using the `fps` filter. If you want the input and output frame rates to be the same, then just declare an input `-r` and the output will inherit the same value.
     13* The output frame rate for the video stream by setting `-r` after `-i`, or by using the `fps` filter. If you want the input and output frame rates to be the same, then just declare an input `-r` and the output will inherit the same value.
    914
    10 By using a separate `-r` (frames per second) for the input and output you can control the duration at which each input is displayed and tell ffmpeg the frame rate you want for the output file. If the input `-r` is lower than the output, `-r` ffmpeg will duplicate frames to reach your desired output frame rate. If the input `-r` is higher than the output `-r` ffmpeg will drop frames to reach your desired output frame rate.
     15By using a separate `-r` (frames per second) for the input and output you can control the duration at which each input is displayed and tell ffmpeg the frame rate you want for the output file. If the input `-r` is lower than the output `-r` then ffmpeg will duplicate frames to reach your desired output frame rate. If the input `-r` is higher than the output `-r` then ffmpeg will drop frames to reach your desired output frame rate.
    1116
    12 In this example each image will have a duration of 5 seconds (the inverse of 1/5 frames per second). The video stream will have a frame rate of 30 fps, by duplicating the frames accordingly:
     17In this example each image will have a duration of 5 seconds (the inverse of 1/5 frames per second). The video stream will have a frame rate of 30 fps by duplicating the frames accordingly:
    1318
    1419{{{
     
    1621}}}
    1722
    18 If your video does not show the frames correctly, setting the `fps` filter instead of the output framerate should work:
     23== Starting with a specific image ==
     24
     25For example if you want to start with `img126.png` then use the `-start_number` option:
     26
     27{{{
     28ffmpeg -r 1/5 -start_number 126 -i img%03d.png -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4
     29}}}
     30
     31== If your video does not show the frames correctly ==
     32
     33If you encounter problems, such as the first image is skipped or only shows for one frame, then use the [http://ffmpeg.org/ffmpeg-filters.html#fps fps video filter] instead of `-r` for the output framerate (see ticket:1578 and ticket:3164 for more info):
    1934
    2035{{{
     
    2237}}}
    2338
     39Alternatively the [http://ffmpeg.org/ffmpeg-filters.html#format format video filter] can be added to the [http://ffmpeg.org/ffmpeg-filters.html#Filtergraph-syntax-1 filterchain] to replace `-pix_fmt yuv420p`. The advantage to this method is that you can control which filter goes first:
     40
     41{{{
     42ffmpeg -r 1/5 -i img%03d.png -c:v libx264 -vf "fps=25,format=yuv420p" out.mp4
     43}}}
    2444
    2545== Color space conversion and chroma sub-sampling ==
    2646
    27 By default when using `libx264`, and depending on your input, ffmpeg will attempt to avoid color subsampling. Technically this is preferred, but unfortunately almost all video players and many online video services only support YUV 4:2:0. PNG uses the RGB color space, so when using PNG images as your input you must add `-pix_fmt yuv420p` or `-vf format=yuv420p` if you want maximum compatibility. You can omit this if you are using JPG images as inputs.
     47By default when using `libx264`, and depending on your input, ffmpeg will attempt to avoid color subsampling. Technically this is preferred, but unfortunately almost all video players, excluding FFmpeg based players, and many online video services only support the YUV color space with 4:2:0 chroma subsampling. Using the options `-pix_fmt yuv420p` or `-vf format=yuv420p` will maximize compatibility.
    2848
    2949== Using a glob pattern ==
     
    5171== Adding audio ==
    5272
    53 If you want to add audio (e.g. `audio.wav`) to one "poster" image, you need `-shortest` to tell it to stop after the audio stream is finished. We use the internal AAC encoder, but you can [[AACEncodingGuide|use any other AAC encoder]] as well:
     73If you want to add audio (e.g. `audio.wav`) to one "poster" image, you need `-shortest` to tell it to stop after the audio stream is finished. The internal AAC encoder is used in this example, but you can [[AACEncodingGuide|use any other supported AAC encoder]] as well:
    5474
    5575{{{
     
    5979
    6080== See also ==
     81* [http://ffmpeg.org/ffmpeg-formats.html#image2-2 FFmpeg image file demuxer documentation]
    6182* [[Create a thumbnail image every X seconds of the video]]
    6283* [[x264EncodingGuide|x264 Encoding Guide]]