[Ffmpeg-devel] [Wishlist] Specify *input* frame rate for image sequence

Mary Ellen Foster mefoster
Sat Aug 6 16:31:38 CEST 2005


(I'm sending this to the "devel" list, rather than the "user" list,
because my initial instinct was to file a wishlist bug, and when I
clicked on the "bug" link it told me to post to this list.)

I'm currently trying to figure out the best way to create .avi files
from the output of another program I use. The program outputs,
separately:
- A sequence of image files
- The accompanying soundtrack

I've been partially successful in using ffmpeg to create the .avi
file, using the following sort of command line (I've also shown the
output):
% ffmpeg -i img%04d.jpg -r 30 -i sound.wav -acodec mp3 -vcodec xvid \
    -pix_fmt yuv420p movie.avi
ffmpeg version CVS, build 3211265, Copyright (c) 2000-2004 Fabrice Bellard
  configuration:  --enable-mp3lame --enable-libogg --enable-pthreads
--prefix=/disk/scratch --enable-faad --enable-a52 --enable-xvid
--enable-shared --enable-gpl --extra-cflags=-I/disk/scratch/include
--extra-ldflags=-L/disk/scratch/lib
  built on Aug  6 2005 13:56:43, gcc: 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
Input #0, image2, from 'img%04d.jpg':
  Duration: 00:00:09.9, start: 0.000000, bitrate: N/A
  Stream #0.0: Video: mjpeg, yuvj420p, 350x350, 25.00 fps
Input #1, wav, from 'sound.wav':
  Duration: 00:00:08.3, start: 0.000000, bitrate: 352 kb/s
  Stream #1.0: Audio: pcm_s16le, 22050 Hz, mono, 352 kb/s
Output #0, avi, to 'movie.avi':
  Stream #0.0: Video: xvid, yuv420p, 350x350, 30.00 fps, q=2-31, 200 kb/s
  Stream #0.1: Audio: mp3, 22050 Hz, mono, 64 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #1.0 -> #0.1
Press [q] to stop encoding
frame=  296 q=9.0 Lsize=     393kB time=8.4 bitrate= 384.3kbits/s
video:283kB audio:66kB global headers:0kB muxing overhead 12.751704%

The problem: the intended frame rate of the image sequence is actually
30 FPS; this is not changeable in the program that's creating it. As
far as I can tell, "-r 30" in the above command line only controls the
frame rate of the *output* stream; however, there's no way I can tell
to specify the *input* frame rate. You can see that it's using "25.00
fps" for the input sequence, which makes the durations not match up
(9.9 vs 8.3 seconds). So the net result is that the video runs slower
than the audio in the output of the above command.

Is there any way to specify the desired input frame rate? I've tried
using .png instead of .jpg and I get the same thing.

MEF

-- 
__ Mary Ellen Foster __ http://homepages.inf.ed.ac.uk/mef/ __
"One of the main causes of the fall of the Roman Empire was that, 
lacking zero, they had no way to indicate successful termination 
of their C programs." (Robert Firth)





More information about the ffmpeg-devel mailing list