Changes between Version 11 and Version 12 of Slideshow
- Timestamp:
- Nov 25, 2013, 9:48:18 AM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Slideshow
v11 v12 1 1 == Frame rates == 2 2 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. 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. 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 }}} 4 9 5 10 You can specify two frame rates: 6 11 7 12 * 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`, orusing 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. 9 14 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.15 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` 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. 11 16 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:17 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: 13 18 14 19 {{{ … … 16 21 }}} 17 22 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 25 For example if you want to start with `img126.png` then use the `-start_number` option: 26 27 {{{ 28 ffmpeg -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 33 If 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): 19 34 20 35 {{{ … … 22 37 }}} 23 38 39 Alternatively 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 {{{ 42 ffmpeg -r 1/5 -i img%03d.png -c:v libx264 -vf "fps=25,format=yuv420p" out.mp4 43 }}} 24 44 25 45 == Color space conversion and chroma sub-sampling == 26 46 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.47 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, 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. 28 48 29 49 == Using a glob pattern == … … 51 71 == Adding audio == 52 72 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 otherAAC encoder]] as well:73 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. The internal AAC encoder is used in this example, but you can [[AACEncodingGuide|use any other supported AAC encoder]] as well: 54 74 55 75 {{{ … … 59 79 60 80 == See also == 81 * [http://ffmpeg.org/ffmpeg-formats.html#image2-2 FFmpeg image file demuxer documentation] 61 82 * [[Create a thumbnail image every X seconds of the video]] 62 83 * [[x264EncodingGuide|x264 Encoding Guide]]
