http://www.stillhq.com/extracted/howto-jpeg2mpeg/output.html
En Linux, el software FFmpeg y Mencoder puede convertir el. Formato flv a / desde otros formatos. También llevan a cabo operaciones (el tamaño, etc ..). Estos programas están en la línea de comandos.
Para instalar en Debian y derivados (Ubuntu, etc...): sudo aptitude install ffmpeg mencoder lame
Ejemplos:
- Convertir FLV al archivo de AVI: ffmpeg -i mavideo.flv mavideo.avi
- Convertir AVI al archivo FLV: ffmpeg -i mavideo.avi mavideo.flv
- Convertir WMV en archivo MPEG-4 (Xvid): mencoder mavideo.wmv -ovc xvid -oac mp3lame -o mavideo.avi
Muchas opciones están disponibles en ffmpeg y mencoder para elegir codecs (MPEG1/2, DivX, Xvid, MP3, AAC, QuickTime, H.264, Matroska...) y poner estos codecs (relación de compresión, modos, etc ..).
Para conocer los codecs compatible con su versión, escriba:
- ffmpeg -formats
- mencoder -ovc help
http://sourceforge.net/docman/display_doc.php?docid=3456&group_id=5776#ss4.1
4.1 Creating videos from images
You can use jpeg2yuv to create a yuv stream from separate JPEG images. This stream is sent to stdout, so that it can either be saved into a file, encoded directly to a mpeg video using mpeg2enc or used for anything else.
Saving an yuv stream can be done like this:
> jpeg2yuv -f 25 -I p -j image%05d.jpg > result.yuv
Creates the file result.yuv containing the yuv video data with 25 FPS. The -f option is used to set the frame rate. Note that image%05d.jpg means that the jpeg files are named image00000.jpg, image00001.jpg and so on. (05 means five digits, 04 means four digits, etc.) The -I p is needed for specifing the interlacing. You have to check which type you have. If you don't have interlacing just choose p for progressive
If you want to encode a mpeg video directly from jpeg images without saving a separate video file type:
> jpeg2yuv -f 25 -I p -j image%05d.jpg | mpeg2enc -o mpegfile.m1v
Does the same as above but saves a mpeg video rather than a yuv video. See mpeg2enc section for details on how to use mpeg2enc.
You can also use yuvscaler between jpeg2yuv and mpeg2enc. If you want to create a SVCD from your source images:
> jpeg2yuv -f 25 -I p -j image%05d.jpg | yuvscaler -O SVCD | mpeg2enc -f 4 -o video.m2v
You can use the -b option to set the number of the image to start with. The number of images to be processed can be specified with the -n number. For example, if your first image is image01.jpg rather than image00.jpg, and you only want 60 images to be processed type:
>jpeg2yuv -b 1 -f 25 -I p -n 60 -j image*.jpg | yuv2lav -o stream_without_sound.avi
Adding the sound to the stream then:
> lavaddwav stream_without_sound.avi sound.wav stream_with_sound.avi
For ppm input there is the ppmtoy4m util. There is a manpage for ppmtoy4m that should be consulted for additional information.
So to create a mpeg video try this:
>cat *.ppm | ppmtoy4m -o 75 -n 60 -F 25:1 | mpeg2enc -o output.m1v
Cat's each *.ppm file to ppmtoy4m. There the first 75 frames (pictures) are ignored and next 60 are encoded by mpeg2enc to output.m1v. You can run it without the -o and -n option. The -F options sets the frame rate, default is NTSC (30000:1001), for PAL you have to use -F 25:1.
Other picture formats can also be used if there is a converter to ppm.
>ls *.tga | xargs -n1 tgatoppm | ppmtoy4m | yuvplay
A list of filenames (ls *.tga) is given to xargs that executes the tgatoppm with one (-n 1) argument per call, and feeds the output into ppmtoy4m. This time the video is only shown on the screen. The xargs is only needed if the converter (tgatoppm), can only operate on a single image at a time.
If you want to use the ImageMagick 'convert' tool (a Swiss Army Knife) try:
>convert *.gif ppm:- | ppmtoy4m | yuvplay
That means take all '.jpg' images in directory, convert to PPM format, and pipe to stdout, then ppmtoy4m processes them ....
