12 May, 2009

FFmpeg Ninja Moves - part 1

Ffmpeg is the Swiss army knife of video converters. Giving a plethora of video and audio conversion options this utility is the framework for arming you with the tools to do significant audio/video processing. This series of posts will explore many of the commonly used features of the utility.

Let's start with the basics; accessing the license and help manuals are as good a place to start as any.


$ ffmpeg -L
FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2004 Fabrice Bellard
configuration: --enable-gpl --enable-pp --enable-pthreads --enable-vorbis --enable-libogg --enable-a52 --enable-dts --enable-libgsm --enable-dc1394 --disable-debug --enable-shared --prefix=/usr
libavutil version: 0d.49.0.0
libavcodec version: 0d.51.11.0
libavformat version: 0d.50.5.0
built on Mar 26 2007 14:28:38, gcc: 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2004 Fabrice Bellard
configuration: --enable-gpl --enable-pp --enable-pthreads --enable-vorbis --enable-libogg --enable-a52 --enable-dts --enable-libgsm --enable-dc1394 --disable-debug --enable-shared --prefix=/usr
libavutil version: 0d.49.0.0
libavcodec version: 0d.51.11.0
libavformat version: 0d.50.5.0
built on Mar 26 2007 14:28:38, gcc: 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA


Accessing the help info shows the extent of options FFmpeg offers.


$ ffmpeg -h
FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2004 Fabrice Bellard
configuration: --enable-gpl --enable-pp --enable-pthreads --enable-vorbis --enable-libogg --enable-a52 --enable-dts --enable-libgsm --enable-dc1394 --disable-debug --enable-shared --prefix=/usr
libavutil version: 0d.49.0.0
libavcodec version: 0d.51.11.0
libavformat version: 0d.50.5.0
built on Mar 26 2007 14:28:38, gcc: 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2004 Fabrice Bellard
configuration: --enable-gpl --enable-pp --enable-pthreads --enable-vorbis --enable-libogg --enable-a52 --enable-dts --enable-libgsm --enable-dc1394 --disable-debug --enable-shared --prefix=/usr
libavutil version: 0d.49.0.0
libavcodec version: 0d.51.11.0
libavformat version: 0d.50.5.0
built on Mar 26 2007 14:28:38, gcc: 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
usage: ffmpeg [[infile options] -i infile]... {[outfile options] outfile}...
Hyper fast Audio and Video encoder

Main options:
-L show license
-h show help
-version show version
-formats show available formats, codecs, protocols, ...
-f fmt force format
-img img_fmt force image format
-i filename input file name
-y overwrite output files
-t duration set the recording time
-fs limit_size set the limit file size
-ss time_off set the start time offset
-itsoffset time_off set the input ts offset
-title string set the title
-timestamp time set the timestamp
-author string set the author
-copyright string set the copyright
-comment string set the comment
-v verbose control amount of logging
-target type specify target file type ("vcd", "svcd", "dvd", "dv", "dv50", "pal-vcd", "ntsc-svcd", ...)
-dframes number set the number of data frames to record
-scodec codec force subtitle codec ('copy' to copy stream)
-newsubtitle add a new subtitle stream to the current output stream
-slang code set the ISO 639 language code (3 letters) of the current subtitle stream

Video options:
-b bitrate set video bitrate (in kbit/s)
-vframes number set the number of video frames to record
-r rate set frame rate (Hz value, fraction or abbreviation)
-s size set frame size (WxH or abbreviation)
-aspect aspect set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)
-croptop size set top crop band size (in pixels)
-cropbottom size set bottom crop band size (in pixels)
-cropleft size set left crop band size (in pixels)
-cropright size set right crop band size (in pixels)
-padtop size set top pad band size (in pixels)
-padbottom size set bottom pad band size (in pixels)
-padleft size set left pad band size (in pixels)
-padright size set right pad band size (in pixels)
-padcolor color set color of pad bands (Hex 000000 thru FFFFFF)
-vn disable video
-bt tolerance set video bitrate tolerance (in kbit/s)
-maxrate bitrate set max video bitrate tolerance (in kbit/s)
-minrate bitrate set min video bitrate tolerance (in kbit/s)
-bufsize size set ratecontrol buffer size (in kByte)
-vcodec codec force video codec ('copy' to copy stream)
-sameq use same video quality as source (implies VBR)
-pass n select the pass number (1 or 2)
-passlogfile file select two pass log file name
-newvideo add a new video stream to the current output stream

Advanced Video options:
-pix_fmt format set pixel format
-g gop_size set the group of picture size
-intra use only intra frames
-vdt n discard threshold
-qscale q use fixed video quantiser scale (VBR)
-qmin q min video quantiser scale (VBR)
-qmax q max video quantiser scale (VBR)
-lmin lambda min video lagrange factor (VBR)
-lmax lambda max video lagrange factor (VBR)
-mblmin q min macroblock quantiser scale (VBR)
-mblmax q max macroblock quantiser scale (VBR)
-qdiff q max difference between the quantiser scale (VBR)
-qblur blur video quantiser scale blur (VBR)
-qsquish squish how to keep quantiser between qmin and qmax (0 = clip, 1 = use differentiable function)
-qcomp compression video quantiser scale compression (VBR)
-rc_init_cplx complexity initial complexity for 1-pass encoding
-b_qfactor factor qp factor between p and b frames
-i_qfactor factor qp factor between p and i frames
-b_qoffset offset qp offset between p and b frames
-i_qoffset offset qp offset between p and i frames
-ibias bias intra quant bias
-pbias bias inter quant bias
-rc_eq equation set rate control equation
-rc_override override rate control override for specific intervals
-me method set motion estimation method
-me_threshold motion estimaton threshold
-mb_threshold macroblock threshold
-bf frames use 'frames' B frames
-preme pre motion estimation
-bug param workaround not auto detected encoder bugs
-strict strictness how strictly to follow the standards
-deinterlace deinterlace pictures
-psnr calculate PSNR of compressed frames
-vstats dump video coding statistics to file
-vhook module insert video processing module
-intra_matrix matrix specify intra matrix coeffs
-inter_matrix matrix specify inter matrix coeffs
-top top=1/bottom=0/auto=-1 field first
-sc_threshold threshold scene change threshold
-me_range range limit motion vectors range (1023 for DivX player)
-dc precision intra_dc_precision
-mepc factor (1.0 = 256) motion estimation bitrate penalty compensation
-vtag fourcc/tag force video tag/fourcc
-skip_threshold threshold frame skip threshold
-skip_factor factor frame skip factor
-skip_exp exponent frame skip exponent
-genpts generate pts
-qphist show QP histogram
-vbsf bitstream filter

Audio options:
-aframes number set the number of audio frames to record
-ab bitrate set audio bitrate (in kbit/s)
-aq quality set audio quality (codec-specific)
-ar rate set audio sampling rate (in Hz)
-ac channels set number of audio channels
-an disable audio
-acodec codec force audio codec ('copy' to copy stream)
-vol volume change audio volume (256=normal)
-newaudio add a new audio stream to the current output stream
-alang code set the ISO 639 language code (3 letters) of the current audio stream

Advanced Audio options:
-atag fourcc/tag force audio tag/fourcc
-absf bitstream filter

Subtitle options:
-scodec codec force subtitle codec ('copy' to copy stream)
-newsubtitle add a new subtitle stream to the current output stream
-slang code set the ISO 639 language code (3 letters) of the current subtitle stream

Audio/Video grab options:
-vd device set video grab device
-vc channel set video grab channel (DV1394 only)
-tvstd standard set television standard (NTSC, PAL (SECAM))
-ad device set audio device
-grab format request grabbing using
-gd device set grab device

Advanced options:
-map file:stream[:syncfile:syncstream] set input stream mapping
-map_meta_data outfile:infile set meta data information of outfile from infile
-benchmark add timings for benchmarking
-dump dump each input packet
-hex when dumping packets, also dump the payload
-re read input at native frame rate
-loop_input loop (current only works with images)
-loop_output number of times to loop output in formats that support looping (0 loops forever)
-threads count thread count
-vsync video sync method
-async audio sync method
-vglobal video global header storage type
-copyts copy timestamps
-shortest finish encoding within shortest input
-dts_delta_threshold timestamp discontinuity delta threshold
-ps size set packet size in bits
-error rate error rate
-muxrate rate set mux rate
-packetsize size set packet size
-muxdelay seconds set the maximum demux-decode delay
-muxpreload seconds set the initial demux-decode delay
AVCodecContext AVOptions:
-bit_rate E.VA.
-bit_rate_tolerance E.V..
-flags EDVA.
-mv4 E.V.. use four motion vector by macroblock (mpeg4)
-obmc E.V.. use overlapped block motion compensation (h263+)
-qpel E.V.. use 1/4 pel motion compensation
-loop E.V.. use loop filter
-gmc E.V.. use gmc
-mv0 E.V.. always try a mb with mv=<0,0>
-part E.V.. use data partitioning
-gray EDV.. only decode/encode grayscale
-psnr E.V.. error[?] variables will be set during encoding
-naq E.V.. normalize adaptive quantization
-ildct E.V.. use interlaced dct
-low_delay .DV.. force low delay
-alt E.V.. enable alternate scantable (mpeg2/mpeg4)
-trell E.V.. use trellis quantization
-bitexact EDVAS use only bitexact stuff (except (i)dct)
-aic E.V.. h263 advanced intra coding / mpeg4 ac prediction
-umv E.V.. use unlimited motion vectors
-cbp E.V.. use rate distortion optimization for cbp
-qprd E.V.. use rate distortion optimization for qp selection
-aiv E.V.. h263 alternative inter vlc
-slice E.V..
-ilme E.V.. interlaced motion estimation
-scan_offset E.V.. will reserve space for svcd scan offset user data
-cgop E.V.. closed gop
-fast E.V.. allow non spec compliant speedup tricks
-sgop E.V.. strictly enforce gop size
-noout E.V.. skip bitstream encoding
-local_header E.V.. place global headers at every keyframe instead of in extradata
-me_method E.V..
-gop_size E.V..
-cutoff E..A. set cutoff bandwidth
-frame_size E..A.
-qcompress E.V..
-qblur E.V..
-qmin E.V..
-qmax E.V..
-max_qdiff E.V..
-max_b_frames E.V..
-b_quant_factor E.V..
-rc_strategy E.V..
-b_strategy E.V..
-hurry_up .DV..
-bugs .DV..
-autodetect .DV..
-old_msmpeg4 .DV..
-xvid_ilace .DV..
-ump4 .DV..
-no_padding .DV..
-amv .DV..
-ac_vlc .DV..
-qpel_chroma .DV..
-std_qpel .DV..
-qpel_chroma2 .DV..
-direct_blocksize .DV..
-edge .DV..
-hpel_chroma .DV..
-dc_clip .DV..
-ms .DV..
-lelim E.V.. single coefficient elimination threshold for luminance (negative values also consider dc coefficient)
-celim E.V.. single coefficient elimination threshold for chrominance (negative values also consider dc coefficient)
-strict E.V..
-very E.V..
-strict E.V..
-normal E.V..
-inofficial E.V..
-experimental E.V..
-b_quant_offset E.V..
-er .DV..
-careful .DV..
-compliant .DV..
-aggressive .DV..
-very_aggressive .DV..
-mpeg_quant E.V..
-rc_qsquish E.V..
-rc_qmod_amp E.V..
-rc_qmod_freq E.V..
-rc_eq E.V..
-rc_max_rate E.V..
-rc_min_rate E.V..
-rc_buffer_size E.V..
-rc_buf_aggressivity E.V..
-i_quant_factor E.V..
-i_quant_offset E.V..
-rc_initial_cplx E.V..
-dct E.V..
-auto E.V..
-fastint E.V..
-int E.V..
-mmx E.V..
-mlib E.V..
-altivec E.V..
-faan E.V..
-lumi_mask E.V.. lumimasking
-tcplx_mask E.V.. temporal complexity masking
-scplx_mask E.V.. spatial complexity masking
-p_mask E.V.. inter masking
-dark_mask E.V.. darkness masking
-idct EDV..
-auto EDV..
-int EDV..
-simple EDV..
-simplemmx EDV..
-libmpeg2mmx EDV..
-ps2 EDV..
-mlib EDV..
-arm EDV..
-altivec EDV..
-sh4 EDV..
-simplearm EDV..
-h264 EDV..
-vp3 EDV..
-ipp EDV..
-xvidmmx EDV..
-ec .DV..
-guess_mvs .DV..
-deblock .DV..
-pred E.V.. prediction method
-left E.V..
-plane E.V..
-median E.V..
-aspect E.V..
-debug EDVAS print specific debug info
-pict .DV..
-rc E.V..
-bitstream .DV..
-mb_type .DV..
-qp .DV..
-mv .DV..
-dct_coeff .DV..
-skip .DV..
-startcode .DV..
-pts .DV..
-er .DV..
-mmco .DV..
-bugs .DV..
-vis_qp .DV..
-vis_mb_type .DV..
-vismv .DV.. visualize motion vectors
-pf .DV..
-bf .DV..
-bb .DV..
-mb_qmin E.V..
-mb_qmax E.V..
-cmp E.V.. full pel me compare function
-subcmp E.V.. sub pel me compare function
-mbcmp E.V.. macroblock compare function
-ildctcmp E.V.. interlaced dct compare function
-dia_size E.V..
-last_pred E.V..
-preme E.V..
-precmp E.V.. pre motion estimation compare function
-sad E.V..
-sse E.V..
-satd E.V..
-dct E.V..
-psnr E.V..
-bit E.V..
-rd E.V..
-zero E.V..
-vsad E.V..
-vsse E.V..
-nsse E.V..
-w53 E.V..
-w97 E.V..
-dctmax E.V..
-chroma E.V..
-pre_dia_size E.V..
-subq E.V.. sub pel motion estimation quality
-me_range E.V..
-ibias E.V..
-pbias E.V..
-coder E.V..
-vlc E.V.. variable length coder / huffman coder
-ac E.V.. arithmetic coder
-context E.V.. context model
-mbd E.V..
-simple E.V..
-bits E.V..
-rd E.V..
-sc_threshold E.V..
-lmin E.V.. min lagrange factor
-lmax E.V.. max lagrange factor
-nr E.V.. noise reduction
-rc_init_occupancy E.V..
-inter_threshold E.V..
-flags2 EDVA.
-antialias .DV..
-auto .DV..
-fastint .DV..
-int .DV..
-float .DV..
-qns E.V.. quantizer noise shaping
-thread_count EDV..
-dc E.V..
-nssew E.V.. nsse weight
-skip_top .DV..
-skip_bottom .DV..
-profile E.VA.
-unknown E.VA.
-level E.VA.
-unknown E.VA.
-lowres .DV..
-frame_skip_threshold E.V..
-frame_skip_factor E.V..
-frame_skip_exp E.V..
-skipcmp E.V.. frame skip compare function
-border_mask E.V..
-mb_lmin E.V..
-mb_lmax E.V..
-me_penalty_compensation E.V..
-bidir_refine E.V..
-brd_scale E.V..
-crf E.V..
-cqp E.V..
-keyint_min E.V..
-refs E.V..
-chromaoffset E.V..
-bframebias E.V..
-trellis E.VA.
-directpred E.V..
-bpyramid E.V..
-wpred E.V..
-mixed_refs E.V..
-8x8dct E.V..
-fastpskip E.V..
-aud E.V..
-brdo E.V..
-complexityblur E.V..
-deblockalpha E.V..
-deblockbeta E.V..
-partitions E.V..
-parti4x4 E.V..
-parti8x8 E.V..
-partp4x4 E.V..
-partp8x8 E.V..
-partb8x8 E.V..
-sc_factor E.V..
-mv0_threshold E.V..
-ivlc E.V.. intra vlc table
-b_sensitivity E.V..
-compression_level E.VA.
-use_lpc E..A.
-lpc_coeff_precision E..A.
-min_prediction_order E..A.
-max_prediction_order E..A.
-prediction_order_method E..A.
-min_partition_order E..A.
-max_partition_order E..A.


You can query the version by issuing the following command.

$ ffmpeg -version
FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2004 Fabrice Bellard
configuration: --enable-gpl --enable-pp --enable-pthreads --enable-vorbis --enable-libogg --enable-a52 --enable-dts --enable-libgsm --enable-dc1394 --disable-debug --enable-shared --prefix=/usr
libavutil version: 0d.49.0.0
libavcodec version: 0d.51.11.0
libavformat version: 0d.50.5.0
built on Mar 26 2007 14:28:38, gcc: 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
ffmpeg SVN-rUNKNOWN
libavutil 3211264
libavcodec 3345152
libavformat 3278080


The next command is particularly useful, it provides an exhaustive list of codecs avalable, both video and audio. The fields preceeding each codec have the following meanings:
  • 'D' Decoding available
  • 'E' Encoding available
  • 'V/A/S' Video/audio/subtitle codec
  • 'S' Codec supports slices
  • 'D' Codec supports direct rendering
  • 'T' Codec can handle input truncated at random locations, not just frame boundaries

$ ffmpeg -formats
FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2004 Fabrice Bellard
configuration: --enable-gpl --enable-pp --enable-pthreads --enable-vorbis --enable-libogg --enable-a52 --enable-dts --enable-libgsm --enable-dc1394 --disable-debug --enable-shared --prefix=/usr
libavutil version: 0d.49.0.0
libavcodec version: 0d.51.11.0
libavformat version: 0d.50.5.0
built on Mar 26 2007 14:28:38, gcc: 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
File formats:
E 3g2 3gp2 format
E 3gp 3gp format
D 4xm 4X Technologies format
D RoQ Id RoQ format
D aac ADTS AAC
DE ac3 raw ac3
E adts ADTS AAC
DE aiff Audio IFF
DE alaw pcm A law format
DE amr 3gpp amr file format
DE asf asf format
E asf_stream asf format
DE au SUN AU Format
DE audio_device audio grab and output
DE avi avi format
D avs avs format
E crc crc testing format
D daud D-Cinema audio format
D dc1394 dc1394 A/V grab
D dts raw dts
DE dv DV video format
D dv1394 dv1394 A/V grab
E dvd MPEG2 PS format (DVD VOB)
D ea Electronic Arts Multimedia Format
DE ffm ffm format
D film_cpk Sega FILM/CPK format
DE flac raw flac
D flic FLI/FLC/FLX animation format
DE flv flv format
E framecrc framecrc testing format
DE gif GIF Animation
DE gxf GXF format
DE h261 raw h261
DE h263 raw h263
DE h264 raw H264 video format
D idcin Id CIN format
DE image image sequence
DE image2 image2 sequence
DE image2pipe piped image2 sequence
DE imagepipe piped image sequence
D ingenient Ingenient MJPEG
D ipmovie Interplay MVE format
DE m4v raw MPEG4 video format
D matroska Matroska file format
DE mjpeg MJPEG video
D mm American Laser Games MM format
DE mmf mmf format
E mov mov format
D mov,mp4,m4a,3gp,3g2,mj2 QuickTime/MPEG4/Motion JPEG 2000 format
E mp2 MPEG audio layer 2
DE mp3 MPEG audio layer 3
E mp4 mp4 format
DE mpeg MPEG1 System format
E mpeg1video MPEG video
E mpeg2video MPEG2 video
DE mpegts MPEG2 transport stream format
D mpegvideo MPEG video
E mpjpeg Mime multipart JPEG format
DE mulaw pcm mu law format
D mxf MXF format
D nsv NullSoft Video format
E null null video format
DE nut nut format
D nuv NuppelVideo format
DE ogg Ogg Vorbis
E psp psp mp4 format
D psxstr Sony Playstation STR format
DE rawvideo raw video format
D redir Redirector format
DE rm rm format
E rtp RTP output format
D rtsp RTSP input format
DE s16be pcm signed 16 bit big endian format
DE s16le pcm signed 16 bit little endian format
DE s8 pcm signed 8 bit format
D sdp SDP
D shn raw shorten
D smk Smacker Video
D sol Sierra SOL Format
E svcd MPEG2 PS format (VOB)
DE swf Flash format
D tta true-audio
DE u16be pcm unsigned 16 bit big endian format
DE u16le pcm unsigned 16 bit little endian format
DE u8 pcm unsigned 8 bit format
E vcd MPEG1 System format (VCD)
D video4linux video grab
D video4linux2 video grab
D vmd Sierra VMD format
E vob MPEG2 PS format (VOB)
DE voc Creative Voice File format
DE wav wav format
D wc3movie Wing Commander III movie format
D wsaud Westwood Studios audio format
D wsvqa Westwood Studios VQA format
DE yuv4mpegpipe YUV4MPEG pipe format

Image formats (filename extensions, if any, follow):
DE gif gif

Codecs:
D V 4xm
D V D 8bps
D V D aasc
DEA ac3
DEA adpcm_4xm
DEA adpcm_adx
DEA adpcm_ct
DEA adpcm_ea
DEA adpcm_ima_dk3
DEA adpcm_ima_dk4
DEA adpcm_ima_qt
DEA adpcm_ima_smjpeg
DEA adpcm_ima_wav
DEA adpcm_ima_ws
DEA adpcm_ms
DEA adpcm_sbpro_2
DEA adpcm_sbpro_3
DEA adpcm_sbpro_4
DEA adpcm_swf
DEA adpcm_xa
DEA adpcm_yamaha
D A alac
DEV D asv1
DEV D asv2
D V D avs
D V bmp
D V D camstudio
D V D camtasia
D V D cavs
D V D cinepak
D V D cljr
D A cook
D V D cyuv
D A dts
DES dvbsub
DES dvdsub
DEV D dvvideo
DEV D ffv1
DEVSD ffvhuff
DEA flac
D V D flashsv
D V D flic
DEVSD flv
D V D fraps
DEA g726
DEA gsm
DEV D h261
DEVSDT h263
D VSD h263i
EV h263p
D V DT h264
DEVSD huffyuv
D V D idcinvideo
D V D indeo2
D V indeo3
D A interplay_dpcm
D V D interplayvideo
EV jpegls
D V kmvc
EV ljpeg
D V D loco
D A mace3
D A mace6
D V D mdec
DEV D mjpeg
D V D mjpegb
D V D mmvideo
DEA mp2
D A mp3
D A mp3adu
D A mp3on4
DEVSDT mpeg1video
DEVSDT mpeg2video
DEVSDT mpeg4
D VSDT mpegvideo
DEVSD msmpeg4
DEVSD msmpeg4v1
DEVSD msmpeg4v2
D V D msrle
D V D msvideo1
D V D mszh
D V D nuv
DEV pam
DEV pbm
DEA pcm_alaw
DEA pcm_mulaw
DEA pcm_s16be
DEA pcm_s16le
DEA pcm_s24be
DEA pcm_s24daud
DEA pcm_s24le
DEA pcm_s32be
DEA pcm_s32le
DEA pcm_s8
DEA pcm_u16be
DEA pcm_u16le
DEA pcm_u24be
DEA pcm_u24le
DEA pcm_u32be
DEA pcm_u32le
DEA pcm_u8
DEV pgm
DEV pgmyuv
DEV png
DEV ppm
D A qdm2
D V D qdraw
D V D qpeg
D V D qtrle
DEV rawvideo
D A real_144
D A real_288
D A roq_dpcm
D V D roqvideo
D V D rpza
DEV D rv10
DEV D rv20
D A shorten
D A smackaud
D V smackvid
D V D smc
DEV snow
D A sol_dpcm
DEA sonic
EA sonicls
D V D sp5x
DEV D svq1
D VSD svq3
D V theora
D V D truemotion1
D V D truemotion2
D A truespeech
D A tta
D V D ultimotion
D V vc1
D V D vcr1
D A vmdaudio
D V D vmdvideo
DEA vorbis
D V vp3
D V D vqavideo
D A wmav1
D A wmav2
DEVSD wmv1
DEVSD wmv2
D V wmv3
D V D wnv1
D A ws_snd1
D A xan_dpcm
D V D xan_wc3
D V D xl
DEV D zlib
D V zmbv

Supported file protocols:
file: pipe: udp: rtp: tcp: http:
Frame size, frame rate abbreviations:
ntsc pal qntsc qpal sntsc spal film ntsc-film sqcif qcif cif 4cif
Motion estimation methods:
zero(fastest) full(slowest) log phods epzs(default) x1 hex umh iter

Note, the names of encoders and decoders dont always match, so there are
several cases where the above table shows encoder only or decoder only entries
even though both encoding and decoding are supported for example, the h263
decoder corresponds to the h263 and h263p encoders, for file formats its even
worse


Enough with the preliminaries, to begin using the utility you need to begin by specifying the input stream which can take the form of video file, a video hardware stream, or a series of images. The -i argument specifier specifies the input to be manipulated.

If you only specify an input file with no output file FFmpeg will display the input source information, for example:

$ ffmpeg -i ./ffmpeg/video0.avi
FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2004 Fabrice Bellard
configuration: --enable-gpl --enable-pp --enable-pthreads --enable-vorbis --enable-libogg --enable-a52 --enable-dts --enable-libgsm --enable-dc1394 --disable-debug --enable-shared --prefix=/usr
libavutil version: 0d.49.0.0
libavcodec version: 0d.51.11.0
libavformat version: 0d.50.5.0
built on Mar 26 2007 14:28:38, gcc: 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)

Seems that stream 0 comes from film source: 30000.00 (30000/1) -> 29.97 (30000/1001)
Input #0, avi, from './ffmpeg/video0.avi':
Duration: 00:01:17.1, start: 0.000000, bitrate: 14082 kb/s
Stream #0.0: Video: mpeg4, yuv420p, 720x480, 29.97 fps(r)
Stream #0.1: Audio: mp2, 48000 Hz, stereo, 64 kb/s

Must supply at least one output file


Note that the input stream #0 shows the video and audio specifics for the input. You'll later learn how specifying an output file you'll be enabled to manipulate the input source to the desired output format.

Let's finish off this post by converting a Mpeg4 encoded video in an AVI container to an encoded video to a MPG container.

$ ffmpeg -i ffmpeg/video0.avi /tmp/video0.mpg
FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2004 Fabrice Bellard
configuration: --enable-gpl --enable-pp --enable-pthreads --enable-vorbis --enable-libogg --enable-a52 --enable-dts --enable-libgsm --enable-dc1394 --disable-debug --enable-shared --prefix=/usr
libavutil version: 0d.49.0.0
libavcodec version: 0d.51.11.0
libavformat version: 0d.50.5.0
built on Mar 26 2007 14:28:38, gcc: 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)

Seems that stream 0 comes from film source: 30000.00 (30000/1) -> 29.97 (30000/1001)
Input #0, avi, from 'ffmpeg/video0.avi':
Duration: 00:01:17.1, start: 0.000000, bitrate: 14082 kb/s
Stream #0.0: Video: mpeg4, yuv420p, 720x480, 29.97 fps(r)
Stream #0.1: Audio: mp2, 48000 Hz, stereo, 64 kb/s
Output #0, mpeg, to '/tmp/video0.mpg':
Stream #0.0: Video: mpeg1video, yuv420p, 720x480, q=2-31, 200 kb/s, 29.97 fps(c)
Stream #0.1: Audio: mp2, 48000 Hz, stereo, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
frame= 2313 q=31.0 Lsize= 7584kB time=77.0 bitrate= 806.7kbits/s
video:6920kB audio:602kB global headers:0kB muxing overhead 0.826762%

1 comment:

Anonymous said...

The matchless message, is very interesting to me :)