From: Michael Niedermayer Date: Tue, 24 Apr 2012 21:44:56 +0000 (+0200) Subject: Merge remote-tracking branch 'qatar/master' X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=8f899545502c287653223ca27522c4abcd3a2e91;hp=8c4022aceb68558df655059cef4d570625dc1d09;p=ffmpeg Merge remote-tracking branch 'qatar/master' * qatar/master: avconv: fix a segfault on -c copy with -filter_complex. isom: Support more DTS codec identifiers. Merged-by: Michael Niedermayer --- diff --git a/.gitignore b/.gitignore index dfc1355d9ec..d27b3bda05a 100644 --- a/.gitignore +++ b/.gitignore @@ -6,27 +6,38 @@ *.ho *-example *-test +*_g +*.def +*.dll +*.lib +*.exp config.* doc/*.1 doc/*.html doc/*.pod +doc/fate.txt doxy +ffmpeg +ffplay +ffprobe +ffserver avconv -avplay -avprobe -avserver doc/avoptions_codec.texi doc/avoptions_format.texi doc/print_options libavcodec/*_tablegen libavcodec/*_tables.c libavcodec/*_tables.h +libavcodec/codec_names.h libavcodec/libavcodec* +libavcore/libavcore* libavdevice/libavdevice* libavfilter/libavfilter* libavformat/libavformat* libavutil/avconfig.h libavutil/libavutil* +libpostproc/libpostproc* +libswresample/libswresample* libswscale/libswscale* tests/audiogen tests/base64 diff --git a/CREDITS b/CREDITS index 4a537786f09..1d0666b6df3 100644 --- a/CREDITS +++ b/CREDITS @@ -1,5 +1,5 @@ This file contains the names of some of the people who have contributed to -Libav/FFmpeg. The names are sorted alphabetically by last name. As this file is +FFmpeg. The names are sorted alphabetically by last name. As this file is currently quite outdated and git serves as a much better tool for determining authorship, it remains here for historical reasons only. diff --git a/Changelog b/Changelog index 9e75dac0813..e0584b7a9b1 100644 --- a/Changelog +++ b/Changelog @@ -1,44 +1,79 @@ Entries are sorted chronologically from oldest to youngest within each release, releases are sorted from youngest to oldest. -version : - -- XWD encoder and decoder -- Support for fragmentation in the mov/mp4 muxer -- ISMV (Smooth Streaming) muxer +version next: +- v408 Quicktime and Microsoft AYUV Uncompressed 4:4:4:4 encoder and decoder +- setfield filter - CDXL demuxer and decoder - Apple ProRes encoder +- ffprobe -count_packets and -count_frames options - Sun Rasterfile Encoder -- remove libpostproc - ID3v2 attached pictures reading and writing - WMA Lossless decoder -- XBM encoder +- bluray protocol +- blackdetect filter +- libutvideo encoder wrapper (--enable-libutvideo) +- swapuv filter +- bbox filter +- XBM encoder and decoder - RealAudio Lossless decoder - ZeroCodec decoder -- drop support for avconv without libavfilter - - -version 0.8: - +- tile video filter +- Metal Gear Solid: The Twin Snakes demuxer +- OpenEXR image decoder +- removelogo filter +- drop support for ffmpeg without libavfilter +- drawtext video filter: fontconfig support +- ffmpeg -benchmark_all option +- super2xsai filter ported from libmpcodecs + + +version 0.10: +- Fixes: CVE-2011-3929, CVE-2011-3934, CVE-2011-3935, CVE-2011-3936, + CVE-2011-3937, CVE-2011-3940, CVE-2011-3941, CVE-2011-3944, + CVE-2011-3945, CVE-2011-3946, CVE-2011-3947, CVE-2011-3949, + CVE-2011-3950, CVE-2011-3951, CVE-2011-3952 +- v410 Quicktime Uncompressed 4:4:4 10-bit encoder and decoder +- SBaGen (SBG) binaural beats script demuxer +- OpenMG Audio muxer +- Timecode extraction in DV and MOV +- thumbnail video filter +- XML output in ffprobe +- asplit audio filter +- tinterlace video filter +- astreamsync audio filter +- amerge audio filter +- ISMV (Smooth Streaming) muxer - GSM audio parser - SMJPEG muxer - - -version 0.8_beta2: - +- XWD encoder and decoder - Automatic thread count based on detection number of (available) CPU cores -- Deprecate libpostproc. If desired, the switch --enable-postproc will - enable it but it may be removed in a later Libav release. +- y41p Brooktree Uncompressed 4:1:1 12-bit encoder and decoder +- ffprobe -show_error option +- Avid 1:1 10-bit RGB Packer codec +- v308 Quicktime Uncompressed 4:4:4 encoder and decoder +- yuv4 libquicktime packed 4:2:0 encoder and decoder +- ffprobe -show_frames option +- silencedetect audio filter +- ffprobe -show_program_version, -show_library_versions, -show_versions options - rv34: frame-level multi-threading - optimized iMDCT transform on x86 using SSE for for mpegaudiodec +- Improved PGS subtitle decoder +- dumpgraph option to lavfi device +- r210 and r10k encoders +- ffwavesynth decoder +- aviocat tool +- ffeval tool -version 0.8_beta1: +version 0.9: +- openal input device added +- boxblur filter added - BWF muxer - Flash Screen Video 2 decoder -- ffplay/ffprobe/ffserver renamed to avplay/avprobe/avserver -- ffmpeg deprecated, added avconv, which is almost the same for now, except +- lavfi input device added +- added avconv, which is almost the same for now, except for a few incompatible changes in the options, which will hopefully make them easier to use. The changes are: * The options placement is now strictly enforced! While in theory the @@ -108,23 +143,40 @@ easier to use. The changes are: * -vframes/-aframes/-dframes options are now aliases to the new -frames option. * -vtag/-atag/-stag options are now aliases to the new -tag option. - XMV demuxer +- LOAS demuxer +- ashowinfo filter added - Windows Media Image decoder +- amovie source added - LATM muxer/demuxer -- showinfo filter -- split filter +- Speex encoder via libspeex +- JSON output in ffprobe +- WTV muxer +- Optional C++ Support (needed for libstagefright) +- H.264 Decoding on Android via Stagefright +- Prores decoder +- BIN/XBIN/ADF/IDF text file decoder +- aconvert audio filter added +- audio support to lavfi input device added - libcdio-paranoia input device for audio CD grabbing -- select filter - Apple ProRes decoder - CELT in Ogg demuxing +- G.723.1 demuxer and decoder +- libmodplug support (--enable-libmodplug) - VC-1 interlaced decoding -- lut, lutrgb, and lutyuv filters -- boxblur filter +- libutvideo wrapper (--enable-libutvideo) +- aevalsrc audio source added - Ut Video decoder - Speex encoding via libspeex - 4:2:2 H.264 decoding support - 4:2:2 and 4:4:4 H.264 encoding with libx264 - Pulseaudio input device +- Prores encoder +- Video Decoder Acceleration (VDA) HWAccel module. - replacement Indeo 3 decoder +- new ffmpeg option: -map_channel +- volume audio filter added +- earwax audio filter added +- libv4l2 support (--enable-libv4l2) - TLS/SSL and HTTPS protocol support - AVOptions API rewritten and documented - most of CODEC_FLAG2_*, some CODEC_FLAG_* and many codec-specific fields in @@ -134,44 +186,27 @@ easier to use. The changes are: - Discworld II BMV decoding support - VBLE Decoder - OS X Video Decoder Acceleration (VDA) support +- compact and csv output in ffprobe +- pan audio filter +- IFF Amiga Continuous Bitmap (ACBM) decoder +- ass filter - CRI ADX audio format muxer and demuxer - Playstation Portable PMP format demuxer +- Microsoft Windows ICO demuxer +- life source - PCM format support in OMA demuxer - CLJR encoder +- new option: -report - Dxtory capture format decoder -- v410 QuickTime uncompressed 4:4:4 10-bit encoder and decoder -- OpenMG Audio muxer +- cellauto source - Simple segmenting muxer - Indeo 4 decoder - SMJPEG demuxer -version 0.7: - -- E-AC-3 audio encoder -- ac3enc: add channel coupling support -- floating-point sample format support for (E-)AC-3, DCA, AAC, Vorbis decoders -- H.264/MPEG frame-level multithreading -- av_metadata_* functions renamed to av_dict_* and moved to libavutil -- 4:4:4 H.264 decoding support -- 10-bit H.264 optimizations for x86 -- bump libswscale for recently reported ABI break - - -version 0.7_beta2: - -- VP8 frame-level multithreading -- NEON optimizations for VP8 -- removed a lot of deprecated API cruft -- FFT and IMDCT optimizations for AVX (Sandy Bridge) processors -- DPX image encoder -- SMPTE 302M AES3 audio decoder -- ffmpeg no longer quits after the 'q' key is pressed; use 'ctrl+c' instead -- 9bit and 10bit per sample support in the H.264 decoder - - -version 0.7_beta1: +version 0.8: +- many many things we forgot because we rather write code than changelogs - WebM support in Matroska de/muxer - low overhead Ogg muxing - MMS-TCP support @@ -179,6 +214,7 @@ version 0.7_beta1: - Demuxer for On2's IVF format - Pictor/PC Paint decoder - HE-AAC v2 decoder +- HE-AAC v2 encoding with libaacplus - libfaad2 wrapper removed - DTS-ES extension (XCh) decoding support - native VP8 decoder @@ -190,6 +226,7 @@ version 0.7_beta1: - RTP depacketization of QDM2 - ANSI/ASCII art playback system - Lego Mindstorms RSO de/muxer +- libavcore added (and subsequently removed) - SubRip subtitle file muxer and demuxer - Chinese AVS encoding via libxavs - ffprobe -show_packets option added @@ -236,7 +273,7 @@ version 0.7_beta1: - replace the ocv_smooth filter with a more generic ocv filter - Windows Televison (WTV) demuxer - FFmpeg metadata format muxer and demuxer -- SubRip (srt) subtitle decoder +- SubRip (srt) subtitle encoder and decoder - floating-point AC-3 encoder added - Lagarith decoder - ffmpeg -copytb option added @@ -249,11 +286,46 @@ version 0.7_beta1: - sndio support for playback and record - Linux framebuffer input device added - Chronomaster DFA decoder -- Mobotix MxPEG decoder +- DPX image encoder +- MicroDVD subtitle file muxer and demuxer +- Playstation Portable PMP format demuxer +- fieldorder video filter added - AAC encoding via libvo-aacenc - AMR-WB encoding via libvo-amrwbenc - xWMA demuxer -- fieldorder video filter added +- Mobotix MxPEG decoder +- VP8 frame-multithreading +- NEON optimizations for VP8 +- Lots of deprecated API cruft removed +- fft and imdct optimizations for AVX (Sandy Bridge) processors +- showinfo filter added +- SMPTE 302M AES3 audio decoder +- Apple Core Audio Format muxer +- 9bit and 10bit per sample support in the H.264 decoder +- 9bit and 10bit FFV1 encoding / decoding +- split filter added +- select filter added +- sdl output device added +- libmpcodecs video filter support (3 times as many filters than before) +- mpeg2 aspect ratio dection fixed +- libxvid aspect pickiness fixed +- Frame multithreaded decoding +- E-AC-3 audio encoder +- ac3enc: add channel coupling support +- floating-point sample format support to the ac3, eac3, dca, aac, and vorbis decoders. +- H264/MPEG frame-level multi-threading +- All av_metadata_* functions renamed to av_dict_* and moved to libavutil +- 4:4:4 H.264 decoding support +- 10-bit H.264 optimizations for x86 +- lut, lutrgb, and lutyuv filters added +- buffersink libavfilter sink added +- Bump libswscale for recently reported ABI break +- New J2K encoder (via OpenJPEG) + + +version 0.7: + +- all the changes for 0.8, but keeping API/ABI compatibility with the 0.6 release version 0.6: @@ -494,6 +566,7 @@ version 0.5: - Gopher client support - MXF D-10 muxer - generic metadata API +- flash ScreenVideo2 encoder version 0.4.9-pre1: @@ -696,7 +769,7 @@ version 0.4.5: - MPEG-4 vol header fixes (Jonathan Marsden ) - ARM optimizations (Lionel Ulmer ). - Windows porting of file converter -- added MJPEG raw format (input/ouput) +- added MJPEG raw format (input/output) - added JPEG image format support (input/output) diff --git a/Doxyfile b/Doxyfile index 457cf5140a0..97896aa0710 100644 --- a/Doxyfile +++ b/Doxyfile @@ -25,7 +25,7 @@ DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. -PROJECT_NAME = Libav +PROJECT_NAME = FFmpeg # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or diff --git a/INSTALL b/INSTALL index ac5dc5dbb6c..95493463029 100644 --- a/INSTALL +++ b/INSTALL @@ -2,17 +2,14 @@ 1) Type './configure' to create the configuration. A list of configure options is printed by running 'configure --help'. -'configure' can be launched from a directory different from the Libav +'configure' can be launched from a directory different from the FFmpeg sources to build the objects out of tree. To do this, use an absolute -path when launching 'configure', e.g. '/libavdir/libav/configure'. +path when launching 'configure', e.g. '/ffmpegdir/ffmpeg/configure'. -2) Then type 'make' to build Libav. GNU Make 3.81 or later is required. +2) Then type 'make' to build FFmpeg. GNU Make 3.81 or later is required. 3) Type 'make install' to install all binaries and libraries you built. NOTICE - Non system dependencies (e.g. libx264, libvpx) are disabled by default. - - - The default cflags include -g, if you want lean libraries you can either - pass --disable-debug or strip the debug symbols at a later time. diff --git a/LICENSE b/LICENSE index 97923b13809..132970aac6e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,18 +1,19 @@ -Libav: ------- +FFmpeg: +------- -Most files in Libav are under the GNU Lesser General Public License version 2.1 +Most files in FFmpeg are under the GNU Lesser General Public License version 2.1 or later (LGPL v2.1+). Read the file COPYING.LGPLv2.1 for details. Some other files have MIT/X11/BSD-style licenses. In combination the LGPL v2.1+ applies to -Libav. +FFmpeg. -Some optional parts of Libav are licensed under the GNU General Public License +Some optional parts of FFmpeg are licensed under the GNU General Public License version 2 or later (GPL v2+). See the file COPYING.GPLv2 for details. None of these parts are used by default, you have to explicitly pass --enable-gpl to -configure to activate them. In this case, Libav's license changes to GPL v2+. +configure to activate them. In this case, FFmpeg's license changes to GPL v2+. -Specifically, the GPL parts of Libav are +Specifically, the GPL parts of FFmpeg are +- libpostproc - optional x86 optimizations in the files libavcodec/x86/idct_mmx.c - the X11 grabber in libavdevice/x11grab.c @@ -36,14 +37,14 @@ external libraries: ------------------- Some external libraries, e.g. libx264, are under GPL and can be used in -conjunction with Libav. They require --enable-gpl to be passed to configure +conjunction with FFmpeg. They require --enable-gpl to be passed to configure as well. The OpenCORE external libraries are under the Apache License 2.0. That license is incompatible with the LGPL v2.1 and the GPL v2, but not with version 3 of -those licenses. So to combine the OpenCORE libraries with Libav, the license +those licenses. So to combine the OpenCORE libraries with FFmpeg, the license version needs to be upgraded by passing --enable-version3 to configure. -The nonfree external library libfaac can be hooked up in Libav. You need to -pass --enable-nonfree to configure to enable it. Employ this option with care -as Libav then becomes nonfree and unredistributable. +The nonfree external libraries libfaac and libaacplus can be hooked up in FFmpeg. +You need to pass --enable-nonfree to configure to enable it. Employ this option +with care as FFmpeg then becomes nonfree and unredistributable. diff --git a/MAINTAINERS b/MAINTAINERS new file mode 100644 index 00000000000..f1a46b75570 --- /dev/null +++ b/MAINTAINERS @@ -0,0 +1,433 @@ +FFmpeg maintainers +================== + +Below is a list of the people maintaining different parts of the +FFmpeg code. + +Please try to keep entries where you are the maintainer up to date! + +Names in () mean that the maintainer currently has no time to maintain the code. +A CC after the name means that the maintainer prefers to be CC-ed on patches +and related discussions. + + +Project Leader +============== + +Michael Niedermayer + final design decisions + + +Applications +============ + +ffmpeg: + ffmpeg.c Michael Niedermayer + +ffplay: + ffplay.c Marton Balint + +ffprobe: + ffprobe.c Stefano Sabatini + +ffserver: + ffserver.c, ffserver.h Baptiste Coudurier + +Commandline utility code: + cmdutils.c, cmdutils.h Michael Niedermayer + +QuickTime faststart: + tools/qt-faststart.c Baptiste Coudurier + + +Miscellaneous Areas +=================== + +documentation Mike Melanson +website Robert Swain, Lou Logan +build system (configure,Makefiles) Diego Biurrun, Mans Rullgard +project server Árpád Gereöffy, Michael Niedermayer, Reimar Döffinger +mailinglists Michael Niedermayer, Baptiste Coudurier, Lou Logan +presets Robert Swain +metadata subsystem Aurelien Jacobs +release management Michael Niedermayer + + +libavutil +========= + +External Interfaces: + libavutil/avutil.h Michael Niedermayer +Internal Interfaces: + libavutil/common.h Michael Niedermayer + +Other: + intfloat* Michael Niedermayer + rational.c, rational.h Michael Niedermayer + mathematics.c, mathematics.h Michael Niedermayer + integer.c, integer.h Michael Niedermayer + bswap.h + + +libavcodec +========== + +Generic Parts: + External Interfaces: + avcodec.h Michael Niedermayer + utility code: + utils.c Michael Niedermayer + mem.c Michael Niedermayer + opt.c, opt.h Michael Niedermayer + arithmetic expression evaluator: + eval.c Michael Niedermayer + audio and video frame extraction: + parser.c Michael Niedermayer + bitstream reading: + bitstream.c, bitstream.h Michael Niedermayer + CABAC: + cabac.h, cabac.c Michael Niedermayer + codec names: + codec_names.sh Nicolas George + DSP utilities: + dsputils.c, dsputils.h Michael Niedermayer + entropy coding: + rangecoder.c, rangecoder.h Michael Niedermayer + lzw.* Michael Niedermayer + floating point AAN DCT: + faandct.c, faandct.h Michael Niedermayer + Golomb coding: + golomb.c, golomb.h Michael Niedermayer + LPC: + lpc.c, lpc.h Justin Ruggles + motion estimation: + motion* Michael Niedermayer + rate control: + ratecontrol.c Michael Niedermayer + libxvid_rc.c Michael Niedermayer + simple IDCT: + simple_idct.c, simple_idct.h Michael Niedermayer + postprocessing: + libpostproc/* Michael Niedermayer + table generation: + tableprint.c, tableprint.h Reimar Doeffinger + +Codecs: + 4xm.c Michael Niedermayer + 8bps.c Roberto Togni + 8svx.c Jaikrishnan Menon + aasc.c Kostya Shishkov + ac3* Justin Ruggles + alacenc.c Jaikrishnan Menon + alsdec.c Thilo Borgmann + apedec.c Kostya Shishkov + ass* Aurelien Jacobs + asv* Michael Niedermayer + atrac3* Benjamin Larsson + bgmc.c, bgmc.h Thilo Borgmann + bink.c Kostya Shishkov + binkaudio.c Peter Ross + bmp.c Mans Rullgard, Kostya Shishkov + cavs* Stefan Gehrer + celp_filters.* Vitor Sessak + cinepak.c Roberto Togni + cljr Alex Beregszaszi + cook.c, cookdata.h Benjamin Larsson + crystalhd.c Philip Langdale + cscd.c Reimar Doeffinger + dca.c Kostya Shishkov, Benjamin Larsson + dnxhd* Baptiste Coudurier + dpcm.c Mike Melanson + dxa.c Kostya Shishkov + dv.c Roman Shaposhnik + eacmv*, eaidct*, eat* Peter Ross + ffv1.c Michael Niedermayer + ffwavesynth.c Nicolas George + flac* Justin Ruggles + flashsv* Benjamin Larsson + flicvideo.c Mike Melanson + g722.c Martin Storsjo + g726.c Roman Shaposhnik + gifdec.c Baptiste Coudurier + h264* Loren Merritt, Michael Niedermayer + h261* Michael Niedermayer + h263* Michael Niedermayer + huffyuv.c Michael Niedermayer + idcinvideo.c Mike Melanson + imc* Benjamin Larsson + indeo2* Kostya Shishkov + indeo5* Kostya Shishkov + interplayvideo.c Mike Melanson + ivi* Kostya Shishkov + jpeg_ls.c Kostya Shishkov + jvdec.c Peter Ross + kmvc.c Kostya Shishkov + lcl*.c Roberto Togni, Reimar Doeffinger + libcelt_dec.c Nicolas George + libgsm.c Michel Bardiaux + libdirac* David Conrad + libopenjpeg.c Jaikrishnan Menon + libopenjpegenc.c Michael Bradshaw + libschroedinger* David Conrad + libspeexdec.c Justin Ruggles + libtheoraenc.c David Conrad + libutvideo* Derek Buitenhuis + libvorbis.c David Conrad + libxavs.c Stefan Gehrer + libx264.c Mans Rullgard, Jason Garrett-Glaser + loco.c Kostya Shishkov + lzo.h, lzo.c Reimar Doeffinger + mdec.c Michael Niedermayer + mimic.c Ramiro Polla + mjpeg.c Michael Niedermayer + mlp* Ramiro Polla + mmvideo.c Peter Ross + mpc* Kostya Shishkov + mpeg12.c, mpeg12data.h Michael Niedermayer + mpegvideo.c, mpegvideo.h Michael Niedermayer + msmpeg4.c, msmpeg4data.h Michael Niedermayer + msrle.c Mike Melanson + msvideo1.c Mike Melanson + nellymoserdec.c Benjamin Larsson + nuv.c Reimar Doeffinger + pcx.c Ivo van Poorten + pgssubdec.c Reimar Doeffinger + ptx.c Ivo van Poorten + qcelp* Reynaldo H. Verdejo Pinochet + qdm2.c, qdm2data.h Roberto Togni, Benjamin Larsson + qdrw.c Kostya Shishkov + qpeg.c Kostya Shishkov + qtrle.c Mike Melanson + ra144.c, ra144.h, ra288.c, ra288.h Roberto Togni + resample2.c Michael Niedermayer + rl2.c Sascha Sommer + rpza.c Roberto Togni + rtjpeg.c, rtjpeg.h Reimar Doeffinger + rv10.c Michael Niedermayer + rv3* Kostya Shishkov + rv4* Kostya Shishkov + s3tc* Ivo van Poorten + smacker.c Kostya Shishkov + smc.c Mike Melanson + snow.c Michael Niedermayer, Loren Merritt + sonic.c Alex Beregszaszi + srt* Aurelien Jacobs + sunrast.c Ivo van Poorten + svq3.c Michael Niedermayer + targa.c Kostya Shishkov + tiff.c Kostya Shishkov + truemotion1* Mike Melanson + truemotion2* Kostya Shishkov + truespeech.c Kostya Shishkov + tscc.c Kostya Shishkov + tta.c Alex Beregszaszi, Jaikrishnan Menon + txd.c Ivo van Poorten + ulti* Kostya Shishkov + v410*.c Derek Buitenhuis + vb.c Kostya Shishkov + vble.c Derek Buitenhuis + vc1* Kostya Shishkov + vcr1.c Michael Niedermayer + vmnc.c Kostya Shishkov + vorbis_enc.c Oded Shimon + vorbis_dec.c Denes Balatoni, David Conrad + vp3* Mike Melanson + vp5 Aurelien Jacobs + vp6 Aurelien Jacobs + vp8 David Conrad, Jason Garrett-Glaser, Ronald Bultje + vqavideo.c Mike Melanson + wavpack.c Kostya Shishkov + wmaprodec.c Sascha Sommer + wmavoice.c Ronald S. Bultje + wmv2.c Michael Niedermayer + wnv1.c Kostya Shishkov + xan.c Mike Melanson + xl.c Kostya Shishkov + xvmc.c Ivan Kalvachev + zerocodec.c Derek Buitenhuis + zmbv* Kostya Shishkov + +Hardware acceleration: + crystalhd.c Philip Langdale + dxva2* Laurent Aimar + libstagefright.cpp Mohamed Naufal + vaapi* Gwenole Beauchesne + vda* Sebastien Zwickert + vdpau* Carl Eugen Hoyos + + +libavdevice +=========== + External Interface: + libavdevice/avdevice.h + + + libdc1394.c Roman Shaposhnik + v4l2.c Luca Abeni + vfwcap.c Ramiro Polla + + +libavfilter +=========== + +Video filters: + graphdump.c Nicolas George + af_amerge.c Nicolas George + af_astreamsync.c Nicolas George + af_pan.c Nicolas George + vsrc_mandelbrot.c Michael Niedermayer + vf_yadif.c Michael Niedermayer + + +libavformat +=========== + +Generic parts: + External Interface: + libavformat/avformat.h Michael Niedermayer + Utility Code: + libavformat/utils.c Michael Niedermayer + + +Muxers/Demuxers: + 4xm.c Mike Melanson + adtsenc.c Robert Swain + aiff.c Baptiste Coudurier + ape.c Kostya Shishkov + ass* Aurelien Jacobs + avi* Michael Niedermayer + bink.c Peter Ross + caf* Peter Ross + crc.c Michael Niedermayer + daud.c Reimar Doeffinger + dv.c Roman Shaposhnik + dxa.c Kostya Shishkov + electronicarts.c Peter Ross + ffm* Baptiste Coudurier + flac* Justin Ruggles + flic.c Mike Melanson + flvdec.c, flvenc.c Michael Niedermayer + gxf.c Reimar Doeffinger + gxfenc.c Baptiste Coudurier + idcin.c Mike Melanson + idroqdec.c Mike Melanson + iff.c Jaikrishnan Menon + ipmovie.c Mike Melanson + img2.c Michael Niedermayer + iss.c Stefan Gehrer + jvdec.c Peter Ross + libmodplug.c Clément Bœsch + libnut.c Oded Shimon + lmlm4.c Ivo van Poorten + lxfdec.c Tomas Härdin + matroska.c Aurelien Jacobs + matroskadec.c Aurelien Jacobs + matroskaenc.c David Conrad + metadata* Aurelien Jacobs + microdvd* Aurelien Jacobs + mm.c Peter Ross + mov.c Michael Niedermayer, Baptiste Coudurier + movenc.c Michael Niedermayer, Baptiste Coudurier + mpc.c Kostya Shishkov + mpeg.c Michael Niedermayer + mpegenc.c Michael Niedermayer + mpegts* Baptiste Coudurier + msnwc_tcp.c Ramiro Polla + mtv.c Reynaldo H. Verdejo Pinochet + mxf* Baptiste Coudurier + mxfdec.c Tomas Härdin + nsvdec.c Francois Revol + nut.c Michael Niedermayer + nuv.c Reimar Doeffinger + oggdec.c, oggdec.h David Conrad + oggenc.c Baptiste Coudurier + oggparse*.c David Conrad + oma.c Maxim Poliakovski + psxstr.c Mike Melanson + pva.c Ivo van Poorten + r3d.c Baptiste Coudurier + raw.c Michael Niedermayer + rdt.c Ronald S. Bultje + rl2.c Sascha Sommer + rmdec.c, rmenc.c Ronald S. Bultje, Kostya Shishkov + rtmp* Kostya Shishkov + rtp.c, rtpenc.c Martin Storsjo + rtpdec_asf.* Ronald S. Bultje + rtpenc_mpv.*, rtpenc_aac.* Martin Storsjo + rtsp.c Luca Barbato + sbgdec.c Nicolas George + sdp.c Martin Storsjo + segafilm.c Mike Melanson + siff.c Kostya Shishkov + smacker.c Kostya Shishkov + srtdec.c Aurelien Jacobs + swf.c Baptiste Coudurier + tta.c Alex Beregszaszi + txd.c Ivo van Poorten + voc.c Aurelien Jacobs + wav.c Michael Niedermayer + wc3movie.c Mike Melanson + westwood.c Mike Melanson + wtv.c Peter Ross + wv.c Kostya Shishkov + +Protocols: + bluray.c Petri Hintukainen + http.c Ronald S. Bultje + mms*.c Ronald S. Bultje + udp.c Luca Abeni + + +Operating systems / CPU architectures +===================================== + +Alpha Mans Rullgard, Falk Hueffner +ARM Mans Rullgard +AVR32 Mans Rullgard +MIPS Mans Rullgard +Mac OS X / PowerPC Romain Dolbeau, Guillaume Poirier +Amiga / PowerPC Colin Ward +Linux / PowerPC Luca Barbato +Windows MinGW Alex Beregszaszi, Ramiro Polla +Windows Cygwin Victor Paesa +ADI/Blackfin DSP Marc Hoffman +Sparc Roman Shaposhnik +x86 Michael Niedermayer + + +Releases +======== + +0.10 Michael Niedermayer +0.9 Michael Niedermayer + + + +GnuPG Fingerprints of maintainers and contributors +================================================== + +Anssi Hannula 1A92 FF42 2DD9 8D2E 8AF7 65A9 4278 C520 513D F3CB +Anton Khirnov 6D0C 6625 56F8 65D1 E5F5 814B B50A 1241 C067 07AB +Attila Kinali 11F0 F9A6 A1D2 11F6 C745 D10C 6520 BCDD F2DF E765 +Baptiste Coudurier 8D77 134D 20CC 9220 201F C5DB 0AC9 325C 5C1A BAAA +Ben Littler 3EE3 3723 E560 3214 A8CD 4DEB 2CDB FCE7 768C 8D2C +Benoit Fouet B22A 4F4F 43EF 636B BB66 FCDC 0023 AE1E 2985 49C8 +Daniel Verkamp 78A6 07ED 782C 653E C628 B8B9 F0EB 8DD8 2F0E 21C7 +Diego Biurrun 8227 1E31 B6D9 4994 7427 E220 9CAE D6CC 4757 FCC5 +Gwenole Beauchesne 2E63 B3A6 3E44 37E2 017D 2704 53C7 6266 B153 99C4 +Jaikrishnan Menon 61A1 F09F 01C9 2D45 78E1 C862 25DC 8831 AF70 D368 +Justin Ruggles 3136 ECC0 C10D 6C04 5F43 CA29 FCBE CD2A 3787 1EBF +Loren Merritt ABD9 08F4 C920 3F65 D8BE 35D7 1540 DAA7 060F 56DE +Lou Logan 7D68 DC73 CBEF EABB 671A B6CF 621C 2E28 82F8 DC3A +Luca Barbato 6677 4209 213C 8843 5B67 29E7 E84C 78C2 84E9 0E34 +Michael Niedermayer 9FF2 128B 147E F673 0BAD F133 611E C787 040B 0FAB +Nicolas George 24CE 01CE 9ACC 5CEB 74D8 8D9D B063 D997 36E5 4C93 +Panagiotis Issaris 6571 13A3 33D9 3726 F728 AA98 F643 B12E ECF3 E029 +Peter Ross A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B +Reimar Döffinger C61D 16E5 9E2C D10C 8958 38A4 0899 A2B9 06D4 D9C7 +Reinhard Tartler 9300 5DC2 7E87 6C37 ED7B CA9A 9808 3544 9453 48A4 +Reynaldo H. Verdejo Pinochet 6E27 CD34 170C C78E 4D4F 5F40 C18E 077F 3114 452A +Robert Swain EE7A 56EA 4A81 A7B5 2001 A521 67FA 362D A2FC 3E71 +Sascha Sommer 38A0 F88B 868E 9D3A 97D4 D6A0 E823 706F 1E07 0D3C +Stefano Sabatini 9A43 10F8 D32C D33C 48E7 C52C 5DF2 8E4D B2EE 066B +Tomas Härdin D133 29CA 4EEC 9DB4 7076 F697 B04B 7403 3313 41FD diff --git a/Makefile b/Makefile index 2d9e4353a08..2c728104a78 100644 --- a/Makefile +++ b/Makefile @@ -1,82 +1,44 @@ +MAIN_MAKEFILE=1 include config.mak vpath %.c $(SRC_PATH) +vpath %.cpp $(SRC_PATH) vpath %.h $(SRC_PATH) vpath %.S $(SRC_PATH) vpath %.asm $(SRC_PATH) vpath %.v $(SRC_PATH) vpath %.texi $(SRC_PATH) +vpath %/fate_config.sh.template $(SRC_PATH) -ifndef V -Q = @ -ECHO = printf "$(1)\t%s\n" $(2) -BRIEF = CC AS YASM AR LD HOSTCC -SILENT = DEPCC YASMDEP RM RANLIB -MSG = $@ -M = @$(call ECHO,$(TAG),$@); -$(foreach VAR,$(BRIEF), \ - $(eval override $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR)))) -$(foreach VAR,$(SILENT),$(eval override $(VAR) = @$($(VAR)))) -$(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_PATH)/%=%)); $(INSTALL)) -endif - -ALLFFLIBS = avcodec avdevice avfilter avformat avutil swscale - -IFLAGS := -I. -I$(SRC_PATH) -CPPFLAGS := $(IFLAGS) $(CPPFLAGS) -CFLAGS += $(ECFLAGS) -CCFLAGS = $(CFLAGS) -YASMFLAGS += $(IFLAGS) -I$(SRC_PATH)/libavutil/x86/ -Pconfig.asm -HOSTCFLAGS += $(IFLAGS) -LDFLAGS := $(ALLFFLIBS:%=-Llib%) $(LDFLAGS) - -define COMPILE - $($(1)DEP) - $($(1)) $(CPPFLAGS) $($(1)FLAGS) $($(1)_DEPFLAGS) -c $($(1)_O) $< -endef - -COMPILE_C = $(call COMPILE,CC) -COMPILE_S = $(call COMPILE,AS) - -%.o: %.c - $(COMPILE_C) - -%.o: %.S - $(COMPILE_S) - -%.ho: %.h - $(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused -c -o $@ -x c $< - -%.ver: %.v - $(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@ - -%.c %.h: TAG = GEN - -PROGS-$(CONFIG_AVCONV) += avconv -PROGS-$(CONFIG_AVPLAY) += avplay -PROGS-$(CONFIG_AVPROBE) += avprobe -PROGS-$(CONFIG_AVSERVER) += avserver +PROGS-$(CONFIG_FFMPEG) += ffmpeg +PROGS-$(CONFIG_FFPLAY) += ffplay +PROGS-$(CONFIG_FFPROBE) += ffprobe +PROGS-$(CONFIG_FFSERVER) += ffserver PROGS := $(PROGS-yes:%=%$(EXESUF)) +INSTPROGS = $(PROGS-yes:%=%$(PROGSSUF)$(EXESUF)) OBJS = $(PROGS-yes:%=%.o) cmdutils.o TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64 HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options TOOLS = qt-faststart trasher TOOLS-$(CONFIG_ZLIB) += cws2fws -BASENAMES = avconv avplay avprobe avserver -ALLPROGS = $(BASENAMES:%=%$(EXESUF)) +BASENAMES = ffmpeg ffplay ffprobe ffserver +ALLPROGS = $(BASENAMES:%=%$(PROGSSUF)$(EXESUF)) +ALLPROGS_G = $(BASENAMES:%=%$(PROGSSUF)_g$(EXESUF)) ALLMANPAGES = $(BASENAMES:%=%.1) FFLIBS-$(CONFIG_AVDEVICE) += avdevice FFLIBS-$(CONFIG_AVFILTER) += avfilter FFLIBS-$(CONFIG_AVFORMAT) += avformat FFLIBS-$(CONFIG_AVCODEC) += avcodec +FFLIBS-$(CONFIG_POSTPROC) += postproc +FFLIBS-$(CONFIG_SWRESAMPLE)+= swresample FFLIBS-$(CONFIG_SWSCALE) += swscale FFLIBS := avutil -DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.avpreset) +DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.ffpreset) $(SRC_PATH)/doc/ffprobe.xsd SKIPHEADERS = cmdutils_common_opts.h @@ -87,6 +49,10 @@ FF_DEP_LIBS := $(DEP_LIBS) all: $(PROGS) +$(PROGS): %$(EXESUF): %$(PROGSSUF)_g$(EXESUF) + $(CP) $< $@$(PROGSSUF) + $(STRIP) $@$(PROGSSUF) + $(TOOLS): %$(EXESUF): %.o $(LD) $(LDFLAGS) -o $@ $< $(ELIBS) @@ -119,11 +85,11 @@ endef $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D)))) -avplay.o: CFLAGS += $(SDL_CFLAGS) -avplay$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS) -avserver$(EXESUF): LDFLAGS += $(AVSERVERLDFLAGS) +ffplay.o: CFLAGS += $(SDL_CFLAGS) +ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS) +ffserver_g$(EXESUF): LDFLAGS += $(FFSERVERLDFLAGS) -$(PROGS): %$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS) +%$(PROGSSUF)_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS) $(LD) $(LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS) OBJDIRS += tools @@ -156,7 +122,7 @@ install-progs-$(CONFIG_SHARED): install-libs install-progs: install-progs-yes $(PROGS) $(Q)mkdir -p "$(BINDIR)" - $(INSTALL) -c -m 755 $(PROGS) "$(BINDIR)" + $(INSTALL) -c -m 755 $(INSTPROGS) "$(BINDIR)" install-data: $(DATA_FILES) $(Q)mkdir -p "$(DATADIR)" @@ -171,17 +137,28 @@ uninstall-data: $(RM) -r "$(DATADIR)" clean:: - $(RM) $(ALLPROGS) + $(RM) $(ALLPROGS) $(ALLPROGS_G) $(RM) $(CLEANSUFFIXES) $(RM) $(TOOLS) $(RM) $(CLEANSUFFIXES:%=tools/%) + $(RM) coverage.info + $(RM) -r coverage-html distclean:: $(RM) $(DISTCLEANSUFFIXES) $(RM) config.* .version version.h libavutil/avconfig.h config: - $(SRC_PATH)/configure $(value LIBAV_CONFIGURATION) + $(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION) + +# Without the sed genthml thinks "libavutil" and "./libavutil" are two different things +coverage.info: $(wildcard *.gcda *.gcno */*.gcda */*.gcno */*/*.gcda */*/*.gcno) + $(Q)lcov -c -d . -b . | sed -e 's#/./#/#g' > $@ + +coverage-html: coverage.info + $(Q)mkdir -p $@ + $(Q)genhtml -o $@ $< + $(Q)touch $@ include $(SRC_PATH)/doc/Makefile include $(SRC_PATH)/tests/Makefile diff --git a/README b/README index afef6716119..ae007bcccf9 100644 --- a/README +++ b/README @@ -1,12 +1,18 @@ -Libav README ------------- +FFmpeg README +------------- 1) Documentation ---------------- -* Read the documentation in the doc/ directory. +* Read the documentation in the doc/ directory in git. + You can also view it online at http://ffmpeg.org/documentation.html 2) Licensing ------------ * See the LICENSE file. + +3) Build and Install +-------------------- + +* See the INSTALL file. diff --git a/RELEASE b/RELEASE index aec258df73d..8d74bcbc236 100644 --- a/RELEASE +++ b/RELEASE @@ -1 +1 @@ -0.8 +0.10.2.git diff --git a/avprobe.c b/avprobe.c deleted file mode 100644 index fe2b6e28604..00000000000 --- a/avprobe.c +++ /dev/null @@ -1,455 +0,0 @@ -/* - * avprobe : Simple Media Prober based on the Libav libraries - * Copyright (c) 2007-2010 Stefano Sabatini - * - * This file is part of Libav. - * - * Libav is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * Libav 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" - -#include "libavformat/avformat.h" -#include "libavcodec/avcodec.h" -#include "libavutil/opt.h" -#include "libavutil/pixdesc.h" -#include "libavutil/dict.h" -#include "libavdevice/avdevice.h" -#include "cmdutils.h" - -const char program_name[] = "avprobe"; -const int program_birth_year = 2007; - -static int do_show_format = 0; -static int do_show_packets = 0; -static int do_show_streams = 0; - -static int show_value_unit = 0; -static int use_value_prefix = 0; -static int use_byte_value_binary_prefix = 0; -static int use_value_sexagesimal_format = 0; - -/* globals */ -static const OptionDef options[]; - -/* AVprobe context */ -static const char *input_filename; -static AVInputFormat *iformat = NULL; - -static const char *const binary_unit_prefixes [] = { "", "Ki", "Mi", "Gi", "Ti", "Pi" }; -static const char *const decimal_unit_prefixes[] = { "", "K" , "M" , "G" , "T" , "P" }; - -static const char unit_second_str[] = "s" ; -static const char unit_hertz_str[] = "Hz" ; -static const char unit_byte_str[] = "byte" ; -static const char unit_bit_per_second_str[] = "bit/s"; - -void exit_program(int ret) -{ - exit(ret); -} - -static char *value_string(char *buf, int buf_size, double val, const char *unit) -{ - if (unit == unit_second_str && use_value_sexagesimal_format) { - double secs; - int hours, mins; - secs = val; - mins = (int)secs / 60; - secs = secs - mins * 60; - hours = mins / 60; - mins %= 60; - snprintf(buf, buf_size, "%d:%02d:%09.6f", hours, mins, secs); - } else if (use_value_prefix) { - const char *prefix_string; - int index; - - if (unit == unit_byte_str && use_byte_value_binary_prefix) { - index = (int) (log(val)/log(2)) / 10; - index = av_clip(index, 0, FF_ARRAY_ELEMS(binary_unit_prefixes) - 1); - val /= pow(2, index * 10); - prefix_string = binary_unit_prefixes[index]; - } else { - index = (int) (log10(val)) / 3; - index = av_clip(index, 0, FF_ARRAY_ELEMS(decimal_unit_prefixes) - 1); - val /= pow(10, index * 3); - prefix_string = decimal_unit_prefixes[index]; - } - - snprintf(buf, buf_size, "%.3f %s%s", val, prefix_string, - show_value_unit ? unit : ""); - } else { - snprintf(buf, buf_size, "%f %s", val, show_value_unit ? unit : ""); - } - - return buf; -} - -static char *time_value_string(char *buf, int buf_size, int64_t val, - const AVRational *time_base) -{ - if (val == AV_NOPTS_VALUE) { - snprintf(buf, buf_size, "N/A"); - } else { - value_string(buf, buf_size, val * av_q2d(*time_base), unit_second_str); - } - - return buf; -} - -static char *ts_value_string (char *buf, int buf_size, int64_t ts) -{ - if (ts == AV_NOPTS_VALUE) { - snprintf(buf, buf_size, "N/A"); - } else { - snprintf(buf, buf_size, "%"PRId64, ts); - } - - return buf; -} - -static const char *media_type_string(enum AVMediaType media_type) -{ - switch (media_type) { - case AVMEDIA_TYPE_VIDEO: return "video"; - case AVMEDIA_TYPE_AUDIO: return "audio"; - case AVMEDIA_TYPE_DATA: return "data"; - case AVMEDIA_TYPE_SUBTITLE: return "subtitle"; - case AVMEDIA_TYPE_ATTACHMENT: return "attachment"; - default: return "unknown"; - } -} - -static void show_packet(AVFormatContext *fmt_ctx, AVPacket *pkt) -{ - char val_str[128]; - AVStream *st = fmt_ctx->streams[pkt->stream_index]; - - printf("[PACKET]\n"); - printf("codec_type=%s\n", media_type_string(st->codec->codec_type)); - printf("stream_index=%d\n", pkt->stream_index); - printf("pts=%s\n", ts_value_string(val_str, sizeof(val_str), pkt->pts)); - printf("pts_time=%s\n", time_value_string(val_str, sizeof(val_str), - pkt->pts, &st->time_base)); - printf("dts=%s\n", ts_value_string(val_str, sizeof(val_str), pkt->dts)); - printf("dts_time=%s\n", time_value_string(val_str, sizeof(val_str), - pkt->dts, &st->time_base)); - printf("duration=%s\n", ts_value_string(val_str, sizeof(val_str), - pkt->duration)); - printf("duration_time=%s\n", time_value_string(val_str, sizeof(val_str), - pkt->duration, - &st->time_base)); - printf("size=%s\n", value_string(val_str, sizeof(val_str), - pkt->size, unit_byte_str)); - printf("pos=%"PRId64"\n", pkt->pos); - printf("flags=%c\n", pkt->flags & AV_PKT_FLAG_KEY ? 'K' : '_'); - printf("[/PACKET]\n"); -} - -static void show_packets(AVFormatContext *fmt_ctx) -{ - AVPacket pkt; - - av_init_packet(&pkt); - - while (!av_read_frame(fmt_ctx, &pkt)) - show_packet(fmt_ctx, &pkt); -} - -static void show_stream(AVFormatContext *fmt_ctx, int stream_idx) -{ - AVStream *stream = fmt_ctx->streams[stream_idx]; - AVCodecContext *dec_ctx; - AVCodec *dec; - char val_str[128]; - AVDictionaryEntry *tag = NULL; - AVRational display_aspect_ratio; - - printf("[STREAM]\n"); - - printf("index=%d\n", stream->index); - - if ((dec_ctx = stream->codec)) { - if ((dec = dec_ctx->codec)) { - printf("codec_name=%s\n", dec->name); - printf("codec_long_name=%s\n", dec->long_name); - } else { - printf("codec_name=unknown\n"); - } - - printf("codec_type=%s\n", media_type_string(dec_ctx->codec_type)); - printf("codec_time_base=%d/%d\n", - dec_ctx->time_base.num, dec_ctx->time_base.den); - - /* print AVI/FourCC tag */ - av_get_codec_tag_string(val_str, sizeof(val_str), dec_ctx->codec_tag); - printf("codec_tag_string=%s\n", val_str); - printf("codec_tag=0x%04x\n", dec_ctx->codec_tag); - - switch (dec_ctx->codec_type) { - case AVMEDIA_TYPE_VIDEO: - printf("width=%d\n", dec_ctx->width); - printf("height=%d\n", dec_ctx->height); - printf("has_b_frames=%d\n", dec_ctx->has_b_frames); - if (dec_ctx->sample_aspect_ratio.num) { - printf("sample_aspect_ratio=%d:%d\n", - dec_ctx->sample_aspect_ratio.num, - dec_ctx->sample_aspect_ratio.den); - av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den, - dec_ctx->width * dec_ctx->sample_aspect_ratio.num, - dec_ctx->height * dec_ctx->sample_aspect_ratio.den, - 1024*1024); - printf("display_aspect_ratio=%d:%d\n", - display_aspect_ratio.num, display_aspect_ratio.den); - } - printf("pix_fmt=%s\n", - dec_ctx->pix_fmt != PIX_FMT_NONE ? av_pix_fmt_descriptors[dec_ctx->pix_fmt].name - : "unknown"); - printf("level=%d\n", dec_ctx->level); - break; - - case AVMEDIA_TYPE_AUDIO: - printf("sample_rate=%s\n", value_string(val_str, sizeof(val_str), - dec_ctx->sample_rate, - unit_hertz_str)); - printf("channels=%d\n", dec_ctx->channels); - printf("bits_per_sample=%d\n", - av_get_bits_per_sample(dec_ctx->codec_id)); - break; - } - } else { - printf("codec_type=unknown\n"); - } - - if (fmt_ctx->iformat->flags & AVFMT_SHOW_IDS) - printf("id=0x%x\n", stream->id); - printf("r_frame_rate=%d/%d\n", - stream->r_frame_rate.num, stream->r_frame_rate.den); - printf("avg_frame_rate=%d/%d\n", - stream->avg_frame_rate.num, stream->avg_frame_rate.den); - printf("time_base=%d/%d\n", - stream->time_base.num, stream->time_base.den); - printf("start_time=%s\n", - time_value_string(val_str, sizeof(val_str), - stream->start_time, &stream->time_base)); - printf("duration=%s\n", - time_value_string(val_str, sizeof(val_str), - stream->duration, &stream->time_base)); - if (stream->nb_frames) - printf("nb_frames=%"PRId64"\n", stream->nb_frames); - - while ((tag = av_dict_get(stream->metadata, "", tag, - AV_DICT_IGNORE_SUFFIX))) - printf("TAG:%s=%s\n", tag->key, tag->value); - - printf("[/STREAM]\n"); -} - -static void show_format(AVFormatContext *fmt_ctx) -{ - AVDictionaryEntry *tag = NULL; - char val_str[128]; - int64_t size = fmt_ctx->pb ? avio_size(fmt_ctx->pb) : -1; - - printf("[FORMAT]\n"); - - printf("filename=%s\n", fmt_ctx->filename); - printf("nb_streams=%d\n", fmt_ctx->nb_streams); - printf("format_name=%s\n", fmt_ctx->iformat->name); - printf("format_long_name=%s\n", fmt_ctx->iformat->long_name); - printf("start_time=%s\n", - time_value_string(val_str, sizeof(val_str), - fmt_ctx->start_time, &AV_TIME_BASE_Q)); - printf("duration=%s\n", - time_value_string(val_str, sizeof(val_str), - fmt_ctx->duration, &AV_TIME_BASE_Q)); - printf("size=%s\n", size >= 0 ? value_string(val_str, sizeof(val_str), - size, unit_byte_str) - : "unknown"); - printf("bit_rate=%s\n", - value_string(val_str, sizeof(val_str), - fmt_ctx->bit_rate, unit_bit_per_second_str)); - - while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, - AV_DICT_IGNORE_SUFFIX))) - printf("TAG:%s=%s\n", tag->key, tag->value); - - printf("[/FORMAT]\n"); -} - -static int open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename) -{ - int err, i; - AVFormatContext *fmt_ctx = NULL; - AVDictionaryEntry *t; - - if ((err = avformat_open_input(&fmt_ctx, filename, - iformat, &format_opts)) < 0) { - print_error(filename, err); - return err; - } - if ((t = av_dict_get(format_opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) { - av_log(NULL, AV_LOG_ERROR, "Option %s not found.\n", t->key); - return AVERROR_OPTION_NOT_FOUND; - } - - - /* fill the streams in the format context */ - if ((err = avformat_find_stream_info(fmt_ctx, NULL)) < 0) { - print_error(filename, err); - return err; - } - - av_dump_format(fmt_ctx, 0, filename, 0); - - /* bind a decoder to each input stream */ - for (i = 0; i < fmt_ctx->nb_streams; i++) { - AVStream *stream = fmt_ctx->streams[i]; - AVCodec *codec; - - if (!(codec = avcodec_find_decoder(stream->codec->codec_id))) { - fprintf(stderr, - "Unsupported codec with id %d for input stream %d\n", - stream->codec->codec_id, stream->index); - } else if (avcodec_open2(stream->codec, codec, NULL) < 0) { - fprintf(stderr, "Error while opening codec for input stream %d\n", - stream->index); - } - } - - *fmt_ctx_ptr = fmt_ctx; - return 0; -} - -static int probe_file(const char *filename) -{ - AVFormatContext *fmt_ctx; - int ret, i; - - if ((ret = open_input_file(&fmt_ctx, filename))) - return ret; - - if (do_show_packets) - show_packets(fmt_ctx); - - if (do_show_streams) - for (i = 0; i < fmt_ctx->nb_streams; i++) - show_stream(fmt_ctx, i); - - if (do_show_format) - show_format(fmt_ctx); - - avformat_close_input(&fmt_ctx); - return 0; -} - -static void show_usage(void) -{ - printf("Simple multimedia streams analyzer\n"); - printf("usage: %s [OPTIONS] [INPUT_FILE]\n", program_name); - printf("\n"); -} - -static int opt_format(const char *opt, const char *arg) -{ - iformat = av_find_input_format(arg); - if (!iformat) { - fprintf(stderr, "Unknown input format: %s\n", arg); - return AVERROR(EINVAL); - } - return 0; -} - -static void opt_input_file(void *optctx, const char *arg) -{ - if (input_filename) { - fprintf(stderr, - "Argument '%s' provided as input filename, but '%s' was already specified.\n", - arg, input_filename); - exit(1); - } - if (!strcmp(arg, "-")) - arg = "pipe:"; - input_filename = arg; -} - -static void show_help(void) -{ - av_log_set_callback(log_callback_help); - show_usage(); - show_help_options(options, "Main options:\n", 0, 0); - printf("\n"); - show_help_children(avformat_get_class(), AV_OPT_FLAG_DECODING_PARAM); -} - -static void opt_pretty(void) -{ - show_value_unit = 1; - use_value_prefix = 1; - use_byte_value_binary_prefix = 1; - use_value_sexagesimal_format = 1; -} - -static const OptionDef options[] = { -#include "cmdutils_common_opts.h" - { "f", HAS_ARG, {(void*)opt_format}, "force format", "format" }, - { "unit", OPT_BOOL, {(void*)&show_value_unit}, - "show unit of the displayed values" }, - { "prefix", OPT_BOOL, {(void*)&use_value_prefix}, - "use SI prefixes for the displayed values" }, - { "byte_binary_prefix", OPT_BOOL, {(void*)&use_byte_value_binary_prefix}, - "use binary prefixes for byte units" }, - { "sexagesimal", OPT_BOOL, {(void*)&use_value_sexagesimal_format}, - "use sexagesimal format HOURS:MM:SS.MICROSECONDS for time units" }, - { "pretty", 0, {(void*)&opt_pretty}, - "prettify the format of displayed values, make it more human readable" }, - { "show_format", OPT_BOOL, {(void*)&do_show_format} , "show format/container info" }, - { "show_packets", OPT_BOOL, {(void*)&do_show_packets}, "show packets info" }, - { "show_streams", OPT_BOOL, {(void*)&do_show_streams}, "show streams info" }, - { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, - "generic catch all option", "" }, - { NULL, }, -}; - -int main(int argc, char **argv) -{ - int ret; - - parse_loglevel(argc, argv, options); - av_register_all(); - avformat_network_init(); - init_opts(); -#if CONFIG_AVDEVICE - avdevice_register_all(); -#endif - - show_banner(); - parse_options(NULL, argc, argv, options, opt_input_file); - - if (!input_filename) { - show_usage(); - fprintf(stderr, "You have to specify one input file.\n"); - fprintf(stderr, - "Use -h to get full help or, even better, run 'man %s'.\n", - program_name); - exit(1); - } - - ret = probe_file(input_filename); - - avformat_network_deinit(); - - return ret; -} diff --git a/cmdutils.c b/cmdutils.c index d590d0a49fe..fb4e869f2eb 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -2,20 +2,20 @@ * Various utilities for command line tools * Copyright (c) 2000-2003 Fabrice Bellard * - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -33,6 +33,10 @@ #include "libavfilter/avfilter.h" #include "libavdevice/avdevice.h" #include "libswscale/swscale.h" +#include "libswresample/swresample.h" +#if CONFIG_POSTPROC +#include "libpostproc/postprocess.h" +#endif #include "libavutil/avstring.h" #include "libavutil/mathematics.h" #include "libavutil/parseutils.h" @@ -50,9 +54,12 @@ #endif struct SwsContext *sws_opts; +SwrContext *swr_opts; AVDictionary *format_opts, *codec_opts; -static const int this_year = 2012; +const int this_year = 2012; + +static FILE *report_file; void init_opts(void) { @@ -60,6 +67,7 @@ void init_opts(void) sws_opts = sws_getContext(16, 16, 0, 16, 16, 0, SWS_BICUBIC, NULL, NULL, NULL); #endif + swr_opts = swr_alloc(); } void uninit_opts(void) @@ -68,6 +76,7 @@ void uninit_opts(void) sws_freeContext(sws_opts); sws_opts = NULL; #endif + swr_free(&swr_opts); av_dict_free(&format_opts); av_dict_free(&codec_opts); } @@ -77,6 +86,20 @@ void log_callback_help(void *ptr, int level, const char *fmt, va_list vl) vfprintf(stdout, fmt, vl); } +static void log_callback_report(void *ptr, int level, const char *fmt, va_list vl) +{ + va_list vl2; + char line[1024]; + static int print_prefix = 1; + + va_copy(vl2, vl); + av_log_default_callback(ptr, level, fmt, vl); + av_log_format_line(ptr, level, fmt, vl2, line, sizeof(line), &print_prefix); + va_end(vl2); + fputs(line, report_file); + fflush(report_file); +} + double parse_number_or_die(const char *context, const char *numstr, int type, double min, double max) { @@ -346,6 +369,30 @@ int locate_option(int argc, char **argv, const OptionDef *options, return 0; } +static void dump_argument(const char *a) +{ + const unsigned char *p; + + for (p = a; *p; p++) + if (!((*p >= '+' && *p <= ':') || (*p >= '@' && *p <= 'Z') || + *p == '_' || (*p >= 'a' && *p <= 'z'))) + break; + if (!*p) { + fputs(a, report_file); + return; + } + fputc('"', report_file); + for (p = a; *p; p++) { + if (*p == '\\' || *p == '"' || *p == '$' || *p == '`') + fprintf(report_file, "\\%c", *p); + else if (*p < ' ' || *p > '~') + fprintf(report_file, "\\x%02x", *p); + else + fputc(*p, report_file); + } + fputc('"', report_file); +} + void parse_loglevel(int argc, char **argv, const OptionDef *options) { int idx = locate_option(argc, argv, options, "loglevel"); @@ -353,30 +400,45 @@ void parse_loglevel(int argc, char **argv, const OptionDef *options) idx = locate_option(argc, argv, options, "v"); if (idx && argv[idx + 1]) opt_loglevel("loglevel", argv[idx + 1]); + idx = locate_option(argc, argv, options, "report"); + if (idx || getenv("FFREPORT")) { + opt_report("report"); + if (report_file) { + int i; + fprintf(report_file, "Command line:\n"); + for (i = 0; i < argc; i++) { + dump_argument(argv[i]); + fputc(i < argc - 1 ? ' ' : '\n', report_file); + } + fflush(report_file); + } + } } -#define FLAGS (o->type == AV_OPT_TYPE_FLAGS) ? AV_DICT_APPEND : 0 +#define FLAGS(o) ((o)->type == AV_OPT_TYPE_FLAGS) ? AV_DICT_APPEND : 0 int opt_default(const char *opt, const char *arg) { - const AVOption *o; + const AVOption *oc, *of, *os, *oswr = NULL; char opt_stripped[128]; const char *p; - const AVClass *cc = avcodec_get_class(), *fc = avformat_get_class(), *sc = sws_get_class(); + const AVClass *cc = avcodec_get_class(), *fc = avformat_get_class(), *sc, *swr_class; if (!(p = strchr(opt, ':'))) p = opt + strlen(opt); av_strlcpy(opt_stripped, opt, FFMIN(sizeof(opt_stripped), p - opt + 1)); - if ((o = av_opt_find(&cc, opt_stripped, NULL, 0, + if ((oc = av_opt_find(&cc, opt_stripped, NULL, 0, AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)) || ((opt[0] == 'v' || opt[0] == 'a' || opt[0] == 's') && - (o = av_opt_find(&cc, opt + 1, NULL, 0, AV_OPT_SEARCH_FAKE_OBJ)))) - av_dict_set(&codec_opts, opt, arg, FLAGS); - else if ((o = av_opt_find(&fc, opt, NULL, 0, - AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) - av_dict_set(&format_opts, opt, arg, FLAGS); - else if ((o = av_opt_find(&sc, opt, NULL, 0, - AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) { + (oc = av_opt_find(&cc, opt + 1, NULL, 0, AV_OPT_SEARCH_FAKE_OBJ)))) + av_dict_set(&codec_opts, opt, arg, FLAGS(oc)); + if ((of = av_opt_find(&fc, opt, NULL, 0, + AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) + av_dict_set(&format_opts, opt, arg, FLAGS(of)); +#if CONFIG_SWSCALE + sc = sws_get_class(); + if ((os = av_opt_find(&sc, opt, NULL, 0, + AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) { // XXX we only support sws_flags, not arbitrary sws options int ret = av_opt_set(sws_opts, opt, arg, 0); if (ret < 0) { @@ -384,8 +446,18 @@ int opt_default(const char *opt, const char *arg) return ret; } } +#endif + swr_class = swr_get_class(); + if (!oc && !of && !os && (oswr = av_opt_find(&swr_class, opt, NULL, 0, + AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) { + int ret = av_opt_set(swr_opts, opt, arg, 0); + if (ret < 0) { + av_log(NULL, AV_LOG_ERROR, "Error setting option %s.\n", opt); + return ret; + } + } - if (o) + if (oc || of || os || oswr) return 0; av_log(NULL, AV_LOG_ERROR, "Unrecognized option '%s'\n", opt); return AVERROR_OPTION_NOT_FOUND; @@ -426,6 +498,106 @@ int opt_loglevel(const char *opt, const char *arg) return 0; } +int opt_report(const char *opt) +{ + char filename[64]; + time_t now; + struct tm *tm; + + if (report_file) /* already opened */ + return 0; + time(&now); + tm = localtime(&now); + snprintf(filename, sizeof(filename), "%s-%04d%02d%02d-%02d%02d%02d.log", + program_name, + tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, + tm->tm_hour, tm->tm_min, tm->tm_sec); + report_file = fopen(filename, "w"); + if (!report_file) { + av_log(NULL, AV_LOG_ERROR, "Failed to open report \"%s\": %s\n", + filename, strerror(errno)); + return AVERROR(errno); + } + av_log_set_callback(log_callback_report); + av_log(NULL, AV_LOG_INFO, + "%s started on %04d-%02d-%02d at %02d:%02d:%02d\n" + "Report written to \"%s\"\n", + program_name, + tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, + tm->tm_hour, tm->tm_min, tm->tm_sec, + filename); + av_log_set_level(FFMAX(av_log_get_level(), AV_LOG_VERBOSE)); + return 0; +} + +int opt_max_alloc(const char *opt, const char *arg) +{ + char *tail; + size_t max; + + max = strtol(arg, &tail, 10); + if (*tail) { + av_log(NULL, AV_LOG_FATAL, "Invalid max_alloc \"%s\".\n", arg); + exit_program(1); + } + av_max_alloc(max); + return 0; +} + +int opt_cpuflags(const char *opt, const char *arg) +{ + static const AVOption cpuflags_opts[] = { + { "flags" , NULL, 0, AV_OPT_TYPE_FLAGS, { 0 }, INT64_MIN, INT64_MAX, .unit = "flags" }, + { "altivec" , NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_ALTIVEC }, .unit = "flags" }, + { "mmx" , NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_MMX }, .unit = "flags" }, + { "mmx2" , NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_MMX2 }, .unit = "flags" }, + { "sse" , NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_SSE }, .unit = "flags" }, + { "sse2" , NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_SSE2 }, .unit = "flags" }, + { "sse2slow", NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_SSE2SLOW }, .unit = "flags" }, + { "sse3" , NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_SSE3 }, .unit = "flags" }, + { "sse3slow", NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_SSE3SLOW }, .unit = "flags" }, + { "ssse3" , NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_SSSE3 }, .unit = "flags" }, + { "atom" , NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_ATOM }, .unit = "flags" }, + { "sse4.1" , NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_SSE4 }, .unit = "flags" }, + { "sse4.2" , NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_SSE42 }, .unit = "flags" }, + { "avx" , NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_AVX }, .unit = "flags" }, + { "xop" , NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_XOP }, .unit = "flags" }, + { "fma4" , NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_FMA4 }, .unit = "flags" }, + { "3dnow" , NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_3DNOW }, .unit = "flags" }, + { "3dnowext", NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_3DNOWEXT }, .unit = "flags" }, + + { "armv5te", NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_ARMV5TE }, .unit = "flags" }, + { "armv6", NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_ARMV6 }, .unit = "flags" }, + { "armv6t2", NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_ARMV6T2 }, .unit = "flags" }, + { "vfp", NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_VFP }, .unit = "flags" }, + { "vfpv3", NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_VFPV3 }, .unit = "flags" }, + { "neon", NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_NEON }, .unit = "flags" }, + + { NULL }, + }; + static const AVClass class = { + .class_name = "cpuflags", + .item_name = av_default_item_name, + .option = cpuflags_opts, + .version = LIBAVUTIL_VERSION_INT, + }; + int flags = av_get_cpu_flags(); + int ret; + const AVClass *pclass = &class; + + if ((ret = av_opt_eval_flags(&pclass, &cpuflags_opts[0], arg, &flags)) < 0) + return ret; + + av_force_cpu_flags(flags); + return 0; +} + +int opt_codec_debug(const char *opt, const char *arg) +{ + av_log_set_level(AV_LOG_DEBUG); + return opt_default(opt, arg); +} + int opt_timelimit(const char *opt, const char *arg) { #if HAVE_SETRLIMIT @@ -454,13 +626,14 @@ static int warned_cfg = 0; #define INDENT 1 #define SHOW_VERSION 2 #define SHOW_CONFIG 4 +#define SHOW_COPYRIGHT 8 #define PRINT_LIB_INFO(libname, LIBNAME, flags, level) \ if (CONFIG_##LIBNAME) { \ const char *indent = flags & INDENT? " " : ""; \ if (flags & SHOW_VERSION) { \ unsigned int version = libname##_version(); \ - av_log(NULL, level, "%slib%-9s %2d.%3d.%2d / %2d.%3d.%2d\n",\ + av_log(NULL, level, "%slib%-11s %2d.%3d.%3d / %2d.%3d.%3d\n",\ indent, #libname, \ LIB##LIBNAME##_VERSION_MAJOR, \ LIB##LIBNAME##_VERSION_MINOR, \ @@ -469,7 +642,7 @@ static int warned_cfg = 0; } \ if (flags & SHOW_CONFIG) { \ const char *cfg = libname##_configuration(); \ - if (strcmp(LIBAV_CONFIGURATION, cfg)) { \ + if (strcmp(FFMPEG_CONFIGURATION, cfg)) { \ if (!warned_cfg) { \ av_log(NULL, level, \ "%sWARNING: library configuration mismatch\n", \ @@ -490,27 +663,45 @@ static void print_all_libs_info(int flags, int level) PRINT_LIB_INFO(avdevice, AVDEVICE, flags, level); PRINT_LIB_INFO(avfilter, AVFILTER, flags, level); PRINT_LIB_INFO(swscale, SWSCALE, flags, level); + PRINT_LIB_INFO(swresample,SWRESAMPLE, flags, level); +#if CONFIG_POSTPROC + PRINT_LIB_INFO(postproc, POSTPROC, flags, level); +#endif } -void show_banner(void) +static void print_program_info(int flags, int level) { - av_log(NULL, AV_LOG_INFO, - "%s version " LIBAV_VERSION ", Copyright (c) %d-%d the Libav developers\n", - program_name, program_birth_year, this_year); - av_log(NULL, AV_LOG_INFO, " built on %s %s with %s %s\n", - __DATE__, __TIME__, CC_TYPE, CC_VERSION); - av_log(NULL, AV_LOG_VERBOSE, " configuration: " LIBAV_CONFIGURATION "\n"); - print_all_libs_info(INDENT|SHOW_CONFIG, AV_LOG_VERBOSE); - print_all_libs_info(INDENT|SHOW_VERSION, AV_LOG_VERBOSE); + const char *indent = flags & INDENT? " " : ""; + + av_log(NULL, level, "%s version " FFMPEG_VERSION, program_name); + if (flags & SHOW_COPYRIGHT) + av_log(NULL, level, " Copyright (c) %d-%d the FFmpeg developers", + program_birth_year, this_year); + av_log(NULL, level, "\n"); + av_log(NULL, level, "%sbuilt on %s %s with %s %s\n", + indent, __DATE__, __TIME__, CC_TYPE, CC_VERSION); + av_log(NULL, level, "%sconfiguration: " FFMPEG_CONFIGURATION "\n", indent); } -void show_version(void) { +void show_banner(int argc, char **argv, const OptionDef *options) +{ + int idx = locate_option(argc, argv, options, "version"); + if (idx) + return; + + print_program_info (INDENT|SHOW_COPYRIGHT, AV_LOG_INFO); + print_all_libs_info(INDENT|SHOW_CONFIG, AV_LOG_INFO); + print_all_libs_info(INDENT|SHOW_VERSION, AV_LOG_INFO); +} + +int opt_version(const char *opt, const char *arg) { av_log_set_callback(log_callback_help); - printf("%s " LIBAV_VERSION "\n", program_name); + print_program_info (0 , AV_LOG_INFO); print_all_libs_info(SHOW_VERSION, AV_LOG_INFO); + return 0; } -void show_license(void) +int opt_license(const char *opt, const char *arg) { printf( #if CONFIG_NONFREE @@ -577,9 +768,10 @@ void show_license(void) program_name, program_name, program_name #endif ); + return 0; } -void show_formats(void) +int opt_formats(const char *opt, const char *arg) { AVInputFormat *ifmt = NULL; AVOutputFormat *ofmt = NULL; @@ -624,9 +816,22 @@ void show_formats(void) name, long_name ? long_name:" "); } + return 0; +} + +static char get_media_type_char(enum AVMediaType type) +{ + static const char map[AVMEDIA_TYPE_NB] = { + [AVMEDIA_TYPE_VIDEO] = 'V', + [AVMEDIA_TYPE_AUDIO] = 'A', + [AVMEDIA_TYPE_DATA] = 'D', + [AVMEDIA_TYPE_SUBTITLE] = 'S', + [AVMEDIA_TYPE_ATTACHMENT] = 'T', + }; + return type >= 0 && type < AVMEDIA_TYPE_NB && map[type] ? map[type] : '?'; } -void show_codecs(void) +int opt_codecs(const char *opt, const char *arg) { AVCodec *p = NULL, *p2; const char *last_name; @@ -645,7 +850,6 @@ void show_codecs(void) int decode = 0; int encode = 0; int cap = 0; - const char *type_str; p2 = NULL; while ((p = av_codec_next(p))) { @@ -666,24 +870,10 @@ void show_codecs(void) break; last_name = p2->name; - switch (p2->type) { - case AVMEDIA_TYPE_VIDEO: - type_str = "V"; - break; - case AVMEDIA_TYPE_AUDIO: - type_str = "A"; - break; - case AVMEDIA_TYPE_SUBTITLE: - type_str = "S"; - break; - default: - type_str = "?"; - break; - } - printf(" %s%s%s%s%s%s %-15s %s", + printf(" %s%s%c%s%s%s %-15s %s", decode ? "D" : (/* p2->decoder ? "d" : */ " "), encode ? "E" : " ", - type_str, + get_media_type_char(p2->type), cap & CODEC_CAP_DRAW_HORIZ_BAND ? "S" : " ", cap & CODEC_CAP_DR1 ? "D" : " ", cap & CODEC_CAP_TRUNCATED ? "T" : " ", @@ -701,9 +891,10 @@ void show_codecs(void) "even though both encoding and decoding are supported. For example, the h263\n" "decoder corresponds to the h263 and h263p encoders, for file formats it is even\n" "worse.\n"); + return 0; } -void show_bsfs(void) +int opt_bsfs(const char *opt, const char *arg) { AVBitStreamFilter *bsf = NULL; @@ -711,9 +902,10 @@ void show_bsfs(void) while ((bsf = av_bitstream_filter_next(bsf))) printf("%s\n", bsf->name); printf("\n"); + return 0; } -void show_protocols(void) +int opt_protocols(const char *opt, const char *arg) { void *opaque = NULL; const char *name; @@ -725,20 +917,42 @@ void show_protocols(void) printf("Output:\n"); while ((name = avio_enum_protocols(&opaque, 1))) printf("%s\n", name); + return 0; } -void show_filters(void) +int opt_filters(const char *opt, const char *arg) { AVFilter av_unused(**filter) = NULL; + char descr[64], *descr_cur; + int i, j; + const AVFilterPad *pad; printf("Filters:\n"); #if CONFIG_AVFILTER - while ((filter = av_filter_next(filter)) && *filter) - printf("%-16s %s\n", (*filter)->name, (*filter)->description); + while ((filter = av_filter_next(filter)) && *filter) { + descr_cur = descr; + for (i = 0; i < 2; i++) { + if (i) { + *(descr_cur++) = '-'; + *(descr_cur++) = '>'; + } + pad = i ? (*filter)->outputs : (*filter)->inputs; + for (j = 0; pad[j].name; j++) { + if (descr_cur >= descr + sizeof(descr) - 4) + break; + *(descr_cur++) = get_media_type_char(pad[j].type); + } + if (!j) + *(descr_cur++) = '|'; + } + *descr_cur = 0; + printf("%-16s %-10s %s\n", (*filter)->name, descr, (*filter)->description); + } #endif + return 0; } -void show_pix_fmts(void) +int opt_pix_fmts(const char *opt, const char *arg) { enum PixelFormat pix_fmt; @@ -758,6 +972,8 @@ void show_pix_fmts(void) for (pix_fmt = 0; pix_fmt < PIX_FMT_NB; pix_fmt++) { const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[pix_fmt]; + if(!pix_desc->name) + continue; printf("%c%c%c%c%c %-16s %d %2d\n", sws_isSupportedInput (pix_fmt) ? 'I' : '.', sws_isSupportedOutput(pix_fmt) ? 'O' : '.', @@ -768,6 +984,7 @@ void show_pix_fmts(void) pix_desc->nb_components, av_get_bits_per_pixel(pix_desc)); } + return 0; } int show_sample_fmts(const char *opt, const char *arg) @@ -827,58 +1044,47 @@ int cmdutils_read_file(const char *filename, char **bufptr, size_t *size) return ret; } -void init_pts_correction(PtsCorrectionContext *ctx) -{ - ctx->num_faulty_pts = ctx->num_faulty_dts = 0; - ctx->last_pts = ctx->last_dts = INT64_MIN; -} - -int64_t guess_correct_pts(PtsCorrectionContext *ctx, int64_t reordered_pts, - int64_t dts) -{ - int64_t pts = AV_NOPTS_VALUE; - - if (dts != AV_NOPTS_VALUE) { - ctx->num_faulty_dts += dts <= ctx->last_dts; - ctx->last_dts = dts; - } - if (reordered_pts != AV_NOPTS_VALUE) { - ctx->num_faulty_pts += reordered_pts <= ctx->last_pts; - ctx->last_pts = reordered_pts; - } - if ((ctx->num_faulty_pts<=ctx->num_faulty_dts || dts == AV_NOPTS_VALUE) - && reordered_pts != AV_NOPTS_VALUE) - pts = reordered_pts; - else - pts = dts; - - return pts; -} - FILE *get_preset_file(char *filename, size_t filename_size, const char *preset_name, int is_path, const char *codec_name) { FILE *f = NULL; int i; - const char *base[3] = { getenv("AVCONV_DATADIR"), + const char *base[3] = { getenv("FFMPEG_DATADIR"), getenv("HOME"), - AVCONV_DATADIR, }; + FFMPEG_DATADIR, }; if (is_path) { av_strlcpy(filename, preset_name, filename_size); f = fopen(filename, "r"); } else { +#ifdef _WIN32 + char datadir[MAX_PATH], *ls; + base[2] = NULL; + + if (GetModuleFileNameA(GetModuleHandleA(NULL), datadir, sizeof(datadir) - 1)) + { + for (ls = datadir; ls < datadir + strlen(datadir); ls++) + if (*ls == '\\') *ls = '/'; + + if (ls = strrchr(datadir, '/')) + { + *ls = 0; + strncat(datadir, "/ffpresets", sizeof(datadir) - 1 - strlen(datadir)); + base[2] = datadir; + } + } +#endif for (i = 0; i < 3 && !f; i++) { if (!base[i]) continue; - snprintf(filename, filename_size, "%s%s/%s.avpreset", base[i], - i != 1 ? "" : "/.avconv", preset_name); + snprintf(filename, filename_size, "%s%s/%s.ffpreset", base[i], + i != 1 ? "" : "/.ffmpeg", preset_name); f = fopen(filename, "r"); if (!f && codec_name) { snprintf(filename, filename_size, - "%s%s/%s-%s.avpreset", - base[i], i != 1 ? "" : "/.avconv", codec_name, + "%s%s/%s-%s.ffpreset", + base[i], i != 1 ? "" : "/.ffmpeg", codec_name, preset_name); f = fopen(filename, "r"); } @@ -902,6 +1108,7 @@ int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec) case 's': type = AVMEDIA_TYPE_SUBTITLE; break; case 'd': type = AVMEDIA_TYPE_DATA; break; case 't': type = AVMEDIA_TYPE_ATTACHMENT; break; + default: abort(); // never reached, silence warning } if (type != st->codec->codec_type) return 0; @@ -941,13 +1148,11 @@ int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec) return AVERROR(EINVAL); } -AVDictionary *filter_codec_opts(AVDictionary *opts, enum CodecID codec_id, +AVDictionary *filter_codec_opts(AVDictionary *opts, AVCodec *codec, AVFormatContext *s, AVStream *st) { AVDictionary *ret = NULL; AVDictionaryEntry *t = NULL; - AVCodec *codec = s->oformat ? avcodec_find_encoder(codec_id) - : avcodec_find_decoder(codec_id); int flags = s->oformat ? AV_OPT_FLAG_ENCODING_PARAM : AV_OPT_FLAG_DECODING_PARAM; char prefix = 0; @@ -1013,79 +1218,11 @@ AVDictionary **setup_find_stream_info_opts(AVFormatContext *s, return NULL; } for (i = 0; i < s->nb_streams; i++) - opts[i] = filter_codec_opts(codec_opts, s->streams[i]->codec->codec_id, + opts[i] = filter_codec_opts(codec_opts, avcodec_find_decoder(s->streams[i]->codec->codec_id), s, s->streams[i]); return opts; } -#if CONFIG_AVFILTER - -static int sink_init(AVFilterContext *ctx, const char *args, void *opaque) -{ - SinkContext *priv = ctx->priv; - - if (!opaque) - return AVERROR(EINVAL); - *priv = *(SinkContext *)opaque; - - return 0; -} - -static void null_end_frame(AVFilterLink *inlink) { } - -static int sink_query_formats(AVFilterContext *ctx) -{ - SinkContext *priv = ctx->priv; - - if (priv->pix_fmts) - avfilter_set_common_formats(ctx, avfilter_make_format_list(priv->pix_fmts)); - else - avfilter_default_query_formats(ctx); - return 0; -} - -AVFilter sink = { - .name = "sink", - .priv_size = sizeof(SinkContext), - .init = sink_init, - - .query_formats = sink_query_formats, - - .inputs = (AVFilterPad[]) {{ .name = "default", - .type = AVMEDIA_TYPE_VIDEO, - .end_frame = null_end_frame, - .min_perms = AV_PERM_READ, }, - { .name = NULL }}, - .outputs = (AVFilterPad[]) {{ .name = NULL }}, -}; - -int get_filtered_video_frame(AVFilterContext *ctx, AVFrame *frame, - AVFilterBufferRef **picref_ptr, AVRational *tb) -{ - int ret; - AVFilterBufferRef *picref; - - if ((ret = avfilter_request_frame(ctx->inputs[0])) < 0) - return ret; - if (!(picref = ctx->inputs[0]->cur_buf)) - return AVERROR(ENOENT); - *picref_ptr = picref; - ctx->inputs[0]->cur_buf = NULL; - *tb = ctx->inputs[0]->time_base; - - memcpy(frame->data, picref->data, sizeof(frame->data)); - memcpy(frame->linesize, picref->linesize, sizeof(frame->linesize)); - frame->interlaced_frame = picref->video->interlaced; - frame->top_field_first = picref->video->top_field_first; - frame->key_frame = picref->video->key_frame; - frame->pict_type = picref->video->pict_type; - frame->sample_aspect_ratio = picref->video->pixel_aspect; - - return 1; -} - -#endif /* CONFIG_AVFILTER */ - void *grow_array(void *array, int elem_size, int *size, int new_size) { if (new_size >= INT_MAX / elem_size) { diff --git a/cmdutils.h b/cmdutils.h index 792254cf6cd..2266ee132ec 100644 --- a/cmdutils.h +++ b/cmdutils.h @@ -2,25 +2,25 @@ * Various utilities for command line tools * copyright (c) 2003 Fabrice Bellard * - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef LIBAV_CMDUTILS_H -#define LIBAV_CMDUTILS_H +#ifndef FFMPEG_CMDUTILS_H +#define FFMPEG_CMDUTILS_H #include @@ -29,6 +29,10 @@ #include "libavformat/avformat.h" #include "libswscale/swscale.h" +#ifdef __MINGW32__ +#undef main /* We don't want SDL to override our main() */ +#endif + /** * program name, defined by the program for show_version(). */ @@ -39,9 +43,15 @@ extern const char program_name[]; */ extern const int program_birth_year; +/** + * this year, defined by the program for show_banner() + */ +extern const int this_year; + extern AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB]; extern AVFormatContext *avformat_opts; extern struct SwsContext *sws_opts; +extern struct SwrContext *swr_opts; extern AVDictionary *format_opts, *codec_opts; /** @@ -57,7 +67,7 @@ void uninit_opts(void); /** * Trivial log callback. - * Only suitable for show_help and similar since it lacks prefix handling. + * Only suitable for opt_help and similar since it lacks prefix handling. */ void log_callback_help(void* ptr, int level, const char* fmt, va_list vl); @@ -72,6 +82,14 @@ int opt_default(const char *opt, const char *arg); */ int opt_loglevel(const char *opt, const char *arg); +int opt_report(const char *opt); + +int opt_max_alloc(const char *opt, const char *arg); + +int opt_cpuflags(const char *opt, const char *arg); + +int opt_codec_debug(const char *opt, const char *arg); + /** * Limit the execution time. */ @@ -216,7 +234,7 @@ int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec); * @param st A stream from s for which the options should be filtered. * @return a pointer to the created dictionary */ -AVDictionary *filter_codec_opts(AVDictionary *opts, enum CodecID codec_id, +AVDictionary *filter_codec_opts(AVDictionary *opts, AVCodec *codec, AVFormatContext *s, AVStream *st); /** @@ -249,56 +267,64 @@ void print_error(const char *filename, int err); * current version of the repository and of the libav* libraries used by * the program. */ -void show_banner(void); +void show_banner(int argc, char **argv, const OptionDef *options); /** * Print the version of the program to stdout. The version message * depends on the current versions of the repository and of the libav* * libraries. + * This option processing function does not utilize the arguments. */ -void show_version(void); +int opt_version(const char *opt, const char *arg); /** * Print the license of the program to stdout. The license depends on * the license of the libraries compiled into the program. + * This option processing function does not utilize the arguments. */ -void show_license(void); +int opt_license(const char *opt, const char *arg); /** * Print a listing containing all the formats supported by the * program. + * This option processing function does not utilize the arguments. */ -void show_formats(void); +int opt_formats(const char *opt, const char *arg); /** * Print a listing containing all the codecs supported by the * program. + * This option processing function does not utilize the arguments. */ -void show_codecs(void); +int opt_codecs(const char *opt, const char *arg); /** * Print a listing containing all the filters supported by the * program. + * This option processing function does not utilize the arguments. */ -void show_filters(void); +int opt_filters(const char *opt, const char *arg); /** * Print a listing containing all the bit stream filters supported by the * program. + * This option processing function does not utilize the arguments. */ -void show_bsfs(void); +int opt_bsfs(const char *opt, const char *arg); /** * Print a listing containing all the protocols supported by the * program. + * This option processing function does not utilize the arguments. */ -void show_protocols(void); +int opt_protocols(const char *opt, const char *arg); /** * Print a listing containing all the pixel formats supported by the * program. + * This option processing function does not utilize the arguments. */ -void show_pix_fmts(void); +int opt_pix_fmts(const char *opt, const char *arg); /** * Print a listing containing all the sample formats supported by the @@ -323,37 +349,14 @@ int read_yesno(void); */ int cmdutils_read_file(const char *filename, char **bufptr, size_t *size); -typedef struct { - int64_t num_faulty_pts; /// Number of incorrect PTS values so far - int64_t num_faulty_dts; /// Number of incorrect DTS values so far - int64_t last_pts; /// PTS of the last frame - int64_t last_dts; /// DTS of the last frame -} PtsCorrectionContext; - -/** - * Reset the state of the PtsCorrectionContext. - */ -void init_pts_correction(PtsCorrectionContext *ctx); - -/** - * Attempt to guess proper monotonic timestamps for decoded video frames - * which might have incorrect times. Input timestamps may wrap around, in - * which case the output will as well. - * - * @param pts the pts field of the decoded AVPacket, as passed through - * AVCodecContext.reordered_opaque - * @param dts the dts field of the decoded AVPacket - * @return one of the input values, may be AV_NOPTS_VALUE - */ -int64_t guess_correct_pts(PtsCorrectionContext *ctx, int64_t pts, int64_t dts); - /** * Get a file corresponding to a preset file. * * If is_path is non-zero, look for the file in the path preset_name. - * Otherwise search for a file named arg.avpreset in the directories - * $AVCONV_DATADIR (if set), $HOME/.avconv, and in the datadir defined - * at configuration time, in that order. If no such file is found and + * Otherwise search for a file named arg.ffpreset in the directories + * $FFMPEG_DATADIR (if set), $HOME/.ffmpeg, and in the datadir defined + * at configuration time or in a "ffpresets" folder along the executable + * on win32, in that order. If no such file is found and * codec_name is defined, then search for a file named * codec_name-preset_name.avpreset in the above-mentioned directories. * @@ -367,20 +370,6 @@ int64_t guess_correct_pts(PtsCorrectionContext *ctx, int64_t pts, int64_t dts); FILE *get_preset_file(char *filename, size_t filename_size, const char *preset_name, int is_path, const char *codec_name); -typedef struct { - const enum PixelFormat *pix_fmts; -} SinkContext; - -extern AVFilter sink; - -/** - * Extract a frame from sink. - * - * @return a negative error in case of failure, 1 if one frame has - * been extracted successfully. - */ -int get_filtered_video_frame(AVFilterContext *sink, AVFrame *frame, - AVFilterBufferRef **picref, AVRational *pts_tb); /** * Do all the necessary cleanup and abort. @@ -398,4 +387,4 @@ void exit_program(int ret); */ void *grow_array(void *array, int elem_size, int *size, int new_size); -#endif /* LIBAV_CMDUTILS_H */ +#endif /* CMDUTILS_H */ diff --git a/cmdutils_common_opts.h b/cmdutils_common_opts.h index 1158afab991..855cb889be9 100644 --- a/cmdutils_common_opts.h +++ b/cmdutils_common_opts.h @@ -1,15 +1,20 @@ - { "L", OPT_EXIT, {(void*)show_license}, "show license" }, - { "h", OPT_EXIT, {(void*)show_help}, "show help" }, - { "?", OPT_EXIT, {(void*)show_help}, "show help" }, - { "help", OPT_EXIT, {(void*)show_help}, "show help" }, - { "-help", OPT_EXIT, {(void*)show_help}, "show help" }, - { "version", OPT_EXIT, {(void*)show_version}, "show version" }, - { "formats" , OPT_EXIT, {(void*)show_formats }, "show available formats" }, - { "codecs" , OPT_EXIT, {(void*)show_codecs }, "show available codecs" }, - { "bsfs" , OPT_EXIT, {(void*)show_bsfs }, "show available bit stream filters" }, - { "protocols", OPT_EXIT, {(void*)show_protocols}, "show available protocols" }, - { "filters", OPT_EXIT, {(void*)show_filters }, "show available filters" }, - { "pix_fmts" , OPT_EXIT, {(void*)show_pix_fmts }, "show available pixel formats" }, + { "L", OPT_EXIT, {(void*)opt_license}, "show license" }, + { "h", OPT_EXIT, {(void*)opt_help}, "show help" }, + { "?", OPT_EXIT, {(void*)opt_help}, "show help" }, + { "help", OPT_EXIT, {(void*)opt_help}, "show help" }, + { "-help", OPT_EXIT, {(void*)opt_help}, "show help" }, + { "version", OPT_EXIT, {(void*)opt_version}, "show version" }, + { "formats" , OPT_EXIT, {(void*)opt_formats }, "show available formats" }, + { "codecs" , OPT_EXIT, {(void*)opt_codecs }, "show available codecs" }, + { "bsfs" , OPT_EXIT, {(void*)opt_bsfs }, "show available bit stream filters" }, + { "protocols", OPT_EXIT, {(void*)opt_protocols}, "show available protocols" }, + { "filters", OPT_EXIT, {(void*)opt_filters }, "show available filters" }, + { "pix_fmts" , OPT_EXIT, {(void*)opt_pix_fmts }, "show available pixel formats" }, { "sample_fmts", OPT_EXIT, {.func_arg = show_sample_fmts }, "show available audio sample formats" }, { "loglevel", HAS_ARG, {(void*)opt_loglevel}, "set libav* logging level", "loglevel" }, { "v", HAS_ARG, {(void*)opt_loglevel}, "set libav* logging level", "loglevel" }, + { "debug", HAS_ARG, {(void*)opt_codec_debug}, "set debug flags", "flags" }, + { "fdebug", HAS_ARG, {(void*)opt_codec_debug}, "set debug flags", "flags" }, + { "report", 0, {(void*)opt_report}, "generate a report" }, + { "max_alloc", HAS_ARG, {(void*)opt_max_alloc}, "set maximum size of a single allocated block", "bytes" }, + { "cpuflags", HAS_ARG | OPT_EXPERT, {(void*)opt_cpuflags}, "force specific cpu flags", "flags" }, diff --git a/common.mak b/common.mak index 7f2c36774e9..b47b19f42f6 100644 --- a/common.mak +++ b/common.mak @@ -5,6 +5,74 @@ # first so "all" becomes default target all: all-yes +ifndef SUBDIR + +ifndef V +Q = @ +ECHO = printf "$(1)\t%s\n" $(2) +BRIEF = CC CXX AS YASM AR LD HOSTCC STRIP CP +SILENT = DEPCC YASMDEP RM RANLIB +MSG = $@ +M = @$(call ECHO,$(TAG),$@); +$(foreach VAR,$(BRIEF), \ + $(eval override $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR)))) +$(foreach VAR,$(SILENT),$(eval override $(VAR) = @$($(VAR)))) +$(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_DIR)/%=%)); $(INSTALL)) +endif + +ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale swresample + +# NASM requires -I path terminated with / +IFLAGS := -I. -I$(SRC_PATH)/ +CPPFLAGS := $(IFLAGS) $(CPPFLAGS) +CFLAGS += $(ECFLAGS) +CCFLAGS = $(CFLAGS) +CXXFLAGS := $(CFLAGS) $(CXXFLAGS) +YASMFLAGS += $(IFLAGS) -I$(SRC_PATH)/libavutil/x86/ -Pconfig.asm +HOSTCFLAGS += $(IFLAGS) +LDFLAGS := $(ALLFFLIBS:%=-Llib%) $(LDFLAGS) + +define COMPILE + $($(1)DEP) + $($(1)) $(CPPFLAGS) $($(1)FLAGS) $($(1)_DEPFLAGS) -c $($(1)_O) $< +endef + +COMPILE_C = $(call COMPILE,CC) +COMPILE_CXX = $(call COMPILE,CXX) +COMPILE_S = $(call COMPILE,AS) + +%.o: %.c + $(COMPILE_C) + +%.o: %.cpp + $(COMPILE_CXX) + +%.s: %.c + $(CC) $(CPPFLAGS) $(CFLAGS) -S -o $@ $< + +%.o: %.S + $(COMPILE_S) + +%.ho: %.h + $(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused -c -o $@ -x c $< + +%.ver: %.v + $(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@ + +%.c %.h: TAG = GEN + +# Dummy rule to stop make trying to rebuild removed or renamed headers +%.h: + @: + +# Disable suffix rules. Most of the builtin rules are suffix rules, +# so this saves some time on slow systems. +.SUFFIXES: + +# Do not delete intermediate files from chains of implicit rules +$(OBJS): +endif + include $(SRC_PATH)/arch.mak OBJS += $(OBJS-yes) @@ -45,7 +113,7 @@ $(TOOLOBJS): | tools OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOSTOBJS) $(TESTOBJS)) -CLEANSUFFIXES = *.d *.o *~ *.ho *.map *.ver +CLEANSUFFIXES = *.d *.o *~ *.ho *.map *.ver *.gcno *.gcda DISTCLEANSUFFIXES = *.pc LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp diff --git a/configure b/configure index a73d6669679..f35923078a4 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #!/bin/sh # -# Libav configure script +# FFmpeg configure script # # Copyright (c) 2000-2002 Fabrice Bellard # Copyright (c) 2005-2008 Diego Biurrun @@ -44,9 +44,9 @@ if test "$E1" != 0 || test "$E2" = 0; then echo "No compatible shell script interpreter found." echo "This configure script requires a POSIX-compatible shell" echo "such as bash or ksh." - echo "THIS IS NOT A BUG IN LIBAV, DO NOT REPORT IT AS SUCH." + echo "THIS IS NOT A BUG IN FFMPEG, DO NOT REPORT IT AS SUCH." echo "Instead, install a working POSIX-compatible shell." - echo "Disabling this configure test will create a broken Libav." + echo "Disabling this configure test will create a broken FFmpeg." if test "$BASH_VERSION" = '2.04.0(1)-release'; then echo "This bash version ($BASH_VERSION) is broken on your platform." echo "Upgrade to a later version if available." @@ -78,7 +78,7 @@ Standard options: --disable-logging do not log configure debug information --prefix=PREFIX install in PREFIX [$prefix] --bindir=DIR install binaries in DIR [PREFIX/bin] - --datadir=DIR install data files in DIR [PREFIX/share/avconv] + --datadir=DIR install data files in DIR [PREFIX/share/ffmpeg] --libdir=DIR install libs in DIR [PREFIX/lib] --shlibdir=DIR install shared libs in DIR [PREFIX/lib] --incdir=DIR install includes in DIR [PREFIX/include] @@ -101,17 +101,20 @@ Configuration options: Component options: --disable-doc do not build documentation - --disable-avconv disable avconv build - --disable-avplay disable avplay build - --disable-avprobe disable avprobe build - --disable-avserver disable avserver build + --disable-ffmpeg disable ffmpeg build + --disable-ffplay disable ffplay build + --disable-ffprobe disable ffprobe build + --disable-ffserver disable ffserver build --disable-avdevice disable libavdevice build --disable-avcodec disable libavcodec build --disable-avformat disable libavformat build + --disable-swresample disable libswresample build --disable-swscale disable libswscale build + --disable-postproc disable libpostproc build --disable-avfilter disable video filter support [no] --disable-pthreads disable pthreads [auto] --disable-w32threads disable Win32 threads [auto] + --disable-os2threads disable OS/2 threads [auto] --enable-x11grab enable X11 grabbing [no] --disable-network disable network support [no] --disable-dct disable DCT code @@ -119,9 +122,9 @@ Component options: --disable-rdft disable RDFT code --disable-fft disable FFT code --enable-dxva2 enable DXVA2 code - --enable-vaapi enable VAAPI code - --enable-vda enable VDA code - --enable-vdpau enable VDPAU code + --enable-vaapi enable VAAPI code [autodetect] + --enable-vda enable VDA code [autodetect] + --enable-vdpau enable VDPAU code [autodetect] Individual component options: --disable-everything disable all components listed below @@ -163,8 +166,13 @@ Individual component options: External library support: --enable-avisynth enable reading of AVISynth script files [no] --enable-bzlib enable bzlib [autodetect] + --enable-fontconfig enable fontconfig --enable-frei0r enable frei0r video filtering --enable-gnutls enable gnutls [no] + --enable-libaacplus enable AAC+ encoding via libaacplus [no] + --enable-libass enable libass subtitles rendering [no] + --enable-libbluray enable BluRay reading using libbluray [no] + --enable-libcelt enable CELT decoding via libcelt [no] --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no] --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no] --enable-libopencv enable video filtering via libopencv [no] @@ -174,15 +182,19 @@ External library support: --enable-libfaac enable FAAC support via libfaac [no] --enable-libfreetype enable libfreetype [no] --enable-libgsm enable GSM support via libgsm [no] + --enable-libmodplug enable ModPlug via libmodplug [no] --enable-libmp3lame enable MP3 encoding via libmp3lame [no] --enable-libnut enable NUT (de)muxing via libnut, native (de)muxer exists [no] - --enable-libopenjpeg enable JPEG 2000 decoding via OpenJPEG [no] + --enable-libopenjpeg enable JPEG 2000 encoding/decoding via OpenJPEG [no] --enable-libpulse enable Pulseaudio input via libpulse [no] --enable-librtmp enable RTMP[E] support via librtmp [no] --enable-libschroedinger enable Dirac support via libschroedinger [no] --enable-libspeex enable Speex support via libspeex [no] + --enable-libstagefright-h264 enable H.264 decoding via libstagefright [no] --enable-libtheora enable Theora encoding via libtheora [no] + --enable-libutvideo enable Ut Video encoding and decoding via libutvideo [no] + --enable-libv4l2 enable libv4l2/v4l-utils [no] --enable-libvo-aacenc enable AAC encoding via libvo-aacenc [no] --enable-libvo-amrwbenc enable AMR-WB encoding via libvo-amrwbenc [no] --enable-libvorbis enable Vorbis encoding via libvorbis, @@ -192,6 +204,7 @@ External library support: --enable-libxavs enable AVS encoding via xavs [no] --enable-libxvid enable Xvid encoding via xvidcore, native MPEG-4/Xvid encoder exists [no] + --enable-openal enable OpenAL 1.1 capture support [no] --enable-openssl enable openssl [no] --enable-zlib enable zlib [autodetect] @@ -203,22 +216,26 @@ Advanced options (experts only): --target-os=OS compiler targets OS [$target_os] --target-exec=CMD command to run executables on target --target-path=DIR path to view of build directory on target - --nm=NM use nm tool + --nm=NM use nm tool NM [$nm_default] --ar=AR use archive tool AR [$ar_default] --as=AS use assembler AS [$as_default] + --yasmexe=EXE use yasm-compatible assembler EXE [$yasmexe_default] --cc=CC use C compiler CC [$cc_default] - --ld=LD use linker LD + --cxx=CXX use C compiler CXX [$cxx_default] + --ld=LD use linker LD [$ld_default] --host-cc=HOSTCC use host C compiler HOSTCC --host-cflags=HCFLAGS use HCFLAGS when compiling for host --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host --host-libs=HLIBS use libs HLIBS when linking for host --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS] + --extra-cxxflags=ECFLAGS add ECFLAGS to CXXFLAGS [$CXXFLAGS] --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS] --extra-libs=ELIBS add ELIBS [$ELIBS] --extra-version=STRING version string suffix [] --optflags override optimization-related compiler flags --build-suffix=SUFFIX library name suffix [] --malloc-prefix=PREFIX prefix malloc and related names with PREFIX + --progs-suffix=SUFFIX program name suffix [] --arch=ARCH select architecture [$arch] --cpu=CPU select the minimum required CPU (affects instruction selection, may crash on older CPUs) @@ -250,12 +267,21 @@ Optimization options (experts only): --disable-neon disable NEON optimizations --disable-vis disable VIS optimizations --disable-yasm disable use of yasm assembler + --postproc-version=V build libpostproc version V. + Where V can be '$ALT_PP_VER_MAJOR.$ALT_PP_VER_MINOR.$ALT_PP_VER_MICRO' or 'current'. [$postproc_version_default] -Developer options (useful when working on Libav itself): +Developer options (useful when working on FFmpeg itself): + --enable-coverage build with test coverage instrumentation --disable-debug disable debugging symbols --enable-debug=LEVEL set the debug level [$debuglevel] --disable-optimizations disable compiler optimizations --enable-extra-warnings enable more compiler warnings + --disable-stripping disable stripping of executables and shared libraries + --assert-level=level 0(default), 1 or 2, amount of assertion testing, + 2 causes a slowdown at runtime. + --valgrind=VALGRIND run "make fate" tests through valgrind to detect memory + leaks and errors, using the specified valgrind binary. + Cannot be combined with --target-exec --samples=PATH location of test samples for FATE, if not set use \$FATE_SAMPLES at make invocation time. --enable-xmm-clobber-test check XMM registers for clobbering (Win64-only; @@ -294,7 +320,7 @@ die(){ If you think configure made a mistake, make sure you are using the latest version from Git. If the latest version fails, report the problem to the -libav-user@libav.org mailing list or IRC #libav on irc.freenode.net. +ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net. EOF if disabled logging; then cat < $TMPCPP + log_file $TMPCPP + check_cmd $cxx $CPPFLAGS $CFLAGS $CXXFLAGS "$@" -c -o $TMPO $TMPCPP +} + check_cpp(){ log check_cpp "$@" cat > $TMPC @@ -651,12 +688,14 @@ check_yasm(){ check_ld(){ log check_ld "$@" + type=$1 + shift 1 flags='' libs='' for f; do test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f" done - check_cc $($filter_cflags $flags) || return + check_$type $($filter_cflags $flags) || return check_cmd $ld $LDFLAGS $flags -o $TMPE $TMPO $libs $extralibs } @@ -676,9 +715,17 @@ int x; EOF } +check_cxxflags(){ + log check_cxxflags "$@" + set -- $($filter_cflags "$@") + check_cxx "$@" < float foo(float f) { return $func(f); } -int main(void){ return 0; } +int main(void){ return (int) foo; } EOF } @@ -735,7 +782,26 @@ check_func_headers(){ echo "long check_$func(void) { return (long) $func; }" done echo "int main(void) { return 0; }" - } | check_ld "$@" && enable $funcs && enable_safe $headers + } | check_ld "cc" "$@" && enable $funcs && enable_safe $headers +} + +check_class_headers_cpp(){ + log check_class_headers_cpp "$@" + headers=$1 + classes=$2 + shift 2 + { + for hdr in $headers; do + echo "#include <$hdr>" + done + echo "int main(void) { " + i=1 + for class in $classes; do + echo "$class obj$i;" + i=$(expr $i + 1) + done + echo "return 0; }" + } | check_ld "cxx" "$@" && enable $funcs && enable_safe $headers } check_cpp_condition(){ @@ -767,13 +833,21 @@ check_lib2(){ check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@" } +check_lib_cpp(){ + log check_lib_cpp "$@" + headers="$1" + classes="$2" + shift 2 + check_class_headers_cpp "$headers" "$classes" "$@" && add_extralibs "$@" +} + check_pkg_config(){ log check_pkg_config "$@" pkg="$1" headers="$2" funcs="$3" shift 3 - $pkg_config --exists $pkg || return + $pkg_config --exists $pkg 2>/dev/null || return pkg_cflags=$($pkg_config --cflags $pkg) pkg_libs=$($pkg_config --libs $pkg) check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" && @@ -782,7 +856,7 @@ check_pkg_config(){ } check_exec(){ - check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; } + check_ld "cc" "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; } } check_exec_crash(){ @@ -799,6 +873,10 @@ check_exec_crash(){ static void sighandler(int sig){ raise(SIGTERM); } +int func(void){ + $code +} +int (*func_ptr)(void) = func; int main(void){ signal(SIGILL, sighandler); signal(SIGFPE, sighandler); @@ -806,7 +884,7 @@ int main(void){ #ifdef SIGBUS signal(SIGBUS, sighandler); #endif - { $code } + return func_ptr(); } EOF } @@ -862,6 +940,14 @@ require2(){ check_lib2 "$headers" $func "$@" || die "ERROR: $name not found" } +require_cpp(){ + name="$1" + headers="$2" + classes="$3" + shift 3 + check_lib_cpp "$headers" "$classes" "$@" || die "ERROR: $name not found" +} + require_pkg_config(){ pkg="$1" check_pkg_config "$@" || die "ERROR: $pkg not found" @@ -913,10 +999,10 @@ COMPONENT_LIST=" " PROGRAM_LIST=" - avconv - avplay - avprobe - avserver + ffplay + ffprobe + ffserver + ffmpeg " CONFIG_LIST=" @@ -929,22 +1015,29 @@ CONFIG_LIST=" avformat avisynth bzlib + crystalhd dct doc dwt dxva2 fastdiv fft + fontconfig frei0r gnutls gpl gray hardcoded_tables + libaacplus + libass + libbluray libcdio + libcelt libdc1394 libfaac libfreetype libgsm + libmodplug libmp3lame libnut libopencore_amrnb @@ -955,7 +1048,10 @@ CONFIG_LIST=" librtmp libschroedinger libspeex + libstagefright_h264 libtheora + libutvideo + libv4l2 libvo_aacenc libvo_amrwbenc libvorbis @@ -969,8 +1065,10 @@ CONFIG_LIST=" mpegaudiodsp network nonfree + openal openssl pic + postproc rdft rtpdec runtime_cpudetect @@ -980,6 +1078,7 @@ CONFIG_LIST=" small sram static + swresample swscale swscale_alpha thumb @@ -995,6 +1094,7 @@ CONFIG_LIST=" THREADS_LIST=' pthreads w32threads + os2threads ' ARCH_LIST=' @@ -1055,8 +1155,11 @@ HAVE_LIST=" altivec_h arpa_inet_h asm_mod_y + asm_types_h attribute_may_alias attribute_packed + cbrtf + clock_gettime closesocket cmov dcbzl @@ -1083,11 +1186,13 @@ HAVE_LIST=" GetProcessMemoryInfo GetProcessTimes getrusage + glob gnu_as ibm_asm inet_aton inline_asm isatty + kbhit ldbrx libdc1394_1 libdc1394_2 @@ -1101,13 +1206,16 @@ HAVE_LIST=" loongson lrint lrintf + lzo1x_999_compress machine_ioctl_bt848_h machine_ioctl_meteor_h + makeinfo malloc_h MapViewOfFile memalign mkstemp mmap + PeekNamedPipe poll_h posix_memalign round @@ -1122,7 +1230,6 @@ HAVE_LIST=" soundcard_h strerror_r strptime - strtok_r struct_addrinfo struct_ipv6_mreq struct_rusage_ru_maxrss @@ -1141,6 +1248,7 @@ HAVE_LIST=" sys_select_h sys_soundcard_h sys_videoio_h + termios_h threads trunc truncf @@ -1172,11 +1280,13 @@ CMDLINE_SELECT=" $CONFIG_LIST $THREADS_LIST asm + coverage cross_compile debug extra_warnings logging optimizations + stripping symver yasm " @@ -1196,10 +1306,12 @@ CMDLINE_SET=" ar arch as + assert_level build_suffix cc cpu cross_prefix + cxx dep_cc extra_version host_cc @@ -1207,22 +1319,29 @@ CMDLINE_SET=" host_ldflags host_libs host_os + install ld logfile malloc_prefix nm optflags pkg_config + postproc_version + progs_suffix samples + strip sysinclude sysroot target_exec target_os target_path + valgrind + yasmexe " CMDLINE_APPEND=" extra_cflags + extra_cxxflags " # code dependency declarations @@ -1298,6 +1417,7 @@ flac_decoder_select="golomb" flac_encoder_select="golomb lpc" flashsv_decoder_select="zlib" flashsv_encoder_select="zlib" +flashsv2_encoder_select="zlib" flashsv2_decoder_select="zlib" flv_decoder_select="h263_decoder" flv_encoder_select="h263_encoder" @@ -1308,10 +1428,12 @@ h263_encoder_select="aandct" h263_vaapi_hwaccel_select="vaapi h263_decoder" h263i_decoder_select="h263_decoder" h263p_encoder_select="h263_encoder" +h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser" h264_decoder_select="golomb h264chroma h264dsp h264pred h264qpel" h264_dxva2_hwaccel_deps="dxva2api_h" h264_dxva2_hwaccel_select="dxva2 h264_decoder" h264_vaapi_hwaccel_select="vaapi h264_decoder" +h264_vda_hwaccel_deps="VideoDecodeAcceleration_VDADecoder_h pthreads" h264_vda_hwaccel_select="vda h264_decoder" h264_vdpau_decoder_select="vdpau h264_decoder" imc_decoder_select="fft mdct sinewin" @@ -1337,15 +1459,20 @@ mpeg_vdpau_decoder_select="vdpau mpegvideo_decoder" mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h" mpeg_xvmc_decoder_select="mpegvideo_decoder" mpeg1_vdpau_decoder_select="vdpau mpeg1video_decoder" +mpeg1_vdpau_hwaccel_select="vdpau mpeg1video_decoder" mpeg1video_encoder_select="aandct" +mpeg2_crystalhd_decoder_select="crystalhd" mpeg2_dxva2_hwaccel_deps="dxva2api_h" mpeg2_dxva2_hwaccel_select="dxva2 mpeg2video_decoder" +mpeg2_vdpau_hwaccel_select="vdpau mpeg2video_decoder" mpeg2_vaapi_hwaccel_select="vaapi mpeg2video_decoder" mpeg2video_encoder_select="aandct" +mpeg4_crystalhd_decoder_select="crystalhd" mpeg4_decoder_select="h263_decoder mpeg4video_parser" mpeg4_encoder_select="h263_encoder" mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder" mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder" +msmpeg4_crystalhd_decoder_select="crystalhd" msmpeg4v1_decoder_select="h263_decoder" msmpeg4v1_encoder_select="h263_encoder" msmpeg4v2_decoder_select="h263_decoder" @@ -1370,6 +1497,9 @@ shorten_decoder_select="golomb" sipr_decoder_select="lsp" snow_decoder_select="dwt" snow_encoder_select="aandct dwt" +sonic_decoder_select="golomb" +sonic_encoder_select="golomb" +sonic_ls_encoder_select="golomb" svq1_encoder_select="aandct" svq3_decoder_select="golomb h264chroma h264dsp h264pred h264qpel" svq3_decoder_suggest="zlib" @@ -1379,6 +1509,7 @@ tiff_encoder_suggest="zlib" truehd_decoder_select="mlp_decoder" tscc_decoder_select="zlib" twinvq_decoder_select="mdct lsp sinewin" +vc1_crystalhd_decoder_select="crystalhd" vc1_decoder_select="h263_decoder h264chroma h264qpel" vc1_dxva2_hwaccel_deps="dxva2api_h" vc1_dxva2_hwaccel_select="dxva2 vc1_decoder" @@ -1402,6 +1533,7 @@ wmv1_encoder_select="h263_encoder" wmv2_decoder_select="h263_decoder" wmv2_encoder_select="h263_encoder" wmv3_decoder_select="vc1_decoder" +wmv3_crystalhd_decoder_select="crystalhd" wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel" wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel" wmv3_vdpau_decoder_select="vc1_vdpau_decoder" @@ -1412,6 +1544,7 @@ zlib_encoder_select="zlib" zmbv_decoder_select="zlib" zmbv_encoder_select="zlib" +crystalhd_deps="libcrystalhd_libcrystalhd_if_h" vaapi_deps="va_va_h" vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads" vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h" @@ -1420,20 +1553,25 @@ vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h" h264_parser_select="golomb h264dsp h264pred" # external libraries +libaacplus_encoder_deps="libaacplus" +libcelt_decoder_deps="libcelt" libfaac_encoder_deps="libfaac" libgsm_decoder_deps="libgsm" libgsm_encoder_deps="libgsm" libgsm_ms_decoder_deps="libgsm" libgsm_ms_encoder_deps="libgsm" +libmodplug_demuxer_deps="libmodplug" libmp3lame_encoder_deps="libmp3lame" libopencore_amrnb_decoder_deps="libopencore_amrnb" libopencore_amrnb_encoder_deps="libopencore_amrnb" libopencore_amrwb_decoder_deps="libopencore_amrwb" libopenjpeg_decoder_deps="libopenjpeg" +libopenjpeg_encoder_deps="libopenjpeg" libschroedinger_decoder_deps="libschroedinger" libschroedinger_encoder_deps="libschroedinger" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" +libstagefright_h264_decoder_deps="libstagefright_h264" libtheora_encoder_deps="libtheora" libvo_aacenc_encoder_deps="libvo_aacenc" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -1441,8 +1579,11 @@ libvorbis_encoder_deps="libvorbis" libvpx_decoder_deps="libvpx" libvpx_encoder_deps="libvpx" libx264_encoder_deps="libx264" +libx264rgb_encoder_deps="libx264" libxavs_encoder_deps="libxavs" libxvid_encoder_deps="libxvid" +libutvideo_decoder_deps="libutvideo" +libutvideo_encoder_deps="libutvideo" # demuxers / muxers ac3_demuxer_select="ac3_parser" @@ -1479,22 +1620,30 @@ w64_demuxer_deps="wav_demuxer" alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp" alsa_outdev_deps="alsa_asoundlib_h" bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h" +dshow_indev_deps="IBaseFilter" +dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid" dv1394_indev_deps="dv1394 dv_demuxer" fbdev_indev_deps="linux_fb_h" -jack_indev_deps="jack_jack_h" +jack_indev_deps="jack_jack_h sem_timedwait" +lavfi_indev_deps="avfilter" libcdio_indev_deps="libcdio" libdc1394_indev_deps="libdc1394" +libv4l2_indev_deps="libv4l2" +openal_indev_deps="openal" oss_indev_deps_any="soundcard_h sys_soundcard_h" oss_outdev_deps_any="soundcard_h sys_soundcard_h" pulse_indev_deps="libpulse" +sdl_outdev_deps="sdl" sndio_indev_deps="sndio_h" sndio_outdev_deps="sndio_h" +v4l_indev_deps="linux_videodev_h" v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h" vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines" vfwcap_indev_extralibs="-lavicap32" x11_grab_device_indev_deps="x11grab XShmCreateImage" # protocols +bluray_protocol_deps="libbluray" gopher_protocol_deps="network" httpproxy_protocol_deps="network" httpproxy_protocol_select="tcp_protocol" @@ -1517,31 +1666,46 @@ tls_protocol_select="tcp_protocol" udp_protocol_deps="network" # filters +aconvert_filter_deps="swresample" +amovie_filter_deps="avcodec avformat" +aresample_filter_deps="swresample" +ass_filter_deps="libass" blackframe_filter_deps="gpl" boxblur_filter_deps="gpl" +colormatrix_filter_deps="gpl" cropdetect_filter_deps="gpl" delogo_filter_deps="gpl" drawtext_filter_deps="libfreetype" -frei0r_filter_deps="frei0r dlopen strtok_r" +frei0r_filter_deps="frei0r dlopen" frei0r_filter_extralibs='$ldl' -frei0r_src_filter_deps="frei0r dlopen strtok_r" +frei0r_src_filter_deps="frei0r dlopen" frei0r_src_filter_extralibs='$ldl' hqdn3d_filter_deps="gpl" +movie_filter_deps="avcodec avformat" +mp_filter_deps="gpl avcodec swscale postproc" +mptestsrc_filter_deps="gpl" +negate_filter_deps="lut_filter" ocv_filter_deps="libopencv" +pan_filter_deps="swresample" +removelogo_filter_deps="avcodec avformat swscale" scale_filter_deps="swscale" +super2xsai_filter_deps="gpl" +tinterlace_filter_deps="gpl" yadif_filter_deps="gpl" # libraries avdevice_deps="avcodec avformat" avformat_deps="avcodec" +postproc_deps="gpl" # programs -avconv_deps="avcodec avfilter avformat swscale" -avplay_deps="avcodec avformat swscale sdl" -avplay_select="rdft" -avprobe_deps="avcodec avformat" -avserver_deps="avformat ffm_muxer fork rtp_protocol rtsp_demuxer !shared" -avserver_extralibs='$ldl' +ffplay_deps="avcodec avformat swscale swresample sdl" +ffplay_select="buffersink_filter rdft" +ffprobe_deps="avcodec avformat" +ffserver_deps="avformat ffm_muxer fork rtp_protocol rtsp_demuxer" +ffserver_extralibs='$ldl' +ffmpeg_deps="avcodec avfilter avformat swscale swresample" +ffmpeg_select="buffersink_filter" doc_deps="texi2html" @@ -1625,11 +1789,11 @@ test_deps _muxer _demuxer \ gxf \ matroska=mkv \ mmf \ - mov \ + mov="mov ismv" \ pcm_mulaw=mulaw \ mxf="mxf mxf_d10" \ nut \ - ogg \ + ogg="ogg ogg_vp3" \ rawvideo=pixfmt \ rm \ swf \ @@ -1639,7 +1803,19 @@ test_deps _muxer _demuxer \ yuv4mpegpipe=yuv4mpeg \ ac3_fixed_test_deps="ac3_fixed_encoder ac3_decoder" +colormatrix1_test_deps="colormatrix_filter" +colormatrix2_test_deps="colormatrix_filter" +flashsv2_test_deps="zlib" mpg_test_deps="mpeg1system_muxer mpegps_demuxer" +mpng_test_deps="zlib" +pp_test_deps="mp_filter" +pp2_test_deps="mp_filter" +pp3_test_deps="mp_filter" +pp4_test_deps="mp_filter" +pp5_test_deps="mp_filter" +pp6_test_deps="mp_filter" +zlib_test_deps="zlib" +zmbv_test_deps="zlib" # default parameters @@ -1648,23 +1824,27 @@ logfile="config.log" # installation paths prefix_default="/usr/local" bindir_default='${prefix}/bin' -datadir_default='${prefix}/share/avconv' +datadir_default='${prefix}/share/ffmpeg' incdir_default='${prefix}/include' libdir_default='${prefix}/lib' mandir_default='${prefix}/share/man' shlibdir_default="$libdir_default" +postproc_version_default="current" # toolchain ar_default="ar" cc_default="gcc" +cxx_default="g++" cc_version=\"unknown\" host_cc_default="gcc" +install="install" ln_s="ln -sf" nm_default="nm" objformat="elf" pkg_config_default=pkg-config ranlib="ranlib" -yasmexe="yasm" +strip_default="strip" +yasmexe_default="yasm" nm_opts='-g' nogas=":" @@ -1677,6 +1857,12 @@ cpu="generic" target_os_default=$(tolower $(uname -s)) host_os=$target_os_default +# alternative libpostproc version +ALT_PP_VER_MAJOR=51 +ALT_PP_VER_MINOR=2 +ALT_PP_VER_MICRO=101 +ALT_PP_VER=$ALT_PP_VER_MAJOR.$ALT_PP_VER_MINOR.$ALT_PP_VER_MICRO + # configurable options enable $PROGRAM_LIST @@ -1685,6 +1871,9 @@ enable avdevice enable avfilter enable avformat enable avutil +enable postproc +enable stripping +enable swresample enable swscale enable asm @@ -1699,7 +1888,7 @@ enable swscale_alpha # build settings SHFLAGS='-shared -Wl,-soname,$$(@F)' -AVSERVERLDFLAGS=-Wl,-E +FFSERVERLDFLAGS=-Wl,-E LIBPREF="lib" LIBSUF=".a" FULLNAME='$(NAME)$(BUILDSUF)' @@ -1715,6 +1904,7 @@ SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)' AS_O='-o $@' CC_O='-o $@' +CXX_O='-o $@' host_cflags='-D_ISOC99_SOURCE -O3 -g' host_libs='-lm' @@ -1741,7 +1931,7 @@ for v in "$@"; do r=${v#*=} l=${v%"$r"} r=$(sh_quote "$r") - LIBAV_CONFIGURATION="${LIBAV_CONFIGURATION# } ${l}${r}" + FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}" done find_things(){ @@ -1783,11 +1973,12 @@ find_tests(){ ACODEC_TESTS=$(find_tests acodec) VCODEC_TESTS=$(find_tests vsynth1) +LAVF_FATE_TESTS=$(find_tests lavf-fate) LAVF_TESTS=$(find_tests lavf) LAVFI_TESTS=$(find_tests lavfi) SEEK_TESTS=$(find_tests seek seek_) -ALL_TESTS="$ACODEC_TESTS $VCODEC_TESTS $LAVF_TESTS $LAVFI_TESTS $SEEK_TESTS" +ALL_TESTS="$ACODEC_TESTS $VCODEC_TESTS $LAVF_FATE_TESTS $LAVF_TESTS $LAVFI_TESTS $SEEK_TESTS" pcm_test_deps=$(map 'echo ${v%_*}_decoder $v' $(filter pcm_* $ENCODER_LIST)) @@ -1869,7 +2060,7 @@ done disabled logging && logfile=/dev/null -echo "# $0 $LIBAV_CONFIGURATION" > $logfile +echo "# $0 $FFMPEG_CONFIGURATION" > $logfile set >> $logfile test -n "$cross_prefix" && enable cross_compile @@ -1879,17 +2070,29 @@ if enabled cross_compile; then die "Must specify target arch and OS when cross-compiling" fi -set_default arch target_os +set_default arch target_os postproc_version + +# Check if we should build alternative libpostproc version instead of current +if test "$postproc_version" = $ALT_PP_VER; then + LIBPOSTPROC_VERSION=$ALT_PP_VER + LIBPOSTPROC_VERSION_MAJOR=$ALT_PP_VER_MAJOR + LIBPOSTPROC_VERSION_MINOR=$ALT_PP_VER_MINOR + LIBPOSTPROC_VERSION_MICRO=$ALT_PP_VER_MICRO +elif test "$postproc_version" != current; then + die "Invalid argument to --postproc-version. See --help output." +fi ar_default="${cross_prefix}${ar_default}" cc_default="${cross_prefix}${cc_default}" +cxx_default="${cross_prefix}${cxx_default}" nm_default="${cross_prefix}${nm_default}" pkg_config_default="${cross_prefix}${pkg_config_default}" ranlib="${cross_prefix}${ranlib}" +strip_default="${cross_prefix}${strip_default}" sysinclude_default="${sysroot}/usr/include" -set_default cc nm pkg_config sysinclude +set_default cc cxx nm pkg_config strip sysinclude yasmexe enabled cross_compile || host_cc_default=$cc set_default host_cc @@ -1932,6 +2135,7 @@ trap 'rm -f -- $TMPFILES' EXIT tmpfile TMPASM .asm tmpfile TMPC .c +tmpfile TMPCPP .cpp tmpfile TMPE $EXESUF tmpfile TMPH .h tmpfile TMPO .o @@ -2166,9 +2370,11 @@ test -n "$cc_type" && enable $cc_type || set_default ar as dep_cc ld test -n "$CC_DEPFLAGS" || CCDEP=$DEPEND_CMD +test -n "$CXX_DEPFLAGS" || CXXDEP=$DEPEND_CMD test -n "$AS_DEPFLAGS" || ASDEP=$DEPEND_CMD add_cflags $extra_cflags +add_cxxflags $extra_cxxflags add_asflags $extra_cflags if test -n "$sysroot"; then @@ -2206,7 +2412,7 @@ fi # Deal with common $arch aliases case "$arch" in - arm*) + arm*|iPad*) arch="arm" ;; mips|mipsel|IP*) @@ -2223,12 +2429,8 @@ case "$arch" in arch="parisc" subarch="parisc64" ;; - "Power Macintosh"|ppc|powerpc) - arch="ppc" - ;; - ppc64|powerpc64) + "Power Macintosh"|ppc|powerpc|ppc64|powerpc64) arch="ppc" - subarch="ppc64" ;; s390|s390x) arch="s390" @@ -2240,7 +2442,7 @@ case "$arch" in arch="sparc" subarch="sparc64" ;; - i[3-6]86|i86pc|BePC|x86pc|x86_64|amd64) + i[3-6]86|i86pc|BePC|x86pc|x86_64|x86_32|amd64) arch="x86" ;; esac @@ -2403,6 +2605,7 @@ if test "$?" != 0; then fi add_cppflags -D_ISOC99_SOURCE +add_cxxflags -D__STDC_CONSTANT_MACROS check_cflags -std=c99 check_cc -D_FILE_OFFSET_BITS=64 < @@ -2427,6 +2630,11 @@ EOF spic=$shared fi ;; + ppc) + check_cc < 3) \ @@ -2558,12 +2767,13 @@ case $target_os in ranlib="echo ignoring ranlib" ;; os/2*) + strip="lxlite -CS" ln_s="cp -f" objformat="aout" add_cppflags -D_GNU_SOURCE add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf' - AVSERVERLDFLAGS="" + FFSERVERLDFLAGS="" LIBSUF="_s.a" SLIBPREF="" SLIBSUF=".dll" @@ -2579,6 +2789,7 @@ case $target_os in emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;' SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib' enable dos_paths + enable_weak os2threads ;; gnu/kfreebsd) add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE @@ -2613,7 +2824,7 @@ esc(){ echo "$*" | sed 's/%/%25/g;s/:/%3a/g' } -echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $LIBAV_CONFIGURATION)" >config.fate +echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $FFMPEG_CONFIGURATION)" >config.fate check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic @@ -2635,11 +2846,13 @@ die_license_disabled() { } die_license_disabled gpl libcdio +die_license_disabled gpl libutvideo die_license_disabled gpl libx264 die_license_disabled gpl libxavs die_license_disabled gpl libxvid die_license_disabled gpl x11grab +die_license_disabled nonfree libaacplus die_license_disabled nonfree libfaac die_license_disabled nonfree openssl @@ -2705,7 +2918,7 @@ elif enabled arm; then elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then case "${cross_prefix:-$cc}" in *hardfloat*) enable vfp_args; fpabi=vfp ;; - *) check_ld <= 2.0.0" aacplus.h aacplusEncOpen -laacplus +enabled libass && require_pkg_config libass ass/ass.h ass_library_init +enabled libbluray && require libbluray libbluray/bluray.h bd_open -lbluray +enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 && + { check_lib celt/celt.h celt_decoder_create_custom -lcelt0 || + die "ERROR: libcelt version must be >= 0.11.0."; } enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac enabled libfreetype && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType enabled libgsm && require libgsm gsm/gsm.h gsm_create -lgsm +enabled libmodplug && require libmodplug libmodplug/modplug.h ModPlug_Load -lmodplug enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame enabled libnut && require libnut libnut.h nut_demuxer_init -lnut enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb -enabled libopencv && require_pkg_config opencv opencv/cv.h cvCreateImageHeader +enabled libopencv && require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg enabled libpulse && require_pkg_config libpulse-simple pulse/simple.h pa_simple_new enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex +enabled libstagefright_h264 && require_cpp libstagefright_h264 "binder/ProcessState.h media/stagefright/MetaData.h + media/stagefright/MediaBufferGroup.h media/stagefright/MediaDebug.h media/stagefright/MediaDefs.h + media/stagefright/OMXClient.h media/stagefright/OMXCodec.h" android::OMXClient -lstagefright -lmedia -lutils -lbinder -lgnustl_static enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg +enabled libutvideo && require_cpp utvideo "stdint.h stdlib.h utvideo/utvideo.h utvideo/Codec.h" 'CCodec*' -lutvideo -lstdc++ +enabled libv4l2 && require_pkg_config libv4l2 libv4l2.h v4l2_ioctl enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg enabled libvpx && { enabled libvpx_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx || die "ERROR: libvpx decoder version must be >=0.9.1"; } - enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_enc_init_ver -lvpx || - die "ERROR: libvpx encoder version must be >=0.9.1"; } } + enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_CQ" -lvpx || + die "ERROR: libvpx encoder version must be >=0.9.6"; } } enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 && { check_cpp_condition x264.h "X264_BUILD >= 118" || die "ERROR: libx264 version must be >= 0.118."; } enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore +enabled openal && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do + check_lib 'AL/al.h' alGetError "${al_libs}" && break; done } || + die "ERROR: openal not found"; } && + { check_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" || + die "ERROR: openal version must be 1.1 or compatible"; } enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto || check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 || check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 || @@ -3001,15 +3249,28 @@ if enabled libdc1394; then die "ERROR: No version of libdc1394 found " fi +SDL_CONFIG="${cross_prefix}sdl-config" if check_pkg_config sdl SDL_events.h SDL_PollEvent; then check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags && enable sdl && check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size +else + if "${SDL_CONFIG}" --version > /dev/null 2>&1; then + sdl_cflags=$("${SDL_CONFIG}" --cflags) + sdl_libs=$("${SDL_CONFIG}" --libs) + check_func_headers SDL_version.h SDL_Linked_Version $sdl_cflags $sdl_libs && + check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags && + enable sdl && + check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size + fi fi +enabled sdl && add_cflags $sdl_cflags && add_extralibs $sdl_libs texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html +makeinfo --version > /dev/null 2>&1 && enable makeinfo || disable makeinfo check_header linux/fb.h +check_header linux/videodev.h check_header linux/videodev2.h check_struct linux/videodev2.h "struct v4l2_frmivalenum" discrete @@ -3020,6 +3281,8 @@ check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extra # w32api 3.12 had it defined wrong check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines +check_type "dshow.h" IBaseFilter + # check for ioctl_meteor.h, ioctl_bt848.h and alternatives { check_header dev/bktr/ioctl_meteor.h && check_header dev/bktr/ioctl_bt848.h; } || @@ -3030,12 +3293,19 @@ check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_def check_header dev/ic/bt8xx.h check_header sndio.h -check_header sys/soundcard.h +if check_struct sys/soundcard.h audio_buf_info bytes; then + enable_safe sys/soundcard.h +else + check_cc -D__BSD_VISIBLE -D__XSI_VISIBLE < + audio_buf_info abc; +EOF +fi check_header soundcard.h enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound -enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack +enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack && check_func sem_timedwait enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio @@ -3047,9 +3317,11 @@ require X11 X11/Xlib.h XOpenDisplay -lX11 && require Xext X11/extensions/XShm.h XShmCreateImage -lXext && require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes -# check for VDA header -if ! disabled vda && check_header VideoDecodeAcceleration/VDADecoder.h; then - enable vda && add_extralibs -framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore +if ! disabled vaapi; then + check_lib va/va.h vaInitialize -lva && { + check_cpp_condition va/va_version.h "VA_CHECK_VERSION(0,32,0)" || + warn "Please upgrade to VA-API >= 0.32 if you would like full VA-API support."; + } || disable vaapi fi if ! disabled vdpau && enabled vdpau_vdpau_h; then @@ -3060,6 +3332,8 @@ check_cpp_condition \ fi enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel" +enabled coverage && add_cflags "-fprofile-arcs -ftest-coverage" && add_ldflags "-fprofile-arcs -ftest-coverage" +test -n "$valgrind" && target_exec="$valgrind --error-exitcode=1 --malloc-fill=0x2a --track-origins=yes --leak-check=full --gen-suppressions=all --suppressions=$source_path/tests/fate-valgrind.supp" # add some useful compiler flags if supported check_cflags -Wdeclaration-after-statement @@ -3071,17 +3345,17 @@ check_cflags -Wdisabled-optimization check_cflags -Wpointer-arith check_cflags -Wredundant-decls check_cflags -Wno-pointer-sign -check_cflags -Wcast-qual check_cflags -Wwrite-strings check_cflags -Wtype-limits check_cflags -Wundef check_cflags -Wmissing-prototypes +check_cflags -Wno-pointer-to-int-cast check_cflags -Wstrict-prototypes enabled extra_warnings && check_cflags -Winline # add some linker flags check_ldflags -Wl,--warn-common -check_ldflags -Wl,-rpath-link=libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil +check_ldflags -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic enabled xmm_clobber_test && \ @@ -3119,6 +3393,10 @@ else fi check_cflags -fno-math-errno check_cflags -fno-signed-zeros +check_cc -mno-red-zone < enable ${lib}_deps_${dep} +# -> add $dep to ${lib}_deps only once +add_dep() { + lib=$1 + dep=$2 + enabled "${lib}_deps_${dep}" && return 0 + enable "${lib}_deps_${dep}" + prepend "${lib}_deps" $dep +} + +# merge deps lib components +# merge all ${component}_deps into ${lib}_deps and ${lib}_deps_* +merge_deps() { + lib=$1 + shift + for comp in $*; do + enabled $comp || continue + eval "dep=\"\$${comp}_deps\"" + for d in $dep; do + add_dep $lib $d + done + done +} + +merge_deps libavfilter $FILTER_LIST + echo "install prefix $prefix" echo "source path $source_path" echo "C compiler $cc" @@ -3194,6 +3503,9 @@ echo "ARCH $arch ($cpu)" if test "$build_suffix" != ""; then echo "build suffix $build_suffix" fi +if test "$progs_suffix" != ""; then + echo "progs suffix $progs_suffix" +fi if test "$extra_version" != ""; then echo "version string suffix $extra_version" fi @@ -3232,10 +3544,12 @@ if enabled sparc; then echo "VIS enabled ${vis-no}" fi echo "debug symbols ${debug-no}" +echo "strip symbols ${stripping-no}" echo "optimize for size ${small-no}" echo "optimizations ${optimizations-no}" echo "static ${static-no}" echo "shared ${shared-no}" +echo "postprocessing support ${postproc-no}" echo "new filter support ${avfilter-no}" echo "network support ${network-no}" echo "threading support ${thread_type-no}" @@ -3247,10 +3561,14 @@ echo "libvdpau enabled ${vdpau-no}" echo "AVISynth enabled ${avisynth-no}" echo "frei0r enabled ${frei0r-no}" echo "gnutls enabled ${gnutls-no}" +echo "libaacplus enabled ${libaacplus-no}" +echo "libass enabled ${libass-no}" echo "libcdio support ${libcdio-no}" +echo "libcelt enabled ${libcelt-no}" echo "libdc1394 support ${libdc1394-no}" echo "libfaac enabled ${libfaac-no}" echo "libgsm enabled ${libgsm-no}" +echo "libmodplug enabled ${libmodplug-no}" echo "libmp3lame enabled ${libmp3lame-no}" echo "libnut enabled ${libnut-no}" echo "libopencore-amrnb support ${libopencore_amrnb-no}" @@ -3261,7 +3579,10 @@ echo "libpulse enabled ${libpulse-no}" echo "librtmp enabled ${librtmp-no}" echo "libschroedinger enabled ${libschroedinger-no}" echo "libspeex enabled ${libspeex-no}" +echo "libstagefright-h264 enabled ${libstagefright_h264-no}" echo "libtheora enabled ${libtheora-no}" +echo "libutvideo enabled ${libutvideo-no}" +echo "libv4l2 enabled ${libv4l2-no}" echo "libvo-aacenc support ${libvo_aacenc-no}" echo "libvo-amrwbenc support ${libvo_amrwbenc-no}" echo "libvorbis enabled ${libvorbis-no}" @@ -3269,6 +3590,7 @@ echo "libvpx enabled ${libvpx-no}" echo "libx264 enabled ${libx264-no}" echo "libxavs enabled ${libxavs-no}" echo "libxvid enabled ${libxvid-no}" +echo "openal enabled ${openal-no}" echo "openssl enabled ${openssl-no}" echo "zlib enabled ${zlib-no}" echo "bzlib enabled ${bzlib-no}" @@ -3298,11 +3620,15 @@ echo "Creating config.mak and config.h..." test -e Makefile || $ln_s "$source_path/Makefile" . +enabled stripping || strip="echo skipping strip" + config_files="$TMPH config.mak" cat > config.mak <> config.mak eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak @@ -3386,14 +3725,17 @@ get_version LIBAVDEVICE libavdevice/avdevice.h get_version LIBAVFILTER libavfilter/version.h get_version LIBAVFORMAT libavformat/version.h get_version LIBAVUTIL libavutil/avutil.h +get_version LIBPOSTPROC libpostproc/postprocess.h +get_version LIBSWRESAMPLE libswresample/swresample.h get_version LIBSWSCALE libswscale/swscale.h cat > $TMPH < $TMPH <>$TMPH + test -n "$malloc_prefix" && echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH @@ -3429,12 +3774,14 @@ print_config CONFIG_ "$config_files" $CONFIG_LIST \ cat >>config.mak <> $TMPH +echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH +echo "endif # FFMPEG_CONFIG_MAK" >> config.mak # Do not overwrite an unchanged config.h to avoid superfluous rebuilds. cp_if_changed $TMPH config.h @@ -3448,6 +3795,12 @@ cat > $TMPH <> $TMPH <> $TMPH @@ -3499,9 +3852,22 @@ Cflags: -I\${includedir} EOF } -pkgconfig_generate libavutil "Libav utility library" "$LIBAVUTIL_VERSION" "$LIBM" -pkgconfig_generate libavcodec "Libav codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION" -pkgconfig_generate libavformat "Libav container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION" -pkgconfig_generate libavdevice "Libav device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION" -pkgconfig_generate libavfilter "Libav video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" -pkgconfig_generate libswscale "Libav image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION" +libavfilter_pc_deps="" +enabled libavfilter_deps_avcodec && prepend libavfilter_pc_deps "libavcodec = $LIBAVCODEC_VERSION," +enabled libavfilter_deps_avformat && prepend libavfilter_pc_deps "libavformat = $LIBAVFORMAT_VERSION," +enabled libavfilter_deps_swscale && prepend libavfilter_pc_deps "libswscale = $LIBSWSCALE_VERSION," +enabled libavfilter_deps_swresample && prepend libavfilter_pc_deps "libswresample = $LIBSWRESAMPLE_VERSION," +enabled libavfilter_deps_postproc && prepend libavfilter_pc_deps "libpostproc = $LIBPOSTPROC_VERSION," +libavfilter_pc_deps=${libavfilter_pc_deps%, } + +libavdevice_pc_deps="libavformat = $LIBAVFORMAT_VERSION" +enabled lavfi_indev && prepend libavdevice_pc_deps "libavfilter = $LIBAVFILTER_VERSION," + +pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" "$LIBM" +pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION" +pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION" +pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "$libavdevice_pc_deps" +pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$libavfilter_pc_deps" +pkgconfig_generate libpostproc "FFmpeg postprocessing library" "$LIBPOSTPROC_VERSION" "" "libavutil = $LIBAVUTIL_VERSION" +pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION" +pkgconfig_generate libswresample "FFmpeg audio rescaling library" "$LIBSWRESAMPLE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION" diff --git a/doc/APIchanges b/doc/APIchanges index fed77b0eb58..a0b786d79e4 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -6,12 +6,22 @@ libavcodec: 2012-01-27 libavdevice: 2011-04-18 libavfilter: 2011-04-18 libavformat: 2012-01-27 +libpostproc: 2011-04-18 libswscale: 2011-06-20 libavutil: 2011-04-18 API changes, most recent first: +2012-04-20 - xxxxxxx - lavfi 2.70.100 + Add avfilter_unref_bufferp() to avfilter.h. + +2012-04-12 - xxxxxxx - lavfi 2.68.100 + Install libavfilter/asrc_abuffer.h public header. + +2012-03-26 - a67d9cf - lavfi 2.66.100 + Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions. + 2012-xx-xx - xxxxxxx - lavu 51.28.0 - audio_fifo.h Add audio FIFO functions: av_audio_fifo_free() @@ -25,17 +35,35 @@ API changes, most recent first: av_audio_fifo_space() 2012-xx-xx - xxxxxxx - lavfi 2.16.0 - avfiltergraph.h - Add avfilter_graph_parse2(), avfilter_inout_alloc() and - avfilter_inout_free() functions. + Add avfilter_graph_parse2() 2012-xx-xx - xxxxxxx - lavu 51.27.0 - samplefmt.h Add av_get_packed_sample_fmt() and av_get_planar_sample_fmt() -2012-xx-xx - xxxxxxx - lavu 51.26.0 - audioconvert.h - Add av_get_default_channel_layout() +2012-03-21 - b75c67d - lavu 51.43.100 + Add bprint.h for bprint API. + +2012-02-21 - 9cbf17e - lavc 54.4.100 + Add av_get_pcm_codec() function. + +2012-02-16 - 560b224 - libswr 0.7.100 + Add swr_set_matrix() function. -2012-03-06 - 4d851f8 - lavu 51.25.0 - cpu.h - Add av_set_cpu_flags_mask(). +2012-02-09 - c28e7af - lavu 51.39.100 + Add a new installed header libavutil/timestamp.h with timestamp + utilities. + +2012-02-06 - 70ffda3 - lavu 51.38.100 + Add av_parse_ratio() function to parseutils.h. + +2012-02-06 - 70ffda3 - lavu 51.38.100 + Add AV_LOG_MAX_OFFSET macro to log.h. + +2012-02-02 - 0eaa123 - lavu 51.37.100 + Add public timecode helpers. + +2012-01-24 - 0c3577b - lavfi 2.60.100 + Add avfilter_graph_dump. 2012-03-05 - lavc 54.8.0 6699d07 Add av_get_exact_bits_per_sample() @@ -91,10 +119,6 @@ API changes, most recent first: muxers supporting it (av_write_frame makes sure it is called only for muxers with this flag). -------------------------------8<------------------------------------- - 0.8 branch was cut here ------------------------------>8-------------------------------------- - 2012-01-15 - lavc 53.34.0 New audio encoding API: b2c75b6 Add CODEC_CAP_VARIABLE_FRAME_SIZE capability for use by audio @@ -106,22 +130,26 @@ API changes, most recent first: 2012-01-12 - 3167dc9 - lavfi 2.15.0 Add a new installed header -- libavfilter/version.h -- with version macros. -2011-01-03 - b73ec05 - lavu 51.21.0 - Add av_popcount64 +2011-12-08 - a502939 - lavfi 2.52.0 + Add av_buffersink_poll_frame() to buffersink.h. + +2011-12-08 - 26c6fec - lavu 51.31.0 + Add av_log_format_line. + +2011-12-03 - 976b095 - lavu 51.30.0 + Add AVERROR_BUG. + +2011-11-24 - 573ffbb - lavu 51.28.1 + Add av_get_alt_sample_fmt() to samplefmt.h. + +2011-11-03 - 96949da - lavu 51.23.0 + Add av_strcasecmp() and av_strncasecmp() to avstring.h. -2011-12-25 - lavfi 2.14.0 - e1d9dbf Add a new installed header - buffersrc.h - It contains a new function av_buffersrc_buffer() that allows passing - frames to the 'buffer' filter, but unlike av_vsrc_buffer_add_frame() - it allows for direct rendering. - 1c9e340 Add avfilter_copy_frame_props() for copying properties from - AVFrame to AVFilterBufferRef. +2011-10-20 - b35e9e1 - lavu 51.22.0 + Add av_strtok() to avstring.h. -2011-12-25 - lavc 53.31.0 - Add the following new fields to AVFrame: - b58dbb5 sample_aspect_ratio - 3a2ddf7 width, height - 8a4a5f6 format +2011-01-03 - b73ec05 - lavu 51.21.0 + Add av_popcount64 2011-12-18 - 8400b12 - lavc 53.28.1 Deprecate AVFrame.age. The field is unused. @@ -209,49 +237,134 @@ API changes, most recent first: - 641c7af new functions - av_opt_child_next, av_opt_child_class_next and av_opt_find2() -2011-09-03 - fb4ca26 - lavc 53.10.0 - lavf 53.6.0 +2011-09-22 - a70e787 - lavu 51.17.0 + Add av_x_if_null(). + +2011-09-18 - 645cebb - lavc 53.16.0 + Add showall flag2 + +2011-09-16 - ea8de10 - lavfi 2.42.0 + Add avfilter_all_channel_layouts. + +2011-09-16 - 9899037 - lavfi 2.41.0 + Rename avfilter_all_* function names to avfilter_make_all_*. + + In particular, apply the renames: + avfilter_all_formats -> avfilter_make_all_formats + avfilter_all_channel_layouts -> avfilter_make_all_channel_layouts + avfilter_all_packing_formats -> avfilter_make_all_packing_formats + +2011-09-12 - 4381bdd - lavfi 2.40.0 + Change AVFilterBufferRefAudioProps.sample_rate type from uint32_t to int. + +2011-09-12 - 2c03174 - lavfi 2.40.0 + Simplify signature for avfilter_get_audio_buffer(), make it + consistent with avfilter_get_video_buffer(). + +2011-09-06 - 4f7dfe1 - lavfi 2.39.0 + Rename libavfilter/vsink_buffer.h to libavfilter/buffersink.h. + +2011-09-06 - c4415f6 - lavfi 2.38.0 + Unify video and audio sink API. + + In particular, add av_buffersink_get_buffer_ref(), deprecate + av_vsink_buffer_get_video_buffer_ref() and change the value for the + opaque field passed to the abuffersink init function. + +2011-09-04 - 61e2e29 - lavu 51.16.0 + Add av_asprintf(). + +2011-08-22 - dacd827 - lavf 53.10.0 + Add av_find_program_from_stream(). + +2011-08-20 - 69e2c1a - lavu 51.13.0 + Add av_get_media_type_string(). + +2011-09-03 - fb4ca26 - lavc 53.13.0 + lavf 53.11.0 lsws 2.1.0 Add {avcodec,avformat,sws}_get_class(). -2011-09-03 - c11fb82 - lavu 51.10.0 +2011-08-03 - c11fb82 - lavu 51.15.0 Add AV_OPT_SEARCH_FAKE_OBJ flag for av_opt_find() function. +2011-08-14 - 323b930 - lavu 51.12.0 + Add av_fifo_peek2(), deprecate av_fifo_peek(). + 2011-08-26 - lavu 51.9.0 - - f2011ed Add av_fifo_peek2(), deprecate av_fifo_peek(). - add41de..abc78a5 Do not include intfloat_readwrite.h, mathematics.h, rational.h, pixfmt.h, or log.h from avutil.h. -2011-08-16 - 48f9e45 - lavf 53.4.0 +2011-08-16 - 48f9e45 - lavf 53.8.0 Add avformat_query_codec(). -2011-08-16 - bca06e7 - lavc 53.8.0 +2011-08-16 - bca06e7 - lavc 53.11.0 Add avcodec_get_type(). -2011-08-06 - 2f63440 - lavf 53.4.0 +2011-08-06 - 2f63440 - lavf 53.7.0 Add error_recognition to AVFormatContext. -2011-08-02 - 9d39cbf - lavc 53.7.1 +2011-08-02 - 9d39cbf - lavc 53.9.1 Add AV_PKT_FLAG_CORRUPT AVPacket flag. -2011-07-10 - a67c061 - lavf 53.3.0 +2011-07-16 - b57df29 - lavfi 2.27.0 + Add audio packing negotiation fields and helper functions. + + In particular, add AVFilterPacking enum, planar, in_packings and + out_packings fields to AVFilterLink, and the functions: + avfilter_set_common_packing_formats() + avfilter_all_packing_formats() + +2011-07-10 - a67c061 - lavf 53.6.0 Add avformat_find_stream_info(), deprecate av_find_stream_info(). NOTE: this was backported to 0.7 -2011-07-10 - 0b950fe - lavc 53.6.0 +2011-07-10 - 0b950fe - lavc 53.8.0 Add avcodec_open2(), deprecate avcodec_open(). NOTE: this was backported to 0.7 Add avcodec_alloc_context3. Deprecate avcodec_alloc_context() and avcodec_alloc_context2(). +2011-07-01 - b442ca6 - lavf 53.5.0 - avformat.h + Add function av_get_output_timestamp(). + +2011-06-28 - 5129336 - lavu 51.11.0 - avutil.h + Define the AV_PICTURE_TYPE_NONE value in AVPictureType enum. + +2011-06-19 - fd2c0a5 - lavfi 2.23.0 - avfilter.h + Add layout negotiation fields and helper functions. + + In particular, add in_chlayouts and out_chlayouts to AVFilterLink, + and the functions: + avfilter_set_common_sample_formats() + avfilter_set_common_channel_layouts() + avfilter_all_channel_layouts() + +2011-06-19 - 527ca39 - lavfi 2.22.0 - AVFilterFormats + Change type of AVFilterFormats.formats from int * to int64_t *, + and update formats handling API accordingly. + + avfilter_make_format_list() still takes a int32_t array and converts + it to int64_t. A new function, avfilter_make_format64_list(), that + takes int64_t arrays has been added. + +2011-06-19 - 44f669e - lavfi 2.21.0 - vsink_buffer.h + Add video sink buffer and vsink_buffer.h public header. + +2011-06-12 - 9fdf772 - lavfi 2.18.0 - avcodec.h + Add avfilter_get_video_buffer_ref_from_frame() function in + libavfilter/avcodec.h. + +2011-06-12 - c535494 - lavfi 2.17.0 - avfiltergraph.h + Add avfilter_inout_alloc() and avfilter_inout_free() functions. + +2011-06-12 - 6119b23 - lavfi 2.16.0 - avfilter_graph_parse() + Change avfilter_graph_parse() signature. + 2011-06-23 - 67e9ae1 - lavu 51.8.0 - attributes.h Add av_printf_format(). -------------------------------8<------------------------------------- - 0.7 branch was cut here ------------------------------>8-------------------------------------- - 2011-06-16 - 05e84c9, 25de595 - lavf 53.2.0 - avformat.h Add avformat_open_input and avformat_write_header(). Deprecate av_open_input_stream, av_open_input_file, @@ -265,34 +378,97 @@ API changes, most recent first: 2011-06-10 - cb7c11c - lavu 51.6.0 - opt.h Add av_opt_flag_is_set(). -2011-06-08 - d9f80ea - lavu 51.5.0 - AVMetadata +2011-06-10 - c381960 - lavfi 2.15.0 - avfilter_get_audio_buffer_ref_from_arrays + Add avfilter_get_audio_buffer_ref_from_arrays() to avfilter.h. + +2011-06-09 - d9f80ea - lavu 51.8.0 - AVMetadata Move AVMetadata from lavf to lavu and rename it to AVDictionary -- new installed header dict.h. All av_metadata_* functions renamed to av_dict_*. -2011-06-07 - a6703fa - lavu 51.4.0 - av_get_bytes_per_sample() +2011-06-07 - a6703fa - lavu 51.8.0 - av_get_bytes_per_sample() Add av_get_bytes_per_sample() in libavutil/samplefmt.h. Deprecate av_get_bits_per_sample_fmt(). -2011-06-05 - b39b062 - lavu 51.3.0 - opt.h +2011-06-05 - b39b062 - lavu 51.8.0 - opt.h Add av_opt_free convenience function. -2011-05-28 - 0420bd7 - lavu 51.2.0 - pixdesc.h +2011-06-06 - 95a0242 - lavfi 2.14.0 - AVFilterBufferRefAudioProps + Remove AVFilterBufferRefAudioProps.size, and use nb_samples in + avfilter_get_audio_buffer() and avfilter_default_get_audio_buffer() in + place of size. + +2011-06-06 - 0bc2cca - lavu 51.6.0 - av_samples_alloc() + Switch nb_channels and nb_samples parameters order in + av_samples_alloc(). + +2011-06-06 - e1c7414 - lavu 51.5.0 - av_samples_* + Change the data layout created by av_samples_fill_arrays() and + av_samples_alloc(). + +2011-06-06 - 27bcf55 - lavfi 2.13.0 - vsrc_buffer.h + Make av_vsrc_buffer_add_video_buffer_ref() accepts an additional + flags parameter in input. + +2011-06-03 - e977ca2 - lavfi 2.12.0 - avfilter_link_free() + Add avfilter_link_free() function. + +2011-06-02 - 5ad38d9 - lavu 51.4.0 - av_force_cpu_flags() + Add av_cpu_flags() in libavutil/cpu.h. + +2011-05-28 - e71f260 - lavu 51.3.0 - pixdesc.h Add av_get_pix_fmt_name() in libavutil/pixdesc.h, and deprecate avcodec_get_pix_fmt_name() in libavcodec/avcodec.h in its favor. -2011-05-25 - 30315a8 - lavf 53.1.0 - avformat.h +2011-05-25 - 30315a8 - lavf 53.3.0 - avformat.h Add fps_probe_size to AVFormatContext. -2011-05-18 - 64150ff - lavc 53.4.0 - AVCodecContext.request_sample_fmt +2011-05-22 - 5ecdfd0 - lavf 53.2.0 - avformat.h + Introduce avformat_alloc_output_context2() and deprecate + avformat_alloc_output_context(). + +2011-05-22 - 83db719 - lavfi 2.10.0 - vsrc_buffer.h + Make libavfilter/vsrc_buffer.h public. + +2011-05-19 - c000a9f - lavfi 2.8.0 - avcodec.h + Add av_vsrc_buffer_add_frame() to libavfilter/avcodec.h. + +2011-05-14 - 9fdf772 - lavfi 2.6.0 - avcodec.h + Add avfilter_get_video_buffer_ref_from_frame() to libavfilter/avcodec.h. + +2011-05-18 - 64150ff - lavc 53.7.0 - AVCodecContext.request_sample_fmt Add request_sample_fmt field to AVCodecContext. -2011-05-10 - 188dea1 - lavc 53.3.0 - avcodec.h +2011-05-10 - 188dea1 - lavc 53.6.0 - avcodec.h Deprecate AVLPCType and the following fields in AVCodecContext: lpc_coeff_precision, prediction_order_method, min_partition_order, max_partition_order, lpc_type, lpc_passes. Corresponding FLAC encoder options should be used instead. +2011-05-07 - 9fdf772 - lavfi 2.5.0 - avcodec.h + Add libavfilter/avcodec.h header and avfilter_copy_frame_props() + function. + +2011-05-07 - 18ded93 - lavc 53.5.0 - AVFrame + Add format field to AVFrame. + +2011-05-07 - 22333a6 - lavc 53.4.0 - AVFrame + Add width and height fields to AVFrame. + +2011-05-01 - 35fe66a - lavfi 2.4.0 - avfilter.h + Rename AVFilterBufferRefVideoProps.pixel_aspect to + sample_aspect_ratio. + +2011-05-01 - 77e9dee - lavc 53.3.0 - AVFrame + Add a sample_aspect_ratio field to AVFrame. + +2011-05-01 - 1ba5727 - lavc 53.2.0 - AVFrame + Add a pkt_pos field to AVFrame. + +2011-04-29 - 35ceaa7 - lavu 51.2.0 - mem.h + Add av_dynarray_add function for adding + an element to a dynamic array. + 2011-04-26 - bebe72f - lavu 51.1.0 - avutil.h Add AVPictureType enum and av_get_picture_type_char(), deprecate FF_*_TYPE defines and av_get_pict_type_char() defined in @@ -344,9 +520,6 @@ API changes, most recent first: 333e894 deprecate url_open_protocol e230705 deprecate url_poll and URLPollEntry -2011-04-10 - lavu 50.40.0 - pixfmt.h - Add PIX_FMT_BGR48LE and PIX_FMT_BGR48BE pixel formats - 2011-04-08 - lavf 52.106.0 - avformat.h Minor avformat.h cleanup: a9bf9d8 deprecate av_guess_image2_codec @@ -371,7 +544,6 @@ API changes, most recent first: d9d86e0 rename url_fprintf -> avio_printf 59f65d9 deprecate url_setbufsize 3e68b3b deprecate url_ferror - 66e5b1d deprecate url_feof e8bb2e2 deprecate url_fget_max_packet_size 76aa876 rename url_fsize -> avio_size e519753 deprecate url_fgetc @@ -395,6 +567,9 @@ API changes, most recent first: 2011-03-25 - 34b47d7 - lavc 52.115.0 - AVCodecContext.audio_service_type Add audio_service_type field to AVCodecContext. +2011-03-17 - e309fdc - lavu 50.40.0 - pixfmt.h + Add PIX_FMT_BGR48LE and PIX_FMT_BGR48BE pixel formats + 2011-03-02 - 863c471 - lavf 52.103.0 - av_pkt_dump2, av_pkt_dump_log2 Add new functions av_pkt_dump2, av_pkt_dump_log2 that uses the source stream timebase for outputting timestamps. Deprecate @@ -461,6 +636,12 @@ API changes, most recent first: 2011-02-02 - dfd2a00 - lavu 50.37.0 - log.h Make av_dlog public. +2011-01-31 - 7b3ea55 - lavfi 1.76.0 - vsrc_buffer + Add sample_aspect_ratio fields to vsrc_buffer arguments + +2011-01-31 - 910b5b8 - lavfi 1.75.0 - AVFilterLink sample_aspect_ratio + Add sample_aspect_ratio field to AVFilterLink. + 2011-01-15 - a242ac3 - lavfi 1.74.0 - AVFilterBufferRefAudioProps Rename AVFilterBufferRefAudioProps.samples_nb to nb_samples. diff --git a/doc/Makefile b/doc/Makefile index 15e7323acc5..a97218240b6 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -9,13 +9,24 @@ HTMLPAGES = $(PROGS-yes:%=doc/%.html) \ doc/libavfilter.html \ doc/platform.html \ +TXTPAGES = doc/fate.txt \ + + DOCS = $(HTMLPAGES) $(MANPAGES) $(PODPAGES) +ifdef HAVE_MAKEINFO +DOCS += $(TXTPAGES) +endif all-$(CONFIG_DOC): documentation documentation: $(DOCS) -TEXIDEP = awk '/^@include/ { printf "$@: $(@D)/%s\n", $$2 }' <$< >$(@:%=%.d) +TEXIDEP = awk '/^@(verbatim)?include/ { printf "$@: $(@D)/%s\n", $$2 }' <$< >$(@:%=%.d) + +doc/%.txt: TAG = TXT +doc/%.txt: doc/%.texi + $(Q)$(TEXIDEP) + $(M)makeinfo --force --no-headers -o $@ $< 2>/dev/null doc/print_options.o: libavformat/options_table.h libavcodec/options_table.h @@ -54,7 +65,7 @@ uninstall-man: $(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES)) clean:: - $(RM) doc/*.html doc/*.pod doc/*.1 $(CLEANSUFFIXES:%=doc/%) doc/avoptions_*.texi + $(RM) $(TXTPAGES) doc/*.html doc/*.pod doc/*.1 $(CLEANSUFFIXES:%=doc/%) doc/avoptions_*.texi -include $(wildcard $(DOCS:%=%.d)) diff --git a/doc/RELEASE_NOTES b/doc/RELEASE_NOTES index 8c642b9e4df..ccaa4e4d3c9 100644 --- a/doc/RELEASE_NOTES +++ b/doc/RELEASE_NOTES @@ -1,37 +1,21 @@ Release Notes ============= -* 0.8 "Forbidden Fruit" +* 0.10 "Freedom" January, 2012 + General notes ------------- +This release is binary compatible with 0.8 and 0.9. -This release continues the API cleanups that have begun with the -previous release. While it is binary compatible with 0.7, many parts of -the public API were deprecated and will be removed in the git master and -later releases. Please consult the doc/APIchanges file to see -intended replacements for the deprecated APIs. - -Furthermore, our work on the 'ffmpeg' command-line tool has resulted in -major revisions to its interface. In order to not break existing scripts -and applications, we have chosen to introduce a new tool called -'avconv', and keep the traditional 'ffmpeg' frontend for end-user's -convenience. Please see the Changelog file for details how 'avconv' -differs from 'ffmpeg'. - -Additionally, this release introduces a number of new interesting codecs -such as the Apple Prores, Flash Screen Video 2 and Windows Media Image, -and muxers such as LATM or CELT in Ogg, among many others. Moreover, our -H.264 decoder has been improved to decode 4:2:2 material and our libx264 -wrapper now allows to produce 4:2:2 and 4:4:4 video. +See the Changelog file for a list of significant changes. Note, there +are many more new features and bugfixes than whats listed there. -See the Changelog file for a list of significant changes. - -Please note that our policy on bug reports has not changed. We still only accept -bug reports against HEAD of the Libav trunk repository. If you are experiencing -issues with any formally released version of Libav, please try a current version -of the development code to check if the issue still exists. If it does, make your -report against the development code following the usual bug reporting guidelines. +Bugreports against FFmpeg git master or the most recent FFmpeg release are +accepted. If you are experiencing issues with any formally released version of +FFmpeg, please try git master to check if the issue still exists. If it does, +make your report against the development code following the usual bug reporting +guidelines. API changes @@ -47,24 +31,7 @@ is able to use AVCodecContext.get_buffer() in the similar way as video decoding. * new audio encoding API which encodes from an AVFrame to an AVPacket, thus allowing it to properly output timing information and side data. -* rewritten AVOptions API with better built-in support for private options. - -* private options support for demuxers [avformat_open_input()], muxers -[avformat_write_header()], encoders and decoders [avcodec_open2()]. -As a result, many format- or codec-specific fields and flags in AVFormatContext -and AVCodecContext were deprecated -- notably most of CODEC_FLAG2_* and many -CODEC_FLAG_*. - -* new API for custom IO interrupt callbacks. - -* #include cleanup in libavutil -- libavutil/avutil.h no longer includes all -the other headers in libavutil, they must be included manually. One specific -result is that libavutil/mathematics.h is no longer included from -libavcodec/avcodec.h, which is a common source of errors. - -Please see the file doc/APIchanges for details along with -similar programmer-centric information. - +Please see the git history and the file doc/APIchanges for details. Other notable changes @@ -75,8 +42,8 @@ symbols. This will break applications using those symbols. Possible solutions are, in order of preference: 1) Try finding a way of accomplishing the same with public API. 2) If there is no corresponding public API, but you think there should be, -post a request on the user mailing list or IRC channel. -3) Finally if your program needs access to Libav internals for some special -reason then the best solution is to link statically. +post a request on the developer mailing list or IRC channel. +3) Finally if your program needs access to FFmpeg / libavcodec / libavformat +internals for some special reason then the best solution is to link statically. -Please see the Changelog file for a more detailed list of changes. +Please see the Changelog file and git history for a more detailed list of changes. diff --git a/doc/avprobe.texi b/doc/avprobe.texi deleted file mode 100644 index 6b2c800bf1d..00000000000 --- a/doc/avprobe.texi +++ /dev/null @@ -1,134 +0,0 @@ -\input texinfo @c -*- texinfo -*- - -@settitle avprobe Documentation -@titlepage -@center @titlefont{avprobe Documentation} -@end titlepage - -@top - -@contents - -@chapter Synopsis - -The generic syntax is: - -@example -@c man begin SYNOPSIS -avprobe [options] [@file{input_file}] -@c man end -@end example - -@chapter Description -@c man begin DESCRIPTION - -avprobe gathers information from multimedia streams and prints it in -human- and machine-readable fashion. - -For example it can be used to check the format of the container used -by a multimedia stream and the format and type of each media stream -contained in it. - -If a filename is specified in input, avprobe will try to open and -probe the file content. If the file cannot be opened or recognized as -a multimedia file, a positive exit code is returned. - -avprobe may be employed both as a standalone application or in -combination with a textual filter, which may perform more -sophisticated processing, e.g. statistical processing or plotting. - -Options are used to list some of the formats supported by avprobe or -for specifying which information to display, and for setting how -avprobe will show it. - -avprobe output is designed to be easily parsable by a textual filter, -and consists of one or more sections of the form: -@example -[SECTION] -key1=val1 -... -keyN=valN -[/SECTION] -@end example - -Metadata tags stored in the container or in the streams are recognized -and printed in the corresponding "FORMAT" or "STREAM" section, and -are prefixed by the string "TAG:". - -@c man end - -@chapter Options -@c man begin OPTIONS - -@include avtools-common-opts.texi - -@section Main options - -@table @option - -@item -f @var{format} -Force format to use. - -@item -unit -Show the unit of the displayed values. - -@item -prefix -Use SI prefixes for the displayed values. -Unless the "-byte_binary_prefix" option is used all the prefixes -are decimal. - -@item -byte_binary_prefix -Force the use of binary prefixes for byte values. - -@item -sexagesimal -Use sexagesimal format HH:MM:SS.MICROSECONDS for time values. - -@item -pretty -Prettify the format of the displayed values, it corresponds to the -options "-unit -prefix -byte_binary_prefix -sexagesimal". - -@item -show_format -Show information about the container format of the input multimedia -stream. - -All the container format information is printed within a section with -name "FORMAT". - -@item -show_packets -Show information about each packet contained in the input multimedia -stream. - -The information for each single packet is printed within a dedicated -section with name "PACKET". - -@item -show_streams -Show information about each media stream contained in the input -multimedia stream. - -Each media stream information is printed within a dedicated section -with name "STREAM". - -@end table -@c man end - -@include demuxers.texi -@include muxers.texi -@include protocols.texi -@include indevs.texi - -@ignore - -@setfilename avprobe -@settitle avprobe media prober - -@c man begin SEEALSO -avconv(1), avplay(1) and the Libav HTML documentation -@c man end - -@c man begin AUTHORS -The Libav developers -@c man end - -@end ignore - -@bye diff --git a/doc/avtools-common-opts.texi b/doc/avtools-common-opts.texi index 0be9cf06342..c25b535a9d3 100644 --- a/doc/avtools-common-opts.texi +++ b/doc/avtools-common-opts.texi @@ -122,7 +122,26 @@ can be disabled setting the environment variable @env{AV_LOG_FORCE_NOCOLOR} or @env{NO_COLOR}, or can be forced setting the environment variable @env{AV_LOG_FORCE_COLOR}. The use of the environment variable @env{NO_COLOR} is deprecated and -will be dropped in a following Libav version. +will be dropped in a following FFmpeg version. + +@item -report +Dump full command line and console output to a file named +@code{@var{program}-@var{YYYYMMDD}-@var{HHMMSS}.log} in the current +directory. +This file can be useful for bug reports. +It also implies @code{-loglevel verbose}. + +Note: setting the environment variable @code{FFREPORT} to any value has the +same effect. + +@item -cpuflags flags (@emph{global}) +Allows setting and clearing cpu flags. This option is intended +for testing. Do not use it unless you know what you're doing. +@example +ffmpeg -cpuflags -sse+mmx ... +ffmpeg -cpuflags mmx ... +ffmpeg -cpuflags 0 ... +@end example @end table @@ -145,7 +164,7 @@ For example to write an ID3v2.3 header instead of a default ID3v2.4 to an MP3 file, use the @option{id3v2_version} private option of the MP3 muxer: @example -avconv -i input.flac -id3v2_version 3 out.mp3 +ffmpeg -i input.flac -id3v2_version 3 out.mp3 @end example All codec AVOptions are obviously per-stream, so the chapter on stream diff --git a/doc/bitstream_filters.texi b/doc/bitstream_filters.texi index a6fe2f2633e..2ee00c134ba 100644 --- a/doc/bitstream_filters.texi +++ b/doc/bitstream_filters.texi @@ -1,7 +1,7 @@ @chapter Bitstream Filters @c man begin BITSTREAM FILTERS -When you configure your Libav build, all the supported bitstream +When you configure your FFmpeg build, all the supported bitstream filters are enabled by default. You can list all available ones using the configure option @code{--list-bsfs}. @@ -23,6 +23,20 @@ Below is a description of the currently available bitstream filters. @section h264_mp4toannexb +Convert an H.264 bitstream from length prefixed mode to start code +prefixed mode (as defined in the Annex B of the ITU-T H.264 +specification). + +This is required by some streaming formats, typically the MPEG-2 +transport stream format ("mpegts"). + +For example to remux an MP4 file containing an H.264 stream to mpegts +format with @command{ffmpeg}, you can use the command: + +@example +ffmpeg -i INPUT.mp4 -codec copy -bsf:v h264_mp4toannexb OUTPUT.ts +@end example + @section imx_dump_header @section mjpeg2jpeg @@ -34,7 +48,7 @@ JPEG image. The individual frames can be extracted without loss, e.g. by @example -avconv -i ../some_mjpeg.avi -c:v copy frames_%d.jpg +ffmpeg -i ../some_mjpeg.avi -c:v copy frames_%d.jpg @end example Unfortunately, these chunks are incomplete JPEG images, because @@ -57,9 +71,9 @@ stream (carrying the AVI1 header ID and lacking a DHT segment) to produce fully qualified JPEG images. @example -avconv -i mjpeg-movie.avi -c:v copy -bsf:v mjpeg2jpeg frame_%d.jpg +ffmpeg -i mjpeg-movie.avi -c:v copy -bsf:v mjpeg2jpeg frame_%d.jpg exiftran -i -9 frame*.jpg -avconv -i frame_%d.jpg -c:v copy rotated.avi +ffmpeg -i frame_%d.jpg -c:v copy rotated.avi @end example @section mjpega_dump_header diff --git a/doc/build_system.txt b/doc/build_system.txt index c3dede7cde8..36c141e9e43 100644 --- a/doc/build_system.txt +++ b/doc/build_system.txt @@ -1,4 +1,4 @@ -Libav currently uses a custom build system, this text attempts to document +FFmpeg currently uses a custom build system, this text attempts to document some of its obscure features and options. Makefile variables: @@ -9,13 +9,19 @@ V DESTDIR Destination directory for the install targets, useful to prepare packages - or install Libav in cross-environments. + or install FFmpeg in cross-environments. Makefile targets: all Default target, builds all the libraries and the executables. +fate + Run the fate test suite, note you must have installed it + +fate-list + Will list all fate/regression test targets + install Install headers, libraries and programs. @@ -27,3 +33,18 @@ libavcodec/api-example libswscale/swscale-test Build the swscale self-test (useful also as example). + + +Useful standard make commands: +make -t + Touch all files that otherwise would be build, this is useful to reduce + unneeded rebuilding when changing headers, but note you must force rebuilds + of files that actually need it by hand then. + +make -j + rebuild with multiple jobs at the same time. Faster on multi processor systems + +make -k + continue build in case of errors, this is useful for the regression tests + sometimes but note it will still not run all reg tests. + diff --git a/doc/decoders.texi b/doc/decoders.texi new file mode 100644 index 00000000000..87ad4eea26c --- /dev/null +++ b/doc/decoders.texi @@ -0,0 +1,63 @@ +@chapter Decoders +@c man begin DECODERS + +Decoders are configured elements in FFmpeg which allow the decoding of +multimedia streams. + +When you configure your FFmpeg build, all the supported native decoders +are enabled by default. Decoders requiring an external library must be enabled +manually via the corresponding @code{--enable-lib} option. You can list all +available decoders using the configure option @code{--list-decoders}. + +You can disable all the decoders with the configure option +@code{--disable-decoders} and selectively enable / disable single decoders +with the options @code{--enable-decoder=@var{DECODER}} / +@code{--disable-decoder=@var{DECODER}}. + +The option @code{-codecs} of the ff* tools will display the list of +enabled decoders. + +@c man end DECODERS + +@chapter Video Decoders +@c man begin VIDEO DECODERS + +A description of some of the currently available video decoders +follows. + +@section rawvideo + +Raw video decoder. + +This decoder decodes rawvideo streams. + +@subsection Options + +@table @option +@item top @var{top_field_first} +Specify the assumed field type of the input video. +@table @option +@item -1 +the video is assumed to be progressive (default) +@item 0 +bottom-field-first is assumed +@item 1 +top-field-first is assumed +@end table + +@end table + +@c man end VIDEO DECODERS + +@chapter Audio Decoders +@c man begin AUDIO DECODERS + +@section ffwavesynth + +Internal wave synthetizer. + +This decoder generates wave patterns according to predefined sequences. Its +use is purely internal and the format of the data it accepts is not publicly +documented. + +@c man end AUDIO DECODERS diff --git a/doc/demuxers.texi b/doc/demuxers.texi index c3049ddfc42..a7af1c8d084 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -1,10 +1,10 @@ @chapter Demuxers @c man begin DEMUXERS -Demuxers are configured elements in Libav which allow to read the +Demuxers are configured elements in FFmpeg which allow to read the multimedia streams from a particular type of file. -When you configure your Libav build, all the supported demuxers +When you configure your FFmpeg build, all the supported demuxers are enabled by default. You can list all available ones using the configure option "--list-demuxers". @@ -49,19 +49,19 @@ sequence of filenames of the form @file{i%m%g-1.jpg}, The size, the pixel format, and the format of each image must be the same for all the files in the sequence. -The following example shows how to use @command{avconv} for creating a +The following example shows how to use @command{ffmpeg} for creating a video from the images in the file sequence @file{img-001.jpeg}, -@file{img-002.jpeg}, ..., assuming an input framerate of 10 frames per +@file{img-002.jpeg}, ..., assuming an input frame rate of 10 frames per second: @example -avconv -i 'img-%03d.jpeg' -r 10 out.mkv +ffmpeg -i 'img-%03d.jpeg' -r 10 out.mkv @end example Note that the pattern must not necessarily contain "%d" or "%0@var{N}d", for example to convert a single image file @file{img.jpeg} you can employ the command: @example -avconv -i img.jpeg img.png +ffmpeg -i img.jpeg img.png @end example @section applehttp @@ -70,9 +70,39 @@ Apple HTTP Live Streaming demuxer. This demuxer presents all AVStreams from all variant streams. The id field is set to the bitrate variant index number. By setting -the discard flags on AVStreams (by pressing 'a' or 'v' in avplay), +the discard flags on AVStreams (by pressing 'a' or 'v' in ffplay), the caller can decide which variant streams to actually receive. The total bitrate of the variant that the stream belongs to is available in a metadata key named "variant_bitrate". +@section sbg + +SBaGen script demuxer. + +This demuxer reads the script language used by SBaGen +@url{http://uazu.net/sbagen/} to generate binaural beats sessions. A SBG +script looks like that: +@example +-SE +a: 300-2.5/3 440+4.5/0 +b: 300-2.5/0 440+4.5/3 +off: - +NOW == a ++0:07:00 == b ++0:14:00 == a ++0:21:00 == b ++0:30:00 off +@end example + +A SBG script can mix absolute and relative timestamps. If the script uses +either only absolute timestamps (including the script start time) or only +relative ones, then its layout is fixed, and the conversion is +straightforward. On the other hand, if the script mixes both kind of +timestamps, then the @var{NOW} reference for relative timestamps will be +taken from the current time of day at the time the script is read, and the +script layout will be frozen according to that reference. That means that if +the script is directly played, the actual times will match the absolute +timestamps up to the sound controller's clock accuracy, but if the user +somehow pauses the playback or seeks, all times will be shifted accordingly. + @c man end INPUT DEVICES diff --git a/doc/developer.texi b/doc/developer.texi index de642396dc0..97ca2fcc29d 100644 --- a/doc/developer.texi +++ b/doc/developer.texi @@ -17,71 +17,43 @@ decoding). Look at @file{libavcodec/apiexample.c} to see how to use it. @item libavformat is the library containing the file format handling (mux and -demux code for several formats). Look at @file{avplay.c} to use it in a +demux code for several formats). Look at @file{ffplay.c} to use it in a player. See @file{libavformat/output-example.c} to use it to generate audio or video streams. @end itemize -@section Integrating libav in your program - -Shared libraries should be used whenever is possible in order to reduce -the effort distributors have to pour to support programs and to ensure -only the public api is used. - -You can use Libav in your commercial program, but you must abide to the -license, LGPL or GPL depending on the specific features used, please refer -to @uref{http://libav.org/legal.html, our legal page} for a quick checklist and to -the following links for the exact text of each license: -@uref{http://git.libav.org/?p=libav.git;a=blob;f=COPYING.GPLv2, GPL version 2}, -@uref{http://git.libav.org/?p=libav.git;a=blob;f=COPYING.GPLv3, GPL version 3}, -@uref{http://git.libav.org/?p=libav.git;a=blob;f=COPYING.LGPLv2.1, LGPL version 2.1}, -@uref{http://git.libav.org/?p=libav.git;a=blob;f=COPYING.LGPLv3, LGPL version 3}. -Any modification to the source code can be suggested for inclusion. -The best way to proceed is to send your patches to the -@uref{https://lists.libav.org/mailman/listinfo/libav-devel, libav-devel} -mailing list. +@section Integrating libavcodec or libavformat in your program + +You can integrate all the source code of the libraries to link them +statically to avoid any version problem. All you need is to provide a +'config.mak' and a 'config.h' in the parent directory. See the defines +generated by ./configure to understand what is needed. + +You can use libavcodec or libavformat in your commercial program, but +@emph{any patch you make must be published}. The best way to proceed is +to send your patches to the FFmpeg mailing list. + +@section Contributing + +There are 3 ways by which code gets into ffmpeg. +@itemize @bullet +@item Submitting Patches to the main developer mailing list + see @ref{Submitting patches} for details. +@item Directly committing changes to the main tree. +@item Committing changes to a git clone, for example on github.com or + gitorious.org. And asking us to merge these changes. +@end itemize + +Whichever way, changes should be reviewed by the maintainer of the code +before they are committed. And they should follow the @ref{Coding Rules}. +The developer making the commit and the author are responsible for their changes +and should try to fix issues their commit causes. @anchor{Coding Rules} @section Coding Rules @subsection Code formatting conventions -The code is written in K&R C style. That means the following: -@itemize @bullet -@item -The control statements are formatted by putting space between the statement -and parenthesis in the following way: -@example -for (i = 0; i < filter->input_count; i++) @{ -@end example -@item -The case statement is always located at the same level as the switch itself: -@example -switch (link->init_state) @{ -case AVLINK_INIT: - continue; -case AVLINK_STARTINIT: - av_log(filter, AV_LOG_INFO, "circular filter chain detected"); - return 0; -@end example -@item -Braces in function declarations are written on the new line: -@example -const char *avfilter_configuration(void) -@{ - return LIBAV_CONFIGURATION; -@} -@end example -@item -In case of a single-statement if, no curly braces are required: -@example -if (!pic || !picref) - goto fail; -@end example -@item -Do not put spaces immediately inside parentheses. @samp{if (ret)} is -a valid style; @samp{if ( ret )} is not. -@end itemize There are the following guidelines regarding the indentation in files: @itemize @bullet @@ -97,7 +69,7 @@ and only if this improves readability. @end itemize The presentation is one inspired by 'indent -i4 -kr -nut'. -The main priority in Libav is simplicity and small code size in order to +The main priority in FFmpeg is simplicity and small code size in order to minimize the bug count. @subsection Comments @@ -142,7 +114,7 @@ int myfunc(int my_parameter) @subsection C language features -Libav is programmed in the ISO C90 language with a few additional +FFmpeg is programmed in the ISO C90 language with a few additional features from ISO C99, namely: @itemize @bullet @item @@ -174,10 +146,10 @@ GCC statement expressions (@samp{(x = (@{ int y = 4; y; @})}). @end itemize @subsection Naming conventions -All names are using underscores (_), not CamelCase. For example, -@samp{avfilter_get_video_buffer} is a valid function name and -@samp{AVFilterGetVideo} is not. The only exception from this are structure -names; they should always be in the CamelCase +All names are using underscores (_), not CamelCase. For example, @samp{avfilter_get_video_buffer} is +a valid function name and @samp{AVFilterGetVideo} is not. The exception from this are type names, like +for example structs and enums; they should always be in the CamelCase + There are following conventions for naming variables and functions: @itemize @bullet @@ -208,10 +180,10 @@ should also be avoided if they don't make the code easier to understand. @end itemize @subsection Editor configuration -In order to configure Vim to follow Libav formatting conventions, paste +In order to configure Vim to follow FFmpeg formatting conventions, paste the following snippet into your @file{.vimrc}: @example -" indentation rules for libav: 4 spaces, no tabs +" indentation rules for FFmpeg: 4 spaces, no tabs set expandtab set shiftwidth=4 set softtabstop=4 @@ -228,7 +200,7 @@ autocmd InsertEnter * match ForbiddenWhitespace /\t\|\s\+\%#\@@ 5 lines) chunk of code, + then either do NOT change the indentation of the inner part within (do not + move it to the right)! or do so in a separate commit +@item + Always fill out the commit log message. Describe in a few lines what you + changed and why. You can refer to mailing list postings if you fix a + particular bug. Comments such as "fixed!" or "Changed it." are unacceptable. + Recommended format: + area changed: Short 1 line description + + details describing what and why and giving references. +@item + Make sure the author of the commit is set correctly. (see git commit --author) + If you apply a patch, send an + answer to ffmpeg-devel (or wherever you got the patch from) saying that + you applied the patch. @item When applying patches that have been discussed (at length) on the mailing list, reference the thread in the log message. @item - Subscribe to the - @uref{https://lists.libav.org/mailman/listinfo/libav-devel, libav-devel} and - @uref{https://lists.libav.org/mailman/listinfo/libav-commits, libav-commits} - mailing lists. - Bugs and possible improvements or general questions regarding commits - are discussed on libav-devel. We expect you to react if problems with - your code are uncovered. + Do NOT commit to code actively maintained by others without permission. + Send a patch to ffmpeg-devel instead. If no one answers within a reasonable + timeframe (12h for build failures and security fixes, 3 days small changes, + 1 week for big patches) then commit your patch if you think it is OK. + Also note, the maintainer can simply ask for more time to review! +@item + Subscribe to the ffmpeg-cvslog mailing list. The diffs of all commits + are sent there and reviewed by all the other developers. Bugs and possible + improvements or general questions regarding commits are discussed there. We + expect you to react if problems with your code are uncovered. @item Update the documentation if you change behavior or add features. If you are - unsure how best to do this, send an [RFC] patch to libav-devel. + unsure how best to do this, send a patch to ffmpeg-devel, the documentation + maintainer(s) will review and commit your stuff. @item - All discussions and decisions should be reported on the public developer - mailing list, so that there is a reference to them. - Other media (e.g. IRC) should be used for coordination and immediate - collaboration. + Try to keep important discussions and requests (also) on the public + developer mailing list, so that all developers can benefit from them. @item Never write to unallocated memory, never write over the end of arrays, always check values read from some untrusted source before using them - as array index or other risky things. Always use valgrind to doublecheck. + as array index or other risky things. @item - Remember to check if you need to bump versions for the specific libav + Remember to check if you need to bump versions for the specific libav* parts (libavutil, libavcodec, libavformat) you are changing. You need to change the version integer. Incrementing the first component means no backward compatibility to @@ -324,12 +318,13 @@ For Emacs, add these roughly equivalent lines to your @file{.emacs.d/init.el}: Incrementing the third component means a noteworthy binary compatible change (e.g. encoder bug fix that matters for the decoder). @item - Compiler warnings indicate potential bugs or code with bad style. + Compiler warnings indicate potential bugs or code with bad style. If a type of + warning always points to correct and clean code, that warning should + be disabled, not the code changed. + Thus the remaining warnings can either be bugs or correct code. If it is a bug, the bug has to be fixed. If it is not, the code should be changed to not generate a warning unless that causes a slowdown or obfuscates the code. - If a type of warning leads to too many false positives, that warning - should be disabled, not the code changed. @item If you add a new file, give it a proper license header. Do not copy and paste it from a random place, use an existing file as template. @@ -337,49 +332,47 @@ For Emacs, add these roughly equivalent lines to your @file{.emacs.d/init.el}: We think our rules are not too hard. If you have comments, contact us. -Note, some rules were borrowed from the MPlayer project. +Note, these rules are mostly borrowed from the MPlayer project. +@anchor{Submitting patches} @section Submitting patches First, read the @ref{Coding Rules} above if you did not yet, in particular the rules regarding patch submission. -As stated already, please do not submit a patch which contains several -unrelated changes. +When you submit your patch, please use @code{git format-patch} or +@code{git send-email}. We cannot read other diffs :-) + +Also please do not submit a patch which contains several unrelated changes. Split it into separate, self-contained pieces. This does not mean splitting file by file. Instead, make the patch as small as possible while still keeping it as a logical unit that contains an individual change, even if it spans multiple files. This makes reviewing your patches much easier for us and greatly increases your chances of getting your patch applied. -Use the patcheck tool of Libav to check your patch. +Use the patcheck tool of FFmpeg to check your patch. The tool is located in the tools directory. -Run the @ref{Regression Tests} before submitting a patch in order to verify +Run the @ref{Regression tests} before submitting a patch in order to verify it does not cause unexpected problems. Patches should be posted as base64 encoded attachments (or any other encoding which ensures that the patch will not be trashed during -transmission) to the -@uref{https://lists.libav.org/mailman/listinfo/libav-devel, libav-devel} -mailing list. +transmission) to the ffmpeg-devel mailing list, see +@url{http://lists.ffmpeg.org/mailman/listinfo/ffmpeg-devel} It also helps quite a bit if you tell us what the patch does (for example 'replaces lrint by lrintf'), and why (for example '*BSD isn't C99 compliant -and has no lrint()'). This kind of explanation should be the body of the -commit message. +and has no lrint()') Also please if you send several patches, send each patch as a separate mail, do not attach several unrelated patches to the same mail. -Use @code{git send-email} when possible since it will properly send patches -without requiring extra care. - Your patch will be reviewed on the mailing list. You will likely be asked to make some changes and are expected to send in an improved version that incorporates the requests from the review. This process may go through -several iterations. Once your patch is deemed good enough, it will be -committed to the official Libav tree. +several iterations. Once your patch is deemed good enough, some developer +will pick it up and commit it to the official FFmpeg tree. Give us a few days to react. But if some time passes without reaction, send a reminder by email. Your patch should eventually be dealt with. @@ -401,12 +394,12 @@ send a reminder by email. Your patch should eventually be dealt with. @item Did you add the CodecID to @file{avcodec.h}? @item - If it has a fourcc, did you add it to @file{libavformat/riff.c}, + If it has a fourCC, did you add it to @file{libavformat/riff.c}, even if it is only a decoder? @item Did you add a rule to compile the appropriate files in the Makefile? - Remember to do this even if you are just adding a format to a file that - is already being compiled by some other rule, like a raw demuxer. + Remember to do this even if you're just adding a format to a file that is + already being compiled by some other rule, like a raw demuxer. @item Did you add an entry to the table of supported formats or codecs in @file{doc/general.texi}? @@ -430,13 +423,18 @@ send a reminder by email. Your patch should eventually be dealt with. @item Does @code{make fate} pass with the patch applied? @item - Does @code{make checkheaders} pass with the patch applied? + Was the patch generated with git format-patch or send-email? @item - Is the patch against latest Libav git master branch? + Did you sign off your patch? (git commit -s) + See @url{http://kerneltrap.org/files/Jeremy/DCO.txt} for the meaning + of sign off. @item - Are you subscribed to the - @uref{https://lists.libav.org/mailman/listinfo/libav-devel, libav-devel} - mailing list? (Only list subscribers are allowed to post.) + Did you provide a clear git commit log message? +@item + Is the patch against latest FFmpeg git master branch? +@item + Are you subscribed to ffmpeg-devel? + (the list is subscribers only due to spam) @item Have you checked that the changes are minimal, so that the same cannot be achieved with a smaller patch and/or simpler final code? @@ -466,7 +464,7 @@ send a reminder by email. Your patch should eventually be dealt with. If the patch fixes a bug, did you provide enough information, including a sample, so the bug can be reproduced and the fix can be verified? Note please do not attach samples >100k to mails but rather provide a - URL, you can upload to ftp://upload.libav.org + URL, you can upload to ftp://upload.ffmpeg.org @item Did you provide a verbose summary about what the patch does change? @item @@ -479,20 +477,22 @@ send a reminder by email. Your patch should eventually be dealt with. patch easily? @item If you added a new file, did you insert a license header? It should be - taken from Libav, not randomly copied and pasted from somewhere else. + taken from FFmpeg, not randomly copied and pasted from somewhere else. @item You should maintain alphabetical order in alphabetically ordered lists as long as doing so does not break API/ABI compatibility. @item Lines with similar content should be aligned vertically when doing so improves readability. +@item + Consider to add a regression test for your code. +@item + If you added YASM code please check that things still work with --disable-yasm @end enumerate @section Patch review process -All patches posted to the -@uref{https://lists.libav.org/mailman/listinfo/libav-devel, libav-devel} -mailing list will be reviewed, unless they contain a +All patches posted to ffmpeg-devel will be reviewed, unless they contain a clear note that the patch is not for the git master branch. Reviews and comments will be posted as replies to the patch on the mailing list. The patch submitter then has to take care of every comment, @@ -506,22 +506,26 @@ After a patch is approved it will be committed to the repository. We will review all submitted patches, but sometimes we are quite busy so especially for large patches this can take several weeks. -When resubmitting patches, if their size grew or during the review different -issues arisen please split the patch so each issue has a specific patch. +If you feel that the review process is too slow and you are willing to try to +take over maintainership of the area of code you change then just clone +git master and maintain the area of code there. We will merge each area from +where its best maintained. -@anchor{Regression Tests} -@section Regression Tests +When resubmitting patches, please do not make any significant changes +not related to the comments received during review. Such patches will +be rejected. Instead, submit significant changes or new features as +separate patches. -Before submitting a patch (or committing to the repository), you should at -least make sure that it does not break anything. +@anchor{Regression tests} +@section Regression tests -If the code changed has already a test present in FATE you should run it, -otherwise it is advised to add it. +Before submitting a patch (or committing to the repository), you should at least +test that you did not break anything. -Improvements to codec or demuxer might change the FATE results. Make sure -to commit the update reference with the change and to explain in the comment -why the expected result changed. +Running 'make fate' accomplishes this, please see @url{fate.html} for details. -Please refer to @url{fate.html}. +[Of course, some patches may change the results of the regression tests. In +this case, the reference results of the regression tests shall be modified +accordingly]. @bye diff --git a/doc/encoders.texi b/doc/encoders.texi index 830981fe8db..65841eda7f6 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1,10 +1,10 @@ @chapter Encoders @c man begin ENCODERS -Encoders are configured elements in Libav which allow the encoding of +Encoders are configured elements in FFmpeg which allow the encoding of multimedia streams. -When you configure your Libav build, all the supported native encoders +When you configure your FFmpeg build, all the supported native encoders are enabled by default. Encoders requiring an external library must be enabled manually via the corresponding @code{--enable-lib} option. You can list all available encoders using the configure option @code{--list-encoders}. @@ -369,7 +369,7 @@ is highly recommended that it be left as enabled except for testing purposes. @end table -@subheading Floating-Point-Only AC-3 Encoding Options +@subsection Floating-Point-Only AC-3 Encoding Options These options are only valid for the floating-point encoder and do not exist for the fixed-point encoder due to the corresponding features not being @@ -413,3 +413,176 @@ Selected by Encoder (default) @end table @c man end AUDIO ENCODERS + +@chapter Video Encoders +@c man begin VIDEO ENCODERS + +A description of some of the currently available video encoders +follows. + +@section libvpx + +VP8 format supported through libvpx. + +Requires the presence of the libvpx headers and library during configuration. +You need to explicitly configure the build with @code{--enable-libvpx}. + +@subsection Options + +Mapping from FFmpeg to libvpx options with conversion notes in parentheses. + +@table @option + +@item threads +g_threads + +@item profile +g_profile + +@item vb +rc_target_bitrate + +@item g +kf_max_dist + +@item keyint_min +kf_min_dist + +@item qmin +rc_min_quantizer + +@item qmax +rc_max_quantizer + +@item bufsize, vb +rc_buf_sz +@code{(bufsize * 1000 / vb)} + +rc_buf_optimal_sz +@code{(bufsize * 1000 / vb * 5 / 6)} + +@item rc_init_occupancy, vb +rc_buf_initial_sz +@code{(rc_init_occupancy * 1000 / vb)} + +@item rc_buffer_aggressivity +rc_undershoot_pct + +@item skip_threshold +rc_dropframe_thresh + +@item qcomp +rc_2pass_vbr_bias_pct + +@item maxrate, vb +rc_2pass_vbr_maxsection_pct +@code{(maxrate * 100 / vb)} + +@item minrate, vb +rc_2pass_vbr_minsection_pct +@code{(minrate * 100 / vb)} + +@item minrate, maxrate, vb +@code{VPX_CBR} +@code{(minrate == maxrate == vb)} + +@item crf +@code{VPX_CQ}, @code{VP8E_SET_CQ_LEVEL} + +@item quality +@table @option +@item @var{best} +@code{VPX_DL_BEST_QUALITY} +@item @var{good} +@code{VPX_DL_GOOD_QUALITY} +@item @var{realtime} +@code{VPX_DL_REALTIME} +@end table + +@item speed +@code{VP8E_SET_CPUUSED} + +@item nr +@code{VP8E_SET_NOISE_SENSITIVITY} + +@item mb_threshold +@code{VP8E_SET_STATIC_THRESHOLD} + +@item slices +@code{VP8E_SET_TOKEN_PARTITIONS} + +@item Alternate reference frame related +@table @option +@item vp8flags altref +@code{VP8E_SET_ENABLEAUTOALTREF} +@item @var{arnr_max_frames} +@code{VP8E_SET_ARNR_MAXFRAMES} +@item @var{arnr_type} +@code{VP8E_SET_ARNR_TYPE} +@item @var{arnr_strength} +@code{VP8E_SET_ARNR_STRENGTH} +@item @var{rc_lookahead} +g_lag_in_frames +@end table + +@item vp8flags error_resilient +g_error_resilient + +@end table + +For more information about libvpx see: +@url{http://www.webmproject.org/} + +@section libx264 + +H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 format supported through +libx264. + +Requires the presence of the libx264 headers and library during +configuration. You need to explicitly configure the build with +@code{--enable-libx264}. + +@subsection Options + +@table @option + +@item preset @var{preset_name} +Set the encoding preset. + +@item tune @var{tune_name} +Tune the encoding params. + +@item fastfirstpass @var{bool} +Use fast settings when encoding first pass, default value is 1. + +@item profile @var{profile_name} +Set profile restrictions. + +@item level @var{level} +Specify level (as defined by Annex A). +Deprecated in favor of @var{x264opts}. + +@item passlogfile @var{filename} +Specify filename for 2 pass stats. +Deprecated in favor of @var{x264opts} (see @var{stats} libx264 option). + +@item wpredp @var{wpred_type} +Specify Weighted prediction for P-frames. +Deprecated in favor of @var{x264opts} (see @var{weightp} libx264 option). + +@item x264opts @var{options} +Allow to set any x264 option, see x264 --fullhelp for a list. + +@var{options} is a list of @var{key}=@var{value} couples separated by +":". +@end table + +For example to specify libx264 encoding options with @command{ffmpeg}: +@example +ffmpeg -i foo.mpg -vcodec libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv +@end example + +For more information about libx264 and the supported options see: +@url{http://www.videolan.org/developers/x264.html} + +@c man end VIDEO ENCODERS diff --git a/doc/errno.txt b/doc/errno.txt new file mode 100644 index 00000000000..31cab26fc29 --- /dev/null +++ b/doc/errno.txt @@ -0,0 +1,174 @@ +The following table lists most error codes found in various operating +systems supported by FFmpeg. + + OS +Code Std F LBMWwb Text (YMMV) + +E2BIG POSIX ++++++ Argument list too long +EACCES POSIX ++++++ Permission denied +EADDRINUSE POSIX +++..+ Address in use +EADDRNOTAVAIL POSIX +++..+ Cannot assign requested address +EADV +..... Advertise error +EAFNOSUPPORT POSIX +++..+ Address family not supported +EAGAIN POSIX + ++++++ Resource temporarily unavailable +EALREADY POSIX +++..+ Operation already in progress +EAUTH .++... Authentication error +EBADARCH ..+... Bad CPU type in executable +EBADE +..... Invalid exchange +EBADEXEC ..+... Bad executable +EBADF POSIX ++++++ Bad file descriptor +EBADFD +..... File descriptor in bad state +EBADMACHO ..+... Malformed Macho file +EBADMSG POSIX ++4... Bad message +EBADR +..... Invalid request descriptor +EBADRPC .++... RPC struct is bad +EBADRQC +..... Invalid request code +EBADSLT +..... Invalid slot +EBFONT +..... Bad font file format +EBUSY POSIX - ++++++ Device or resource busy +ECANCELED POSIX +++... Operation canceled +ECHILD POSIX ++++++ No child processes +ECHRNG +..... Channel number out of range +ECOMM +..... Communication error on send +ECONNABORTED POSIX +++..+ Software caused connection abort +ECONNREFUSED POSIX - +++ss+ Connection refused +ECONNRESET POSIX +++..+ Connection reset +EDEADLK POSIX ++++++ Resource deadlock avoided +EDEADLOCK +..++. File locking deadlock error +EDESTADDRREQ POSIX +++... Destination address required +EDEVERR ..+... Device error +EDOM C89 - ++++++ Numerical argument out of domain +EDOOFUS .F.... Programming error +EDOTDOT +..... RFS specific error +EDQUOT POSIX +++... Disc quota exceeded +EEXIST POSIX ++++++ File exists +EFAULT POSIX - ++++++ Bad address +EFBIG POSIX - ++++++ File too large +EFTYPE .++... Inappropriate file type or format +EHOSTDOWN +++... Host is down +EHOSTUNREACH POSIX +++..+ No route to host +EHWPOISON +..... Memory page has hardware error +EIDRM POSIX +++... Identifier removed +EILSEQ C99 ++++++ Illegal byte sequence +EINPROGRESS POSIX - +++ss+ Operation in progress +EINTR POSIX - ++++++ Interrupted system call +EINVAL POSIX + ++++++ Invalid argument +EIO POSIX + ++++++ I/O error +EISCONN POSIX +++..+ Socket is already connected +EISDIR POSIX ++++++ Is a directory +EISNAM +..... Is a named type file +EKEYEXPIRED +..... Key has expired +EKEYREJECTED +..... Key was rejected by service +EKEYREVOKED +..... Key has been revoked +EL2HLT +..... Level 2 halted +EL2NSYNC +..... Level 2 not synchronized +EL3HLT +..... Level 3 halted +EL3RST +..... Level 3 reset +ELIBACC +..... Can not access a needed shared library +ELIBBAD +..... Accessing a corrupted shared library +ELIBEXEC +..... Cannot exec a shared library directly +ELIBMAX +..... Too many shared libraries +ELIBSCN +..... .lib section in a.out corrupted +ELNRNG +..... Link number out of range +ELOOP POSIX +++..+ Too many levels of symbolic links +EMEDIUMTYPE +..... Wrong medium type +EMFILE POSIX ++++++ Too many open files +EMLINK POSIX ++++++ Too many links +EMSGSIZE POSIX +++..+ Message too long +EMULTIHOP POSIX ++4... Multihop attempted +ENAMETOOLONG POSIX - ++++++ Filen ame too long +ENAVAIL +..... No XENIX semaphores available +ENEEDAUTH .++... Need authenticator +ENETDOWN POSIX +++..+ Network is down +ENETRESET SUSv3 +++..+ Network dropped connection on reset +ENETUNREACH POSIX +++..+ Network unreachable +ENFILE POSIX ++++++ Too many open files in system +ENOANO +..... No anode +ENOATTR .++... Attribute not found +ENOBUFS POSIX - +++..+ No buffer space available +ENOCSI +..... No CSI structure available +ENODATA XSR +N4... No message available +ENODEV POSIX - ++++++ No such device +ENOENT POSIX - ++++++ No such file or directory +ENOEXEC POSIX ++++++ Exec format error +ENOFILE ...++. No such file or directory +ENOKEY +..... Required key not available +ENOLCK POSIX ++++++ No locks available +ENOLINK POSIX ++4... Link has been severed +ENOMEDIUM +..... No medium found +ENOMEM POSIX ++++++ Not enough space +ENOMSG POSIX +++..+ No message of desired type +ENONET +..... Machine is not on the network +ENOPKG +..... Package not installed +ENOPROTOOPT POSIX +++..+ Protocol not available +ENOSPC POSIX ++++++ No space left on device +ENOSR XSR +N4... No STREAM resources +ENOSTR XSR +N4... Not a STREAM +ENOSYS POSIX + ++++++ Function not implemented +ENOTBLK +++... Block device required +ENOTCONN POSIX +++..+ Socket is not connected +ENOTDIR POSIX ++++++ Not a directory +ENOTEMPTY POSIX ++++++ Directory not empty +ENOTNAM +..... Not a XENIX named type file +ENOTRECOVERABLE SUSv4 - +..... State not recoverable +ENOTSOCK POSIX +++..+ Socket operation on non-socket +ENOTSUP POSIX +++... Operation not supported +ENOTTY POSIX ++++++ Inappropriate I/O control operation +ENOTUNIQ +..... Name not unique on network +ENXIO POSIX ++++++ No such device or address +EOPNOTSUPP POSIX +++..+ Operation not supported (on socket) +EOVERFLOW POSIX +++..+ Value too large to be stored in data type +EOWNERDEAD SUSv4 +..... Owner died +EPERM POSIX - ++++++ Operation not permitted +EPFNOSUPPORT +++..+ Protocol family not supported +EPIPE POSIX - ++++++ Broken pipe +EPROCLIM .++... Too many processes +EPROCUNAVAIL .++... Bad procedure for program +EPROGMISMATCH .++... Program version wrong +EPROGUNAVAIL .++... RPC prog. not avail +EPROTO POSIX ++4... Protocol error +EPROTONOSUPPORT POSIX - +++ss+ Protocol not supported +EPROTOTYPE POSIX +++..+ Protocol wrong type for socket +EPWROFF ..+... Device power is off +ERANGE C89 - ++++++ Result too large +EREMCHG +..... Remote address changed +EREMOTE +++... Object is remote +EREMOTEIO +..... Remote I/O error +ERESTART +..... Interrupted system call should be restarted +ERFKILL +..... Operation not possible due to RF-kill +EROFS POSIX ++++++ Read-only file system +ERPCMISMATCH .++... RPC version wrong +ESHLIBVERS ..+... Shared library version mismatch +ESHUTDOWN +++..+ Cannot send after socket shutdown +ESOCKTNOSUPPORT +++... Socket type not supported +ESPIPE POSIX ++++++ Illegal seek +ESRCH POSIX ++++++ No such process +ESRMNT +..... Srmount error +ESTALE POSIX +++..+ Stale NFS file handle +ESTRPIPE +..... Streams pipe error +ETIME XSR +N4... Stream ioctl timeout +ETIMEDOUT POSIX - +++ss+ Connection timed out +ETOOMANYREFS +++... Too many references: cannot splice +ETXTBSY POSIX +++... Text file busy +EUCLEAN +..... Structure needs cleaning +EUNATCH +..... Protocol driver not attached +EUSERS +++... Too many users +EWOULDBLOCK POSIX +++..+ Operation would block +EXDEV POSIX ++++++ Cross-device link +EXFULL +..... Exchange full + +Notations: + +F: used in FFmpeg (-: a few times, +: a lot) + +SUSv3: Single Unix Specification, version 3 +SUSv4: Single Unix Specification, version 4 +XSR: XSI STREAMS (obsolete) + +OS: availability on some supported operating systems +L: GNU/Linux +B: BSD (F: FreeBSD, N: NetBSD) +M: MacOS X +W: Microsoft Windows (s: emulated with winsock, see libavformat/network.h) +w: Mingw32 (3.17) and Mingw64 (2.0.1) +b: BeOS diff --git a/doc/eval.texi b/doc/eval.texi index 7f8f3653b3f..c4b669fbcb4 100644 --- a/doc/eval.texi +++ b/doc/eval.texi @@ -1,7 +1,7 @@ @chapter Expression Evaluation @c man begin EXPRESSION EVALUATION -When evaluating an arithmetic expression, Libav uses an internal +When evaluating an arithmetic expression, FFmpeg uses an internal formula evaluator, implemented through the @file{libavutil/eval.h} interface. @@ -50,6 +50,7 @@ Allow to store the value of the expression @var{expr} in an internal variable. @var{var} specifies the number of the variable where to store the value, and it is a value ranging from 0 to 9. The function returns the value stored in the internal variable. +Note, Variables are currently not shared between expressions. @item ld(var) Allow to load the value of the internal variable with number @@ -79,21 +80,70 @@ Compute the square root of @var{expr}. This is equivalent to @item not(expr) Return 1.0 if @var{expr} is zero, 0.0 otherwise. + +@item pow(x, y) +Compute the power of @var{x} elevated @var{y}, it is equivalent to +"(@var{x})^(@var{y})". + +@item random(x) +Return a pseudo random value between 0.0 and 1.0. @var{x} is the index of the +internal variable which will be used to save the seed/state. + +@item hypot(x, y) +This function is similar to the C function with the same name; it returns +"sqrt(@var{x}*@var{x} + @var{y}*@var{y})", the length of the hypotenuse of a +right triangle with sides of length @var{x} and @var{y}, or the distance of the +point (@var{x}, @var{y}) from the origin. + +@item gcd(x, y) +Return the greatest common divisor of @var{x} and @var{y}. If both @var{x} and +@var{y} are 0 or either or both are less than zero then behavior is undefined. + +@item if(x, y) +Evaluate @var{x}, and if the result is non-zero return the result of +the evaluation of @var{y}, return 0 otherwise. + +@item ifnot(x, y) +Evaluate @var{x}, and if the result is zero return the result of the +evaluation of @var{y}, return 0 otherwise. + +@item taylor(expr, x) taylor(expr, x, id) +Evaluate a taylor series at x. +expr represents the LD(id)-th derivates of f(x) at 0. If id is not specified +then 0 is assumed. +note, when you have the derivatives at y instead of 0 +taylor(expr, x-y) can be used +When the series does not converge the results are undefined. + +@item root(expr, max) +Finds x where f(x)=0 in the interval 0..max. +f() must be continuous or the result is undefined. +@end table + +The following constants are available: +@table @option +@item PI +area of the unit disc, approximately 3.14 +@item E +exp(1) (Euler's number), approximately 2.718 +@item PHI +golden ratio (1+sqrt(5))/2, approximately 1.618 @end table -Note that: +Assuming that an expression is considered "true" if it has a non-zero +value, note that: @code{*} works like AND @code{+} works like OR -thus +and the construct: @example if A then B else C @end example is equivalent to @example -A*B + not(A)*C +if(A,B) + ifnot(A,C) @end example In your C code, you can extend the list of unary and binary functions, diff --git a/doc/examples/Makefile b/doc/examples/Makefile new file mode 100644 index 00000000000..4d6c7a8be61 --- /dev/null +++ b/doc/examples/Makefile @@ -0,0 +1,21 @@ +# use pkg-config for getting CFLAGS abd LDFLAGS +FFMPEG_LIBS=libavdevice libavformat libavfilter libavcodec libswscale libavutil +CFLAGS+=-Wall $(shell pkg-config --cflags $(FFMPEG_LIBS)) +LDFLAGS+=$(shell pkg-config --libs $(FFMPEG_LIBS)) + +EXAMPLES=decoding_encoding filtering_video filtering_audio metadata muxing + +OBJS=$(addsuffix .o,$(EXAMPLES)) + +%: %.o + $(CC) $< $(LDFLAGS) -o $@ + +%.o: %.c + $(CC) $< $(CFLAGS) -c -o $@ + +.phony: all clean + +all: $(OBJS) $(EXAMPLES) + +clean: + rm -rf $(EXAMPLES) $(OBJS) diff --git a/libavcodec/api-example.c b/doc/examples/decoding_encoding.c similarity index 84% rename from libavcodec/api-example.c rename to doc/examples/decoding_encoding.c index 93d6c2253cf..4b93b58fec5 100644 --- a/libavcodec/api-example.c +++ b/doc/examples/decoding_encoding.c @@ -1,41 +1,36 @@ /* - * copyright (c) 2001 Fabrice Bellard + * Copyright (c) 2001 Fabrice Bellard * - * This file is part of Libav. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: * - * Libav is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. * - * Libav 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. */ /** * @file * libavcodec API use example. * - * @example libavcodec/api-example.c - * Note that this library only handles codecs (mpeg, mpeg4, etc...), - * not file formats (avi, vob, etc...). See library 'libavformat' for the + * Note that libavcodec only handles codecs (mpeg, mpeg4, etc...), + * not file formats (avi, vob, mp4, mov, mkv, mxf, flv, mpegts, mpegps, etc...). See library 'libavformat' for the * format handling */ -#include -#include -#include - -#ifdef HAVE_AV_CONFIG_H -#undef HAVE_AV_CONFIG_H -#endif - +#include "libavutil/imgutils.h" +#include "libavutil/opt.h" #include "libavcodec/avcodec.h" #include "libavutil/mathematics.h" #include "libavutil/samplefmt.h" @@ -72,6 +67,7 @@ static void audio_encode_example(const char *filename) c->bit_rate = 64000; c->sample_rate = 44100; c->channels = 2; + c->sample_fmt = AV_SAMPLE_FMT_S16; /* open it */ if (avcodec_open2(c, codec, NULL) < 0) { @@ -184,6 +180,8 @@ static void audio_decode_example(const char *outfilename, const char *filename) } avpkt.size -= len; avpkt.data += len; + avpkt.dts = + avpkt.pts = AV_NOPTS_VALUE; if (avpkt.size < AUDIO_REFILL_THRESH) { /* Refill the input buffer, to avoid trying to decode * incomplete frames. Instead of this, one could also use @@ -209,19 +207,19 @@ static void audio_decode_example(const char *outfilename, const char *filename) /* * Video encoding example */ -static void video_encode_example(const char *filename) +static void video_encode_example(const char *filename, int codec_id) { AVCodec *codec; AVCodecContext *c= NULL; - int i, out_size, size, x, y, outbuf_size; + int i, out_size, x, y, outbuf_size; FILE *f; AVFrame *picture; - uint8_t *outbuf, *picture_buf; + uint8_t *outbuf; printf("Video encoding\n"); /* find the mpeg1 video encoder */ - codec = avcodec_find_encoder(CODEC_ID_MPEG1VIDEO); + codec = avcodec_find_encoder(codec_id); if (!codec) { fprintf(stderr, "codec not found\n"); exit(1); @@ -241,6 +239,9 @@ static void video_encode_example(const char *filename) c->max_b_frames=1; c->pix_fmt = PIX_FMT_YUV420P; + if(codec_id == CODEC_ID_H264) + av_opt_set(c->priv_data, "preset", "slow", 0); + /* open it */ if (avcodec_open2(c, codec, NULL) < 0) { fprintf(stderr, "could not open codec\n"); @@ -254,17 +255,13 @@ static void video_encode_example(const char *filename) } /* alloc image and output buffer */ - outbuf_size = 100000; + outbuf_size = 100000 + 12*c->width*c->height; outbuf = malloc(outbuf_size); - size = c->width * c->height; - picture_buf = malloc((size * 3) / 2); /* size for YUV 420 */ - picture->data[0] = picture_buf; - picture->data[1] = picture->data[0] + size; - picture->data[2] = picture->data[1] + size / 4; - picture->linesize[0] = c->width; - picture->linesize[1] = c->width / 2; - picture->linesize[2] = c->width / 2; + /* the image can be allocated by any means and av_image_alloc() is + * just the most convenient way if av_malloc() is to be used */ + av_image_alloc(picture->data, picture->linesize, + c->width, c->height, c->pix_fmt, 1); /* encode 1 second of video */ for(i=0;i<25;i++) { @@ -307,11 +304,11 @@ static void video_encode_example(const char *filename) outbuf[3] = 0xb7; fwrite(outbuf, 1, 4, f); fclose(f); - free(picture_buf); free(outbuf); avcodec_close(c); av_free(c); + av_free(picture->data[0]); av_free(picture); printf("\n"); } @@ -463,7 +460,8 @@ int main(int argc, char **argv) audio_encode_example("/tmp/test.mp2"); audio_decode_example("/tmp/test.sw", "/tmp/test.mp2"); - video_encode_example("/tmp/test.mpg"); + video_encode_example("/tmp/test.h264", CODEC_ID_H264); + video_encode_example("/tmp/test.mpg", CODEC_ID_MPEG1VIDEO); filename = "/tmp/test.mpg"; } else { filename = argv[1]; diff --git a/doc/examples/filtering_audio.c b/doc/examples/filtering_audio.c new file mode 100644 index 00000000000..988dbfe3c26 --- /dev/null +++ b/doc/examples/filtering_audio.c @@ -0,0 +1,245 @@ +/* + * Copyright (c) 2010 Nicolas George + * Copyright (c) 2011 Stefano Sabatini + * Copyright (c) 2012 Clément Bœsch + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +/** + * @file + * API example for audio decoding and filtering + */ + +#include + +#include +#include +#include +#include +#include +#include + +const char *filter_descr = "aresample=8000,aconvert=s16:mono"; +const char *player = "ffplay -f s16le -ar 8000 -ac 1 -"; + +static AVFormatContext *fmt_ctx; +static AVCodecContext *dec_ctx; +AVFilterContext *buffersink_ctx; +AVFilterContext *buffersrc_ctx; +AVFilterGraph *filter_graph; +static int audio_stream_index = -1; + +static int open_input_file(const char *filename) +{ + int ret; + AVCodec *dec; + + if ((ret = avformat_open_input(&fmt_ctx, filename, NULL, NULL)) < 0) { + av_log(NULL, AV_LOG_ERROR, "Cannot open input file\n"); + return ret; + } + + if ((ret = avformat_find_stream_info(fmt_ctx, NULL)) < 0) { + av_log(NULL, AV_LOG_ERROR, "Cannot find stream information\n"); + return ret; + } + + /* select the audio stream */ + ret = av_find_best_stream(fmt_ctx, AVMEDIA_TYPE_AUDIO, -1, -1, &dec, 0); + if (ret < 0) { + av_log(NULL, AV_LOG_ERROR, "Cannot find a audio stream in the input file\n"); + return ret; + } + audio_stream_index = ret; + dec_ctx = fmt_ctx->streams[audio_stream_index]->codec; + + /* init the audio decoder */ + if ((ret = avcodec_open2(dec_ctx, dec, NULL)) < 0) { + av_log(NULL, AV_LOG_ERROR, "Cannot open audio decoder\n"); + return ret; + } + + return 0; +} + +static int init_filters(const char *filters_descr) +{ + char args[512]; + int ret; + AVFilter *abuffersrc = avfilter_get_by_name("abuffer"); + AVFilter *abuffersink = avfilter_get_by_name("abuffersink"); + AVFilterInOut *outputs = avfilter_inout_alloc(); + AVFilterInOut *inputs = avfilter_inout_alloc(); + const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16, -1 }; + const int packing_fmts[] = { AVFILTER_PACKED, -1 }; + const int64_t *chlayouts = avfilter_all_channel_layouts; + AVABufferSinkParams *abuffersink_params; + const AVFilterLink *outlink; + + filter_graph = avfilter_graph_alloc(); + + /* buffer audio source: the decoded frames from the decoder will be inserted here. */ + if (!dec_ctx->channel_layout) + dec_ctx->channel_layout = av_get_default_channel_layout(dec_ctx->channels); + snprintf(args, sizeof(args), "%d:%d:0x%"PRIx64":packed", + dec_ctx->sample_rate, dec_ctx->sample_fmt, dec_ctx->channel_layout); + ret = avfilter_graph_create_filter(&buffersrc_ctx, abuffersrc, "in", + args, NULL, filter_graph); + if (ret < 0) { + av_log(NULL, AV_LOG_ERROR, "Cannot create audio buffer source\n"); + return ret; + } + + /* buffer audio sink: to terminate the filter chain. */ + abuffersink_params = av_abuffersink_params_alloc(); + abuffersink_params->sample_fmts = sample_fmts; + abuffersink_params->channel_layouts = chlayouts; + abuffersink_params->packing_fmts = packing_fmts; + ret = avfilter_graph_create_filter(&buffersink_ctx, abuffersink, "out", + NULL, abuffersink_params, filter_graph); + if (ret < 0) { + av_log(NULL, AV_LOG_ERROR, "Cannot create audio buffer sink\n"); + return ret; + } + + /* Endpoints for the filter graph. */ + outputs->name = av_strdup("in"); + outputs->filter_ctx = buffersrc_ctx; + outputs->pad_idx = 0; + outputs->next = NULL; + + inputs->name = av_strdup("out"); + inputs->filter_ctx = buffersink_ctx; + inputs->pad_idx = 0; + inputs->next = NULL; + + if ((ret = avfilter_graph_parse(filter_graph, filter_descr, + &inputs, &outputs, NULL)) < 0) + return ret; + + if ((ret = avfilter_graph_config(filter_graph, NULL)) < 0) + return ret; + + /* Print summary of the sink buffer + * Note: args buffer is reused to store channel layout string */ + outlink = buffersink_ctx->inputs[0]; + av_get_channel_layout_string(args, sizeof(args), -1, outlink->channel_layout); + av_log(NULL, AV_LOG_INFO, "Output: srate:%dHz fmt:%s chlayout:%s\n", + (int)outlink->sample_rate, + (char *)av_x_if_null(av_get_sample_fmt_name(outlink->format), "?"), + args); + + return 0; +} + +static void print_samplesref(AVFilterBufferRef *samplesref) +{ + const AVFilterBufferRefAudioProps *props = samplesref->audio; + const int n = props->nb_samples * av_get_channel_layout_nb_channels(props->channel_layout); + const uint16_t *p = (uint16_t*)samplesref->data[0]; + const uint16_t *p_end = p + n; + + while (p < p_end) { + fputc(*p & 0xff, stdout); + fputc(*p>>8 & 0xff, stdout); + p++; + } + fflush(stdout); +} + +int main(int argc, char **argv) +{ + int ret; + AVPacket packet; + AVFrame frame; + int got_frame; + + if (argc != 2) { + fprintf(stderr, "Usage: %s file | %s\n", argv[0], player); + exit(1); + } + + avcodec_register_all(); + av_register_all(); + avfilter_register_all(); + + if ((ret = open_input_file(argv[1])) < 0) + goto end; + if ((ret = init_filters(filter_descr)) < 0) + goto end; + + /* read all packets */ + while (1) { + AVFilterBufferRef *samplesref; + if ((ret = av_read_frame(fmt_ctx, &packet)) < 0) + break; + + if (packet.stream_index == audio_stream_index) { + avcodec_get_frame_defaults(&frame); + got_frame = 0; + ret = avcodec_decode_audio4(dec_ctx, &frame, &got_frame, &packet); + av_free_packet(&packet); + if (ret < 0) { + av_log(NULL, AV_LOG_ERROR, "Error decoding audio\n"); + break; + } + + if (got_frame) { + const int bps = av_get_bytes_per_sample(dec_ctx->sample_fmt); + const int decoded_data_size = frame.nb_samples * dec_ctx->channels * bps; + + /* push the audio data from decoded frame into the filtergraph */ + if (av_asrc_buffer_add_buffer(buffersrc_ctx, + frame.data[0], + decoded_data_size, + dec_ctx->sample_rate, + dec_ctx->sample_fmt, + dec_ctx->channel_layout, + 0, frame.pts, 0) < 0) { + av_log(NULL, AV_LOG_ERROR, "Error while feeding the audio filtergraph\n"); + break; + } + + /* pull filtered audio from the filtergraph */ + while (avfilter_poll_frame(buffersink_ctx->inputs[0])) { + av_buffersink_get_buffer_ref(buffersink_ctx, &samplesref, 0); + if (samplesref) { + print_samplesref(samplesref); + avfilter_unref_buffer(samplesref); + } + } + } + } + } +end: + avfilter_graph_free(&filter_graph); + if (dec_ctx) + avcodec_close(dec_ctx); + avformat_close_input(&fmt_ctx); + + if (ret < 0 && ret != AVERROR_EOF) { + char buf[1024]; + av_strerror(ret, buf, sizeof(buf)); + fprintf(stderr, "Error occurred: %s\n", buf); + exit(1); + } + + exit(0); +} diff --git a/doc/examples/filtering_video.c b/doc/examples/filtering_video.c new file mode 100644 index 00000000000..2ca6a054971 --- /dev/null +++ b/doc/examples/filtering_video.c @@ -0,0 +1,232 @@ +/* + * Copyright (c) 2010 Nicolas George + * Copyright (c) 2011 Stefano Sabatini + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +/** + * @file + * API example for decoding and filtering + */ + +#define _XOPEN_SOURCE 600 /* for usleep */ +#include + +#include +#include +#include +#include +#include + +const char *filter_descr = "scale=78:24"; + +static AVFormatContext *fmt_ctx; +static AVCodecContext *dec_ctx; +AVFilterContext *buffersink_ctx; +AVFilterContext *buffersrc_ctx; +AVFilterGraph *filter_graph; +static int video_stream_index = -1; +static int64_t last_pts = AV_NOPTS_VALUE; + +static int open_input_file(const char *filename) +{ + int ret; + AVCodec *dec; + + if ((ret = avformat_open_input(&fmt_ctx, filename, NULL, NULL)) < 0) { + av_log(NULL, AV_LOG_ERROR, "Cannot open input file\n"); + return ret; + } + + if ((ret = avformat_find_stream_info(fmt_ctx, NULL)) < 0) { + av_log(NULL, AV_LOG_ERROR, "Cannot find stream information\n"); + return ret; + } + + /* select the video stream */ + ret = av_find_best_stream(fmt_ctx, AVMEDIA_TYPE_VIDEO, -1, -1, &dec, 0); + if (ret < 0) { + av_log(NULL, AV_LOG_ERROR, "Cannot find a video stream in the input file\n"); + return ret; + } + video_stream_index = ret; + dec_ctx = fmt_ctx->streams[video_stream_index]->codec; + + /* init the video decoder */ + if ((ret = avcodec_open2(dec_ctx, dec, NULL)) < 0) { + av_log(NULL, AV_LOG_ERROR, "Cannot open video decoder\n"); + return ret; + } + + return 0; +} + +static int init_filters(const char *filters_descr) +{ + char args[512]; + int ret; + AVFilter *buffersrc = avfilter_get_by_name("buffer"); + AVFilter *buffersink = avfilter_get_by_name("buffersink"); + AVFilterInOut *outputs = avfilter_inout_alloc(); + AVFilterInOut *inputs = avfilter_inout_alloc(); + enum PixelFormat pix_fmts[] = { PIX_FMT_GRAY8, PIX_FMT_NONE }; + filter_graph = avfilter_graph_alloc(); + + /* buffer video source: the decoded frames from the decoder will be inserted here. */ + snprintf(args, sizeof(args), "%d:%d:%d:%d:%d:%d:%d", + dec_ctx->width, dec_ctx->height, dec_ctx->pix_fmt, + dec_ctx->time_base.num, dec_ctx->time_base.den, + dec_ctx->sample_aspect_ratio.num, dec_ctx->sample_aspect_ratio.den); + ret = avfilter_graph_create_filter(&buffersrc_ctx, buffersrc, "in", + args, NULL, filter_graph); + if (ret < 0) { + av_log(NULL, AV_LOG_ERROR, "Cannot create buffer source\n"); + return ret; + } + + /* buffer video sink: to terminate the filter chain. */ + ret = avfilter_graph_create_filter(&buffersink_ctx, buffersink, "out", + NULL, pix_fmts, filter_graph); + if (ret < 0) { + av_log(NULL, AV_LOG_ERROR, "Cannot create buffer sink\n"); + return ret; + } + + /* Endpoints for the filter graph. */ + outputs->name = av_strdup("in"); + outputs->filter_ctx = buffersrc_ctx; + outputs->pad_idx = 0; + outputs->next = NULL; + + inputs->name = av_strdup("out"); + inputs->filter_ctx = buffersink_ctx; + inputs->pad_idx = 0; + inputs->next = NULL; + + if ((ret = avfilter_graph_parse(filter_graph, filter_descr, + &inputs, &outputs, NULL)) < 0) + return ret; + + if ((ret = avfilter_graph_config(filter_graph, NULL)) < 0) + return ret; + return 0; +} + +static void display_picref(AVFilterBufferRef *picref, AVRational time_base) +{ + int x, y; + uint8_t *p0, *p; + int64_t delay; + + if (picref->pts != AV_NOPTS_VALUE) { + if (last_pts != AV_NOPTS_VALUE) { + /* sleep roughly the right amount of time; + * usleep is in microseconds, just like AV_TIME_BASE. */ + delay = av_rescale_q(picref->pts - last_pts, + time_base, AV_TIME_BASE_Q); + if (delay > 0 && delay < 1000000) + usleep(delay); + } + last_pts = picref->pts; + } + + /* Trivial ASCII grayscale display. */ + p0 = picref->data[0]; + puts("\033c"); + for (y = 0; y < picref->video->h; y++) { + p = p0; + for (x = 0; x < picref->video->w; x++) + putchar(" .-+#"[*(p++) / 52]); + putchar('\n'); + p0 += picref->linesize[0]; + } + fflush(stdout); +} + +int main(int argc, char **argv) +{ + int ret; + AVPacket packet; + AVFrame frame; + int got_frame; + + if (argc != 2) { + fprintf(stderr, "Usage: %s file\n", argv[0]); + exit(1); + } + + avcodec_register_all(); + av_register_all(); + avfilter_register_all(); + + if ((ret = open_input_file(argv[1])) < 0) + goto end; + if ((ret = init_filters(filter_descr)) < 0) + goto end; + + /* read all packets */ + while (1) { + AVFilterBufferRef *picref; + if ((ret = av_read_frame(fmt_ctx, &packet)) < 0) + break; + + if (packet.stream_index == video_stream_index) { + avcodec_get_frame_defaults(&frame); + got_frame = 0; + ret = avcodec_decode_video2(dec_ctx, &frame, &got_frame, &packet); + av_free_packet(&packet); + if (ret < 0) { + av_log(NULL, AV_LOG_ERROR, "Error decoding video\n"); + break; + } + + if (got_frame) { + if (frame.pts == AV_NOPTS_VALUE) + frame.pts = frame.pkt_dts == AV_NOPTS_VALUE ? + frame.pkt_dts : frame.pkt_pts; + /* push the decoded frame into the filtergraph */ + av_vsrc_buffer_add_frame(buffersrc_ctx, &frame, 0); + + /* pull filtered pictures from the filtergraph */ + while (avfilter_poll_frame(buffersink_ctx->inputs[0])) { + av_buffersink_get_buffer_ref(buffersink_ctx, &picref, 0); + if (picref) { + display_picref(picref, buffersink_ctx->inputs[0]->time_base); + avfilter_unref_buffer(picref); + } + } + } + } + } +end: + avfilter_graph_free(&filter_graph); + if (dec_ctx) + avcodec_close(dec_ctx); + avformat_close_input(&fmt_ctx); + + if (ret < 0 && ret != AVERROR_EOF) { + char buf[1024]; + av_strerror(ret, buf, sizeof(buf)); + fprintf(stderr, "Error occurred: %s\n", buf); + exit(1); + } + + exit(0); +} diff --git a/libavformat/metadata-example.c b/doc/examples/metadata.c similarity index 97% rename from libavformat/metadata-example.c rename to doc/examples/metadata.c index 7bf77e73788..7d29be70491 100644 --- a/libavformat/metadata-example.c +++ b/doc/examples/metadata.c @@ -22,7 +22,6 @@ /** * @file - * @example libavformat/metadata-example.c * Shows how the metadata API can be used in application programs. */ diff --git a/libavformat/output-example.c b/doc/examples/muxing.c similarity index 96% rename from libavformat/output-example.c rename to doc/examples/muxing.c index 9dc811ca153..9d338dee670 100644 --- a/libavformat/output-example.c +++ b/doc/examples/muxing.c @@ -24,7 +24,6 @@ * @file * libavformat API example. * - * @example libavformat/output-example.c * Output a media file in any supported libavformat format. * The default codecs are used. */ @@ -41,7 +40,7 @@ #undef exit /* 5 seconds stream duration */ -#define STREAM_DURATION 5.0 +#define STREAM_DURATION 200.0 #define STREAM_FRAME_RATE 25 /* 25 images/s */ #define STREAM_NB_FRAMES ((int)(STREAM_DURATION * STREAM_FRAME_RATE)) #define STREAM_PIX_FMT PIX_FMT_YUV420P /* default pix_fmt */ @@ -76,6 +75,7 @@ static AVStream *add_audio_stream(AVFormatContext *oc, enum CodecID codec_id) fprintf(stderr, "Could not alloc stream\n"); exit(1); } + st->id = 1; c = st->codec; @@ -203,6 +203,16 @@ static AVStream *add_video_stream(AVFormatContext *oc, enum CodecID codec_id) c = st->codec; + /* find the video encoder */ + codec = avcodec_find_encoder(codec_id); + if (!codec) { + fprintf(stderr, "codec not found\n"); + exit(1); + } + avcodec_get_context_defaults3(c, codec); + + c->codec_id = codec_id; + /* Put sample parameters. */ c->bit_rate = 400000; /* Resolution must be a multiple of two. */ @@ -381,6 +391,7 @@ static void write_video_frame(AVFormatContext *oc, AVStream *st) c->time_base, st->time_base); if (c->coded_frame->key_frame) pkt.flags |= AV_PKT_FLAG_KEY; + pkt.stream_index = st->index; pkt.data = video_outbuf; pkt.size = out_size; @@ -436,25 +447,16 @@ int main(int argc, char **argv) filename = argv[1]; - /* Autodetect the output format from the name. default is MPEG. */ - fmt = av_guess_format(NULL, filename, NULL); - if (!fmt) { + /* allocate the output media context */ + avformat_alloc_output_context2(&oc, NULL, NULL, filename); + if (!oc) { printf("Could not deduce output format from file extension: using MPEG.\n"); - fmt = av_guess_format("mpeg", NULL, NULL); + avformat_alloc_output_context2(&oc, NULL, "mpeg", filename); } - if (!fmt) { - fprintf(stderr, "Could not find suitable output format\n"); - return 1; - } - - /* Allocate the output media context. */ - oc = avformat_alloc_context(); if (!oc) { - fprintf(stderr, "Memory error\n"); return 1; } - oc->oformat = fmt; - snprintf(oc->filename, sizeof(oc->filename), "%s", filename); + fmt = oc->oformat; /* Add the audio and video streams using the default format codecs * and initialize the codecs. */ @@ -487,6 +489,7 @@ int main(int argc, char **argv) /* Write the stream header, if any. */ avformat_write_header(oc, NULL); + picture->pts = 0; for (;;) { /* Compute current audio and video time. */ if (audio_st) @@ -509,6 +512,7 @@ int main(int argc, char **argv) write_audio_frame(oc, audio_st); } else { write_video_frame(oc, video_st); + picture->pts++; } } diff --git a/doc/faq.texi b/doc/faq.texi index 7c5373c4371..5f371a45463 100644 --- a/doc/faq.texi +++ b/doc/faq.texi @@ -1,8 +1,8 @@ \input texinfo @c -*- texinfo -*- -@settitle Libav FAQ +@settitle FFmpeg FAQ @titlepage -@center @titlefont{Libav FAQ} +@center @titlefont{FFmpeg FAQ} @end titlepage @top @@ -11,23 +11,23 @@ @chapter General Questions -@section Why doesn't Libav support feature [xyz]? +@section Why doesn't FFmpeg support feature [xyz]? -Because no one has taken on that task yet. Libav development is +Because no one has taken on that task yet. FFmpeg development is driven by the tasks that are important to the individual developers. If there is a feature that is important to you, the best way to get it implemented is to undertake the task yourself or sponsor a developer. -@section Libav does not support codec XXX. Can you include a Windows DLL loader to support it? +@section FFmpeg does not support codec XXX. Can you include a Windows DLL loader to support it? No. Windows DLLs are not portable, bloated and often slow. -Moreover Libav strives to support all codecs natively. +Moreover FFmpeg strives to support all codecs natively. A DLL loader is not conducive to that goal. -@section I cannot read this file although this format seems to be supported by avconv. +@section I cannot read this file although this format seems to be supported by ffmpeg. -Even if avconv can read the container format, it may not support all its -codecs. Please consult the supported codec list in the avconv +Even if ffmpeg can read the container format, it may not support all its +codecs. Please consult the supported codec list in the ffmpeg documentation. @section Which codecs are supported by Windows? @@ -81,6 +81,12 @@ problem and an NP-hard problem... @chapter Usage +@section ffmpeg does not work; what is wrong? + +Try a @code{make distclean} in the ffmpeg source directory before the build. +If this does not help see +(@url{http://ffmpeg.org/bugreports.html}). + @section How do I encode single pictures into movies? First, rename your pictures to follow a numerical sequence. @@ -88,7 +94,7 @@ For example, img1.jpg, img2.jpg, img3.jpg,... Then you may run: @example - avconv -f image2 -i img%d.jpg /tmp/a.mpg + ffmpeg -f image2 -i img%d.jpg /tmp/a.mpg @end example Notice that @samp{%d} is replaced by the image number. @@ -111,17 +117,17 @@ If you want to sequence them by oldest modified first, substitute Then run: @example - avconv -f image2 -i /tmp/img%03d.jpg /tmp/a.mpg + ffmpeg -f image2 -i /tmp/img%03d.jpg /tmp/a.mpg @end example -The same logic is used for any image format that avconv reads. +The same logic is used for any image format that ffmpeg reads. @section How do I encode movie to single pictures? Use: @example - avconv -i movie.mpg movie%d.jpg + ffmpeg -i movie.mpg movie%d.jpg @end example The @file{movie.mpg} used as input will be converted to @@ -137,7 +143,7 @@ to force the encoding. Applying that to the previous example: @example - avconv -i movie.mpg -f image2 -c:v mjpeg menu%d.jpg + ffmpeg -i movie.mpg -f image2 -c:v mjpeg menu%d.jpg @end example Beware that there is no "jpeg" codec. Use "mjpeg" instead. @@ -156,12 +162,12 @@ Use @file{-} as file name. Try '-f image2 test%d.jpg'. -@section Why can I not change the framerate? +@section Why can I not change the frame rate? -Some codecs, like MPEG-1/2, only allow a small number of fixed framerates. +Some codecs, like MPEG-1/2, only allow a small number of fixed frame rates. Choose a different codec with the -c:v command line option. -@section How do I encode Xvid or DivX video with avconv? +@section How do I encode Xvid or DivX video with ffmpeg? Both Xvid and DivX (version 4+) are implementations of the ISO MPEG-4 standard (note that there are many other coding formats that use this @@ -182,14 +188,14 @@ things to try: '-bf 2', '-flags qprd', '-flags mv0', '-flags skiprd'. but beware the '-g 100' might cause problems with some decoders. Things to try: '-bf 2', '-flags qprd', '-flags mv0', '-flags skiprd. -@section Interlaced video looks very bad when encoded with avconv, what is wrong? +@section Interlaced video looks very bad when encoded with ffmpeg, what is wrong? You should use '-flags +ilme+ildct' and maybe '-flags +alt' for interlaced material, and try '-top 0/1' if the result looks really messed-up. @section How can I read DirectShow files? -If you have built Libav with @code{./configure --enable-avisynth} +If you have built FFmpeg with @code{./configure --enable-avisynth} (only possible on MinGW/Cygwin platforms), then you may use any file that DirectShow can read as input. @@ -197,9 +203,9 @@ Just create an "input.avs" text file with this single line ... @example DirectShowSource("C:\path to your file\yourfile.asf") @end example -... and then feed that text file to avconv: +... and then feed that text file to ffmpeg: @example - avconv -i input.avs + ffmpeg -i input.avs @end example For ANY other help on Avisynth, please visit the @@ -216,10 +222,10 @@ equally humble @code{copy} under Windows), and finally transcoding back to your format of choice. @example -avconv -i input1.avi -same_quant intermediate1.mpg -avconv -i input2.avi -same_quant intermediate2.mpg +ffmpeg -i input1.avi -same_quant intermediate1.mpg +ffmpeg -i input2.avi -same_quant intermediate2.mpg cat intermediate1.mpg intermediate2.mpg > intermediate_all.mpg -avconv -i intermediate_all.mpg -same_quant output.avi +ffmpeg -i intermediate_all.mpg -same_quant output.avi @end example Notice that you should either use @code{-same_quant} or set a reasonably high @@ -232,10 +238,10 @@ of named pipes, should your platform support it: @example mkfifo intermediate1.mpg mkfifo intermediate2.mpg -avconv -i input1.avi -same_quant -y intermediate1.mpg < /dev/null & -avconv -i input2.avi -same_quant -y intermediate2.mpg < /dev/null & +ffmpeg -i input1.avi -same_quant -y intermediate1.mpg < /dev/null & +ffmpeg -i input2.avi -same_quant -y intermediate2.mpg < /dev/null & cat intermediate1.mpg intermediate2.mpg |\ -avconv -f mpeg -i - -same_quant -c:v mpeg4 -acodec libmp3lame output.avi +ffmpeg -f mpeg -i - -same_quant -c:v mpeg4 -acodec libmp3lame output.avi @end example Similarly, the yuv4mpegpipe format, and the raw video, raw audio codecs also @@ -254,13 +260,13 @@ mkfifo temp2.a mkfifo temp2.v mkfifo all.a mkfifo all.v -avconv -i input1.flv -vn -f u16le -acodec pcm_s16le -ac 2 -ar 44100 - > temp1.a < /dev/null & -avconv -i input2.flv -vn -f u16le -acodec pcm_s16le -ac 2 -ar 44100 - > temp2.a < /dev/null & -avconv -i input1.flv -an -f yuv4mpegpipe - > temp1.v < /dev/null & -@{ avconv -i input2.flv -an -f yuv4mpegpipe - < /dev/null | tail -n +2 > temp2.v ; @} & +ffmpeg -i input1.flv -vn -f u16le -acodec pcm_s16le -ac 2 -ar 44100 - > temp1.a < /dev/null & +ffmpeg -i input2.flv -vn -f u16le -acodec pcm_s16le -ac 2 -ar 44100 - > temp2.a < /dev/null & +ffmpeg -i input1.flv -an -f yuv4mpegpipe - > temp1.v < /dev/null & +@{ ffmpeg -i input2.flv -an -f yuv4mpegpipe - < /dev/null | tail -n +2 > temp2.v ; @} & cat temp1.a temp2.a > all.a & cat temp1.v temp2.v > all.v & -avconv -f u16le -acodec pcm_s16le -ac 2 -ar 44100 -i all.a \ +ffmpeg -f u16le -acodec pcm_s16le -ac 2 -ar 44100 -i all.a \ -f yuv4mpegpipe -i all.v \ -same_quant -y output.flv rm temp[12].[av] all.[av] @@ -268,7 +274,7 @@ rm temp[12].[av] all.[av] @section -profile option fails when encoding H.264 video with AAC audio -@command{avconv} prints an error like +@command{ffmpeg} prints an error like @example Undefined constant or missing '(' in 'baseline' @@ -283,16 +289,34 @@ video and audio. Specifically the AAC encoder also defines some profiles, none of which are named @var{baseline}. The solution is to apply the @option{-profile} option to the video stream only -by using @url{http://libav.org/avconv.html#Stream-specifiers-1, Stream specifiers}. +by using @url{http://ffmpeg.org/ffmpeg.html#Stream-specifiers-1, Stream specifiers}. Appending @code{:v} to it will do exactly that. +@section Using @option{-f lavfi}, audio becomes mono for no apparent reason. + +Use @option{-dumpgraph -} to find out exactly where the channel layout is +lost. + +Most likely, it is through @code{auto-inserted aconvert}. Try to understand +why the converting filter was needed at that place. + +Just before the output is a likely place, as @option{-f lavfi} currently +only support packed S16. + +Then insert the correct @code{aconvert} explicitly in the filter graph, +specifying the exact format. + +@example +aconvert=s16:stereo:packed +@end example + @chapter Development -@section Are there examples illustrating how to use the Libav libraries, particularly libavcodec and libavformat? +@section Are there examples illustrating how to use the FFmpeg libraries, particularly libavcodec and libavformat? -Yes. Read the Developers Guide of the Libav documentation. Alternatively, +Yes. Read the Developers Guide of the FFmpeg documentation. Alternatively, examine the source code for one of the many open source projects that -already incorporate Libav at (@url{projects.html}). +already incorporate FFmpeg at (@url{projects.html}). @section Can you support my C compiler XXX? @@ -303,14 +327,14 @@ with @code{#ifdef}s related to the compiler. @section Is Microsoft Visual C++ supported? No. Microsoft Visual C++ is not compliant to the C99 standard and does -not - among other things - support the inline assembly used in Libav. +not - among other things - support the inline assembly used in FFmpeg. If you wish to use MSVC++ for your project then you can link the MSVC++ code with libav* as long as you compile the latter with a working C compiler. For more information, see -the @emph{Microsoft Visual C++ compatibility} section in the Libav +the @emph{Microsoft Visual C++ compatibility} section in the FFmpeg documentation. -There have been efforts to make Libav compatible with MSVC++ in the +There have been efforts to make FFmpeg compatible with MSVC++ in the past. However, they have all been rejected as too intrusive, especially since MinGW does the job adequately. None of the core developers work with MSVC++ and thus this item is low priority. Should you find @@ -318,46 +342,78 @@ the silver bullet that solves this problem, feel free to shoot it at us. We strongly recommend you to move over from MSVC++ to MinGW tools. -@section Can I use Libav under Windows? +@section Can I use FFmpeg or libavcodec under Windows? -Yes, but the Cygwin or MinGW tools @emph{must} be used to compile Libav. -Read the @emph{Windows} section in the Libav documentation to find more +Yes, but the Cygwin or MinGW tools @emph{must} be used to compile FFmpeg. +Read the @emph{Windows} section in the FFmpeg documentation to find more information. +To get help and instructions for building FFmpeg under Windows, check out +the FFmpeg Windows Help Forum at +@url{http://ffmpeg.arrozcru.org/}. + @section Can you add automake, libtool or autoconf support? No. These tools are too bloated and they complicate the build. -@section Why not rewrite Libav in object-oriented C++? +@section Why not rewrite FFmpeg in object-oriented C++? -Libav is already organized in a highly modular manner and does not need to +FFmpeg is already organized in a highly modular manner and does not need to be rewritten in a formal object language. Further, many of the developers favor straight C; it works for them. For more arguments on this matter, read @uref{http://www.tux.org/lkml/#s15, "Programming Religion"}. +@section Why are the ffmpeg programs devoid of debugging symbols? + +The build process creates ffmpeg_g, ffplay_g, etc. which contain full debug +information. Those binaries are stripped to create ffmpeg, ffplay, etc. If +you need the debug information, use the *_g versions. + @section I do not like the LGPL, can I contribute code under the GPL instead? Yes, as long as the code is optional and can easily and cleanly be placed -under #if CONFIG_GPL without breaking anything. So for example a new codec +under #if CONFIG_GPL without breaking anything. So, for example, a new codec or filter would be OK under GPL while a bug fix to LGPL code would not. -@section I'm using Libav from within my C++ application but the linker complains about missing symbols which seem to be available. +@section I'm using FFmpeg from within my C++ application but the linker complains about missing symbols which seem to be available. -Libav is a pure C project, so to use the libraries within your C++ application +FFmpeg is a pure C project, so to use the libraries within your C++ application you need to explicitly state that you are using a C library. You can do this by -encompassing your Libav includes using @code{extern "C"}. +encompassing your FFmpeg includes using @code{extern "C"}. See @url{http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html#faq-32.3} @section I'm using libavutil from within my C++ application but the compiler complains about 'UINT64_C' was not declared in this scope -Libav is a pure C project using C99 math features, in order to enable C++ +FFmpeg is a pure C project using C99 math features, in order to enable C++ to use them you have to append -D__STDC_CONSTANT_MACROS to your CXXFLAGS @section I have a file in memory / a API different from *open/*read/ libc how do I use it with libavformat? You have to implement a URLProtocol, see @file{libavformat/file.c} in -Libav and @file{libmpdemux/demux_lavf.c} in MPlayer sources. +FFmpeg and @file{libmpdemux/demux_lavf.c} in MPlayer sources. + +@section Where can I find libav* headers for Pascal/Delphi? + +see @url{http://www.iversenit.dk/dev/ffmpeg-headers/} + +@section Where is the documentation about ffv1, msmpeg4, asv1, 4xm? + +see @url{http://www.ffmpeg.org/~michael/} + +@section How do I feed H.263-RTP (and other codecs in RTP) to libavcodec? + +Even if peculiar since it is network oriented, RTP is a container like any +other. You have to @emph{demux} RTP before feeding the payload to libavcodec. +In this specific case please look at RFC 4629 to see how it should be done. + +@section AVStream.r_frame_rate is wrong, it is much larger than the frame rate. + +r_frame_rate is NOT the average frame rate, it is the smallest frame rate +that can accurately represent all timestamps. So no, it is not +wrong if it is larger than the average! +For example, if you have mixed 25 and 30 fps content, then r_frame_rate +will be 150. @section Why is @code{make fate} not running all tests? diff --git a/doc/fate.texi b/doc/fate.texi index c1011e73f88..07d8c53599d 100644 --- a/doc/fate.texi +++ b/doc/fate.texi @@ -5,132 +5,172 @@ @center @titlefont{FATE Automated Testing Environment} @end titlepage +@node Top @top @contents @chapter Introduction -FATE provides a regression testsuite embedded within the Libav build system. -It can be run locally and optionally configured to send reports to a web -aggregator and viewer @url{http://fate.libav.org}. + FATE is an extended regression suite on the client-side and a means +for results aggregation and presentation on the server-side. -It is advised to run FATE before submitting patches to the current codebase -and provide new tests when submitting patches to add additional features. + The first part of this document explains how you can use FATE from +your FFmpeg source directory to test your ffmpeg binary. The second +part describes how you can run FATE to submit the results to FFmpeg's +FATE server. -@chapter Running FATE + In any way you can have a look at the publicly viewable FATE results +by visiting this website: -@section Samples and References -In order to run, FATE needs a large amount of data (samples and references) -that is provided separately from the actual source distribution. + @url{http://fate.ffmpeg.org/} -To inform the build system about the testsuite location, pass -@option{--samples=} to @command{configure} or set the -@var{SAMPLES} Make variable or the @var{FATE_SAMPLES} environment variable -to a suitable value. + This is especially recommended for all people contributing source +code to FFmpeg, as it can be seen if some test on some platform broke +with there recent contribution. This usually happens on the platforms +the developers could not test on. -The dataset is available through @command{rsync}, is possible to fetch -the current sample using the straight rsync command or through a specific -@ref{Makefile target}. + The second part of this document describes how you can run FATE to +submit your results to FFmpeg's FATE server. If you want to submit your +results be sure to check that your combination of CPU, OS and compiler +is not already listed on the above mentioned website. + + In the third part you can find a comprehensive listing of FATE makefile +targets and variables. + + +@chapter Using FATE from your FFmpeg source directory + + If you want to run FATE on your machine you need to have the samples +in place. You can get the samples via the build target fate-rsync. +Use this command from the top-level source directory: + +@example +make fate-rsync SAMPLES=fate-suite/ +make fate SAMPLES=fate-suite/ +@end example + + The above commands set the samples location by passing a makefile +variable via command line. It is also possible to set the samples +location at source configuration time by invoking configure with +`--samples='. Afterwards you can +invoke the makefile targets without setting the SAMPLES makefile +variable. This is illustrated by the following commands: + +@example +./configure --samples=fate-suite/ +make fate-rsync +make fate +@end example + + Yet another way to tell FATE about the location of the sample +directory is by making sure the environment variable FATE_SAMPLES +contains the path to your samples directory. This can be achieved +by e.g. putting that variable in your shell profile or by setting +it in your interactive session. @example -# rsync -aL rsync://fate-suite.libav.org/fate-suite/ fate-suite +FATE_SAMPLES=fate-suite/ make fate @end example +@float NOTE +Do not put a '~' character in the samples path to indicate a home +directory. Because of shell nuances, this will cause FATE to fail. +@end float + + +@chapter Submitting the results to the FFmpeg result aggregation server + + To submit your results to the server you should run fate through the +shell script tests/fate.sh from the FFmpeg sources. This script needs +to be invoked with a configuration file as its first argument. + @example -# make fate-rsync SAMPLES=fate-suite +tests/fate.sh /path/to/fate_config @end example + A configuration file template with comments describing the individual +configuration variables can be found at @file{tests/fate_config.sh.template}. + +@ifhtml + The mentioned configuration template is also available here: +@verbatiminclude ../tests/fate_config.sh.template +@end ifhtml + + Create a configuration that suits your needs, based on the configuration +template. The `slot' configuration variable can be any string that is not +yet used, but it is suggested that you name it adhering to the following +pattern ---. The configuration file +itself will be sourced in a shell script, therefore all shell features may +be used. This enables you to setup the environment as you need it for your +build. + + For your first test runs the `fate_recv' variable should be empty or +commented out. This will run everything as normal except that it will omit +the submission of the results to the server. The following files should be +present in $workdir as specified in the configuration file: + +@itemize + @item configure.log + @item compile.log + @item test.log + @item report + @item version +@end itemize + + When you have everything working properly you can create an SSH key and +send its public part to the FATE server administrator. + + Configure your SSH client to use public key authentication with that key +when connecting to the FATE server. Also do not forget to check the identity +of the server and to accept its host key. This can usually be achieved by +running your SSH client manually and killing it after you accepted the key. +The FATE server's fingerprint is: -@chapter Manual Run -FATE regression test can be run through @command{make}. -Specific Makefile targets and Makefile variables are available: + b1:31:c8:79:3f:04:1d:f8:f2:23:26:5a:fd:55:fa:92 + + The only thing left is to automate the execution of the fate.sh script and +the synchronisation of the samples directory. + + +@chapter FATE makefile targets and variables + +@section Makefile targets -@anchor{Makefile target} -@section FATE Makefile targets @table @option -@item fate-list -List all fate/regression test targets. @item fate-rsync -Shortcut to download the fate test samples to the specified testsuite location. + Download/synchronize sample files to the configured samples directory. + +@item fate-list + Will list all fate/regression test targets. + @item fate -Run the FATE test suite (requires the fate-suite dataset). + Run the FATE test suite (requires the fate-suite dataset). @end table -@section Fate Makefile variables +@section Makefile variables + @table @option @item V -Verbosity level, can be set to 0, 1 or 2. -@table @option - @item 0 - show just the test arguments - @item 1 - show just the command used in the test - @item 2 - show everything -@end table + Verbosity level, can be set to 0, 1 or 2. + @itemize + @item 0: show just the test arguments + @item 1: show just the command used in the test + @item 2: show everything + @end itemize + @item SAMPLES -Specify or override the path to the FATE samples at make time, it has a -meaning only while running the regression tests. + Specify or override the path to the FATE samples at make time, it has a + meaning only while running the regression tests. + @item THREADS -Specify how many threads to use while running regression tests, it is -quite useful to detect thread-related regressions. + Specify how many threads to use while running regression tests, it is + quite useful to detect thread-related regressions. @item CPUFLAGS -Specify a mask to be applied to autodetected CPU flags. + Specify CPU flags. @end table +Example: @example - make V=1 SAMPLES=/var/fate/samples THREADS=2 CPUFLAGS=mmx fate +make V=1 SAMPLES=/var/fate/samples THREADS=2 CPUFLAGS=mmx fate @end example - -@chapter Automated Tests -In order to automatically testing specific configurations, e.g. multiple -compilers, @command{tests/fate.sh} is provided. - -This shell script builds Libav, runs the regression tests and prepares a -report that can be sent to @url{fate.libav.org} or directly examined locally. - -@section Testing Profiles -The configuration file passed to @command{fate.sh} is shell scripts as well. - -It must provide at least a @var{slot} identifier, the @var{repo} from -which fetch the sources, the @var{samples} directory, a @var{workdir} with -enough space to build and run all the tests. -Optional submit command @var{fate_recv} and a @var{comment} to describe -the testing profile are available. - -Additional optional parameter to tune the Libav building and reporting process -can be passed. - -@example -slot= # some unique identifier -repo=git://git.libav.org/libav.git # the source repository -samples=/path/to/fate/samples -workdir= # directory in which to do all the work -fate_recv="ssh -T fate@@fate.libav.org" # command to submit report -comment= # optional description - -# the following are optional and map to configure options -arch= -cpu= -cross_prefix= -cc= -target_os= -sysroot= -target_exec= -target_path= -extra_cflags= -extra_ldflags= -extra_libs= -extra_conf= # extra configure options not covered above - -#make= # name of GNU make if not 'make' -makeopts= # extra options passed to 'make' -#tar= # command to create a tar archive from its arguments on - # stdout, defaults to 'tar c' -@end example - -@section Submitting Reports -In order to send reports you need to create an @command{ssh} key and send it -to @email{root@@libav.org}. -The current server fingerprint is @var{a4:99:d7:d3:1c:92:0d:56:d6:d5:61:be:01:ae:7d:e6} diff --git a/doc/ffmpeg-mt-authorship.txt b/doc/ffmpeg-mt-authorship.txt new file mode 100644 index 00000000000..d8c405f9489 --- /dev/null +++ b/doc/ffmpeg-mt-authorship.txt @@ -0,0 +1,4561 @@ +This file lists authorship of commits that have been merged from +ffmpeg-mt. These commits where not classically merged because this +would have pulled in duplicated history of all commits in ffmpeg. +Which a majority of developers opposed. + + +commit 002a0939cdf01faa8270d41b3045c08ac12d8975 +Author: Alexander Strange +Date: Sat Feb 20 20:24:36 2010 -0500 + + Update todo + +commit 0040d6f2ba7189ca9bab4cf17c0d150416391dec +Author: Alexander Strange +Date: Sun Jan 24 18:33:16 2010 -0500 + + Remove a malloc() per frame by keeping an array of 32 buffers. + + Requested in original review. Should be slightly faster but does + have a 32-element linear search (since buffers are freed out of order). + + Introducing array_next_nonzero or something would speed up this + and h264 decoding. + +commit 00425e98fba903dceecb89763b57b8f3b7a1abf3 +Merge: 20997d6 e320c22 +Author: Alexander Strange +Date: Thu Jul 2 04:59:42 2009 -0400 + + Merge mainline. + + Having to move the setting of key_frame confused me for far too + long. + +commit 0097d3b01e33d1e0f636a19778a0435a730d4590 +Merge: 9e981c8 44c4fd1 +Author: Alexander Strange +Date: Thu Sep 9 19:19:34 2010 -0400 + + Merge mainline and libswscale. + + Another one coming after h264 is converted to yasm. + + Conflicts: + libavcodec/avcodec.h + +commit 00bbca77f3fe0960cbf0986ea214ce022204837c +Author: Alexander Strange +Date: Sun Jan 16 02:18:12 2011 -0500 + + h264: Early-exit condition for await_references() + + Saves even more zero checking in refs[][], although it still leaves many + useless checks when nrefs[i]>1, because the array indexes are scattered. + + About ~.8% faster decoding. + +commit 00c4b0bb5a7801d14627015d38762ec314639d3d +Merge: 63d086d feadf1b +Author: Alexander Strange +Date: Fri Mar 13 23:50:33 2009 -0400 + + Merge mainline. + + Conflicts: + libavcodec/avcodec.h + libavcodec/h263.c + libavcodec/h263dec.c + libavcodec/h264.c + libavcodec/mpeg12.c + libavcodec/mpegvideo.c + libavcodec/options.c + libavutil/log.c + +commit 01006069782b1b8fe0bfe0eabe4876062e057c11 +Author: Alexander Strange +Date: Tue Jan 13 01:30:01 2009 -0500 + + Fix possibly not allocating obmc_scratchpad with PAFF/weighted prediction + +commit 011a76824f384a315ce4b0474a2811d463b5746b +Author: Alexander Strange +Date: Mon Sep 1 00:40:40 2008 -0400 + + Whitespace and variable name cosmetics for clarity. + +commit 02376cec6531a931330798af67c62a029a3435a1 +Author: Alexander Strange +Date: Thu Jun 11 14:40:27 2009 -0700 + + Normalize how decode_postinit() is called. + + Move it next to the hwaccel call to save an if statement. + +commit 031abc50708c616058020dcf7a1b62bc9b895446 +Author: Alexander Strange +Date: Fri Aug 22 20:43:38 2008 -0400 + + Improve comments in thread.h + +commit 032432ad56fd88a7e9ba6ce9ccd39925854b027a +Author: Alexander Strange +Date: Sat Feb 20 20:48:10 2010 -0500 + + Remove FF_THREAD_DEFAULT. + + It obviously makes no sense to define the default in a public header. + +commit 03980f22907206b52e64439ebcc4445719801035 +Author: Alexander Strange +Date: Fri Jul 11 17:22:22 2008 -0400 + + Mark functions inline to avoid unused function warnings. + +commit 0488ed2d9ff609ec4a6be008c81603b62ce67785 +Author: Alexander Strange +Date: Wed Jun 4 15:55:00 2008 -0400 + + Align the stack in decode_frame_thread. + +commit 0553196aa797d58f0687890c66e1b1cdfa52f419 +Author: Alexander Strange +Date: Wed May 28 00:44:13 2008 -0400 + + Add the frame-threading support code. + +commit 056dce6c969acec1224eaa9fc73d930d1e56b299 +Author: Alexander Strange +Date: Fri Aug 15 16:44:33 2008 -0400 + + h264: Redo finding the output frame during header parsing after merging mainline. + + This works with PAFF and CODEC_FLAG2_CHUNKS, though the second is useless and should be removed. + +commit 05a3af85edd15fef223f0376d3241cc5c7aa3ed5 +Merge: 8ba50a9 fa43cf8 +Author: Alexander Strange +Date: Mon Apr 19 02:41:54 2010 -0400 + + Merge mainline. + + Conflicts: + libavcodec/avcodec.h + libavcodec/h264.c + +commit 05e37cada02dc1ac58e7ce93418cbf33e3a09ad6 +Author: Alexander Strange +Date: Tue May 27 21:00:34 2008 -0400 + + Add the AVCodec/AVCodecContext fields needed for multithreading and increment the API minor version. + +commit 061586a260a564080be8c1ed9af4e83888fe3543 +Author: Alexander Strange +Date: Thu Sep 4 01:41:53 2008 -0400 + + Remove error check that can never fail. + +commit 06407ff8706c7fe28c5b925c4b1dd52641714cb9 +Author: Alexander Strange +Date: Mon Jun 16 18:21:04 2008 -0400 + + Multithreading support for MPEG-1. + +commit 065ee0d04a6539c08bddfa1edc628906494c22f2 +Author: Alexander Strange +Date: Mon Nov 1 12:24:37 2010 -0400 + + vp3: Report INT_MAX instead of height at the end of a frame + + This saves having to clip to height in await_reference_row. + +commit 067c30c63499d5cca5613725de936fb70047aec3 +Author: Alexander Strange +Date: Sun Jun 22 03:29:23 2008 -0400 + + Cosmetics: opening function braces on their own line. + +commit 06ac5ac98dbf03889eb7cccf67fe0cb95615613d +Merge: febe154 987789a +Author: Alexander Strange +Date: Sun Jun 20 04:29:03 2010 -0700 + + Merge mainline. + + Document ONLY_IF_THREADS_ENABLED along the way. + + Conflicts: + libavutil/internal.h + +commit 07474003407915e5462ed3582a1dae8baa06f296 +Author: Alexander Strange +Date: Wed Jun 10 11:25:48 2009 -0700 + + Move frame_thread_init() down to avoid prototyping its callees. + +commit 076bf916d79c39ec055a53f2ee5eadf20c21b988 +Author: Alexander Strange +Date: Mon Aug 25 14:32:41 2008 -0400 + + Increase max delayed buffers for safety + +commit 079cd64ef92cb1670a420a16e38c645cc8f28caa +Author: Alexander Strange +Date: Tue Sep 2 11:38:29 2008 -0400 + + Ignore codecs returning NULL when draining frames. + +commit 090c1f4c99b9c5cefa3bad7698f33516baa87c6e +Author: benoit +Date: Tue Nov 6 13:08:04 2007 +0000 + + fix predictor initialization for adpcm-ima encoder not to lose first sample + in block in adpcm-ima decoder + Patch by Timofei V. Bondarenko: tim commit 09bb0dafa746203f98ff478a5121b3b0ffb3f46e +Author: Alexander Strange +Date: Tue Jul 22 22:20:47 2008 -0400 + + Switch from MB row to pixel row precision for h264 progress. + + This makes it easier to think about interlacing and the deblock filter, and also fixes decoding entirely. + +commit 0a51c1e9ebf09d302e44daaca3147e7cca2f0457 +Author: Alexander Strange +Date: Tue Jun 3 16:04:31 2008 -0400 + + Use threading macros in mpeg12.c. + +commit 0ac282b447075a0645036fba56d2881bbcc8f471 +Author: Alexander Strange +Date: Mon Jan 17 03:44:26 2011 -0500 + + Update multithreading.txt for thread_safe_callbacks and pkt_dts + +commit 0b64ceb6b15560313d0a6ac7cffe9270d7b8e0e8 +Merge: 9ec9f08 e220e91 +Author: Alexander Strange +Date: Tue Aug 10 03:22:51 2010 -0700 + + Merge mainline. + + Conflicts: + libavcodec/avcodec.h + +commit 0b8add0862f841dfc8dbbc8d89dfb3712ce3a698 +Author: Alexander Strange +Date: Mon Aug 18 16:47:21 2008 -0400 + + Allow avcodec_default_release_buffer to be called after avcodec_default_free_buffers. + +commit 0b8c3d23339b5f646ae702f30141e223596f9ff9 +Author: Alexander Strange +Date: Sun Jul 27 21:55:53 2008 -0400 + + Reindent. + +commit 0be0d5714347f63b0e391ad3e9202f9d5107bb5f +Merge: f550857 8c00628 +Author: Alexander Strange +Date: Sun Mar 28 03:40:27 2010 -0400 + + Merge mainline. + +commit 0c73945d0cc40a6ade8ca78dfa0d9bea178f4743 +Author: Alexander Strange +Date: Tue Aug 19 01:07:17 2008 -0400 + + Clarify comment for new AVFrame members + + They are set by libavcodec even if they aren't used for anything useful ATM. + +commit 0cac0f3bd81287db20bbbae5aaff22e381e09663 +Author: Alexander Strange +Date: Sun Jul 13 02:40:22 2008 -0400 + + Add report/await_decode_progress for progressive H264 + Multithreading works with no visible problems for progressive sequences, but there is still some problem causing framecrc differences. + 1 thread - 99% cpu 14s + 2 threads - 183% cpu 8.6s + +commit 0cae6d85e8a33b826611ced69902f2a4d16f0c7a +Author: benoit +Date: Fri Jun 1 12:03:33 2007 +0000 + + A bit more clear FAQ 1.2 + Patch by V +�commit 0d25fc9993407335bc98b91296f9f78b634dd8a0 +Author: Alexander Strange +Date: Tue Jun 24 21:39:39 2008 -0400 + + Remove newly-duplicated memset(). + +commit 0e41f7596f06a758c0f1cb9e48e67ef896c5c05a +Author: Alexander Strange +Date: Fri Jul 11 18:09:02 2008 -0400 + + Reindent. + +commit 0ef99ed28b24757a30b1e805f2ff1ea6d90b9b71 +Author: Alexander Strange +Date: Mon Jan 25 03:17:46 2010 -0500 + + Remove item from todo + +commit 0fad6cca0a7e34dfa62c3934eb5316e2c9649e66 +Author: Alexander Strange +Date: Tue Jul 22 01:00:07 2008 -0400 + + Fix height passed to ff_draw_band for interlaced H.264. + + Without this, it passes y 0 h 16, y 32 h 16, etc. + +commit 0fb994fbdbf4f985ec9c0d5a681e7a5bf620a765 +Merge: 5eb0c64 ace7af3 +Author: Alexander Strange +Date: Wed Jan 20 01:58:15 2010 -0500 + + Merge mainline. + + This was done by hand since git can't track the h264/h263 decoder + splits properly. + + Conflicts: + libavcodec/avcodec.h + libavcodec/h263.c + libavcodec/h263dec.c + libavcodec/h264.c + +commit 0ff629947b15955603cdb7978770ca64c2323262 +Author: Alexander Strange +Date: Thu Jun 18 05:09:01 2009 -0400 + + Don't call report_field_progress for non-referenced H264 frames. + +commit 111fa56db1bfefc245c499f465783a5abc04f7c2 +Author: Alexander Strange +Date: Sat Jul 19 00:12:00 2008 -0400 + + Set start/end_mb_y properly in MpegEncContext. + +commit 115adc279240b6c7155781b5a16177a140eaad4f +Author: Alexander Strange +Date: Sat Jun 21 23:10:18 2008 -0400 + + Add an update_context for codecs that just use MpegEncContext. + +commit 116ca147f03ca02b55c2fceef7b82c1b251b32f6 +Author: Alexander Strange +Date: Sat Aug 16 14:10:31 2008 -0400 + + Merge fallout: move AVCodec additions back to the end of the struct + +commit 11b1a8ee92128524a3259903c28da54ffd9a60fa +Author: Alexander Strange +Date: Sun May 30 10:02:16 2010 -0700 + + Update todo. + + I appear to have fixed the bug (the problem doesn't show in test.sh + anymore). Of course, there might be more. + +commit 120d790a3918f77444eed295aec6d8c34e4b532a +Author: Alexander Strange +Date: Thu Jul 17 18:00:07 2008 -0400 + + Simplify draw_edges changes and handle interlacing properly. + +commit 1239bcba12d0c57005ae59405e8b080ac3c7bd65 +Author: Alexander Strange +Date: Mon Aug 18 18:59:29 2008 -0400 + + Simplify: store FrameThreadContext in the user's context. + +commit 1292a1840bb5319f1438b63b7be35363ba4fe5b6 +Author: Alexander Strange +Date: Tue Jan 13 01:33:47 2009 -0500 + + Copy width/height between thread contexts for all codecs. + + This makes it user-visible and fixes compatibility with + bad demuxers that don't set it in avctx. + +commit 12c5de8ead7c7a1b4c03eb095a2db4357aa2538d +Author: benoit +Date: Thu Jan 3 08:39:38 2008 +0000 + + Make filterDelimiters and optionDelimiters two static constant array of + characters, should move them to .rodata. + Patch by Diego 'Flameeyes' Petten +� flameeyes commit 1327c17ca423f248dbce8172476dd69208f7d74b +Author: Alexander Strange +Date: Sat May 23 21:52:24 2009 -0400 + + Stopgap hack: don't crash with size-changing streams+frame threads + + MPEG1 and H.264 need their own checks, otherwise they immediately + deallocate shared data and crash. Another check is added to get_buffer + to cover remaining codecs (although it may not actually do this). + + This currently involves ugly code duplication, which can hopefully + be eventually removed. Unfortunately this is already not handled + well on mainline (such as in the previous commit). + +commit 138ec8aad228862d58582aa4bbd367b7fa7b8d81 +Author: Alexander Strange +Date: Thu Jul 24 16:06:17 2008 -0400 + + Factor out copying picture pointers in update_context. + +commit 13c48792ac24329c9055f6e98b5e61c278f1aa57 +Author: Alexander Strange +Date: Tue Mar 9 00:02:20 2010 -0500 + + Fix wrong timestamps with -threads 2 and BBB 1080p Theora + + It was caused by adding thread delay to has_b_frames. + -threads 2 -> has_b_frames 1 -> "delay==1" is true and the + "invalid dts/pts combination" was triggered. Not sure about this fix, + but I think it's harmless. + +commit 141516ca4f2b0008539ceeb70b46ebb6cfe4a1c0 +Author: Alexander Strange +Date: Sun Jun 15 17:44:29 2008 -0400 + + Cosmetics: use USE_ macro. + +commit 14476d56276a77a237834e88b28427fe491ac689 +Author: Alexander Strange +Date: Sat Aug 16 14:11:41 2008 -0400 + + Correct AVCodec member comments + +commit 14bdf768314413a099fe570891761360733b148c +Author: Alexander Strange +Date: Tue Mar 9 01:15:03 2010 -0500 + + Update sws. + +commit 14df94ceacecf041d33b8600bc9097d4befd79dd +Author: Alexander Strange +Date: Sun Feb 14 23:57:37 2010 -0500 + + Add a convenience function for avoiding deadlocks with decoder errors + +commit 156f6ba4db96f57c3c105b71986acaa9be13d5ab +Author: Alexander Strange +Date: Sun Aug 17 00:19:10 2008 -0400 + + Update todo + +commit 16343b25d2ffc7c18a00ec62db8e76d7f8217de5 +Author: Alexander Strange +Date: Sat Feb 20 22:39:05 2010 -0500 + + Rewrite comments for new codec callbacks + +commit 16b71c003150c3a44135ffa1bbc870ea43c15f7a +Author: Alexander Strange +Date: Thu Dec 18 14:37:04 2008 -0500 + + Some todo entries I forgot to add + +commit 16bde8c7df438f5283de102e3c872ef309a8d0b5 +Author: Alexander Strange +Date: Thu Jun 5 00:11:43 2008 -0400 + + Implement avcodec_flush_buffers for multithreaded codecs. + +commit 17b3c2a080f7ec1f548494e0e2b905ad0e2690c0 +Author: Alexander Strange +Date: Mon Aug 18 20:36:54 2008 -0400 + + Clarify use of is_copy + +commit 17d7a98c7aadc2be1ceadf875ae2ca71b08a5611 +Merge: 0097d3b 981f8d0 +Author: Alexander Strange +Date: Wed Sep 29 22:55:44 2010 -0400 + + Merge mainline. + + Fix misplaced lowres check from previous merge. (or maybe it was fine?) + + Conflicts: + libavcodec/avcodec.h + libavcodec/utils.c + +commit 17dcbec74c0630e44029dd5e4efd8f9bb2ddee13 +Author: Alexander Strange +Date: Fri Jul 24 16:51:14 2009 -0400 + + Fix typo in huffyuv, broke mt decoding with newer huffyuv versions. + +commit 17ef916da54e5cbaf2ce97cba565ba4730dcd847 +Author: Alexander Strange +Date: Tue May 11 14:39:44 2010 -0400 + + Cosmetics: remove stray spaces in pthread.c + +commit 1846cc0549bf3d45fb2a5a2152b7335c794146e8 +Merge: 5323bc6 cd23ede +Author: Alexander Strange +Date: Mon Mar 8 04:30:32 2010 -0500 + + Merge mainline. + + The VP3 decoder has been heavily changed upstream and this commit + removes mt optimizations. They will be readded later. + + Conflicts: + libavcodec/avcodec.h + libavcodec/h264.c + libavcodec/h264.h + libavcodec/h264_direct.c + libavcodec/vp3.c + +commit 1878dce0e65b2fab94612c950fac51e3de741636 +Merge: b7d1826 2b13612 +Author: Alexander Strange +Date: Sun May 24 01:37:21 2009 -0400 + + Merge mainline. + +commit 1884de3ffb775bb23cbfbf977ea48841c2b2ae16 +Author: Alexander Strange +Date: Fri May 8 00:15:50 2009 -0400 + + Correct comment about decoding delay. + +commit 18893e1423c3d8a65ca753806638ac160fefe342 +Author: Alexander Strange +Date: Sat Oct 23 18:13:56 2010 -0400 + + Add a -vsync test to test.sh. + + The files x-1-vsync.txt and x-3-vsync.txt should have the same MD5. + Even more ideally, all files should have the same MD5, but it's not our problem if they don't. + + h264 and theora pass, didn't test others. + +commit 18dc6b6010200c45827d14594a5d7b7b2b28d8e0 +Author: Alexander Strange +Date: Wed Aug 6 20:31:04 2008 -0400 + + Move ff_frame_thread_init above its uses and make it static since it has only one caller. + +commit 190d65b24795208e30c06369e34769ffeb9b5cc8 +Author: Alexander Strange +Date: Sun Aug 24 01:31:00 2008 -0400 + + Add a longer comment for update_context + +commit 19b159260eb5eddfd296cac179d59ba218f881ac +Author: Alexander Strange +Date: Fri Jan 21 01:22:43 2011 -0500 + + Adopt pkt_pts/pkt_dts in lavc clients + + This makes DTS reliable with threads. + +commit 1a0d8d0cd0d7d0dc44d1747b2c8c93c73bc09cd8 +Author: Alexander Strange +Date: Mon Jan 4 03:59:20 2010 -0500 + + Note in todo that 'make test' doesn't pass ATM. + + Also note a harmless warning emitted, which I haven't + though of a good fix for yet. + +commit 1a216093ed2f201814287a32b5d8f22781c6d8d1 +Author: Alexander Strange +Date: Mon Aug 25 01:02:29 2008 -0400 + + Comment another strange line + +commit 1a4740fed38a69202c762e3cd786dd3c7c23dd40 +Author: Alexander Strange +Date: Sat Jan 15 17:02:46 2011 -0500 + + Make ARM asm #error out, since the offset values are out of date here + +commit 1ac02d2ff0dd39d8baf68cf7e0490de4db9b88cc +Author: Alexander Strange +Date: Fri Jul 10 14:24:40 2009 -0400 + + Fix the error in avcodec_thread_init to actually not do anything. + +commit 1b735c493b0fe8c1aaff3d06214c24e8556b111c +Author: Alexander Strange +Date: Mon Aug 25 14:40:54 2008 -0400 + + Remove some context variable copies which were overwriting user settings + +commit 1b755181905bed35b2edd723c137b8f0af9c31c3 +Author: Alexander Strange +Date: Sat Aug 23 23:14:20 2008 -0400 + + Add a FIXME for PAFF + +commit 1c187ba01c332b3d99681cfffb90f0247a836303 +Merge: 8022069 0309093 +Author: Alexander Strange +Date: Mon Nov 15 05:32:06 2010 -0500 + + Merge mainline. + + Conflicts: + doc/APIchanges + libavcodec/avcodec.h + +commit 1c39407876cb6689e313ce27a51d83d77ac0c4e4 +Author: Alexander Strange +Date: Sun May 23 03:40:43 2010 -0400 + + Fix crash with ffplay. + + Caused by the buffer functions being changed after codec init. + +commit 1c70dfb14a5e6e322f66d1175045eb13ac96d2f8 +Author: Alexander Strange +Date: Sat Feb 20 22:10:38 2010 -0500 + + Rewrite thread.h comments for clarity + +commit 1c8037ec029ffe790b39b0cf0e67468db5f8c4a8 +Author: Alexander Strange +Date: Mon Jan 25 03:59:02 2010 -0500 + + Fix references to renamed avail_motion() in the todo. + + Delete the second entry mentioning it, since I don't think it's a + good idea anymore. + +commit 1ca44079c06a2080c2a0deb9cbc8fa757a5be540 +Author: Alexander Strange +Date: Sun Jun 15 20:34:08 2008 -0400 + + Delete unused variables. The frame counters will stay around for now for debugging. + +commit 1d15df4fd2b4583d56159a7938ef3699c7f46261 +Merge: 8f759fa b3b80f1 +Author: Luca Barbato +Date: Sat May 31 17:56:44 2008 +0200 + + Merge branch 'master' of git://git.mplayerhq.hu/ffmpeg + +commit 1da82befe53bc245ba94cf1012fcd0156040353c +Author: benoit +Date: Mon Jan 7 12:40:39 2008 +0000 + + Remove unused symbol. + + Patch by Diego 'Flameeyes' Petten +� flameeyes commit 1e8abec2eecd831c55e34c09fc9a38833d69c180 +Author: Alexander Strange +Date: Fri Jul 10 14:28:54 2009 -0400 + + Fix default value of thread_count. + + Adding a flag named "threads" somehow disabled the default value + of the option named "threads", which allowed thread_count to be 0 + for non-ffmpeg/ffplay clients (which don't always reset it). + + Not sure why AVOption works this way. + +commit 1eff8ec8e1772334cd74129f8cc068483c757b40 +Author: benoit +Date: Fri Aug 10 07:28:18 2007 +0000 + + Prefix with "opt_" the functions ffmpeg.c:show_{version,license,formats}. + patch by Stefano Sabatini [stefano tod sabatini-lala commit 1fae9e952cee3c499313b5a9b5c2e3dda096ee30 +Author: Alexander Strange +Date: Thu Mar 10 01:44:05 2011 -0500 + + Delete the libswscale submodule for svn->git merge. + +commit 2037d9714bc51ccb57a82aba95a52a5b49bdc401 +Author: Alexander Strange +Date: Sun Aug 24 21:16:50 2008 -0400 + + Comment this just in case someone doesn't get it + +commit 2063f77f904af3544021e16d6da76acf5d9beaed +Author: Alexander Strange +Date: Mon Nov 15 05:40:04 2010 -0500 + + Delete beosthread.c which is gone from mainline + +commit 207f434446b40b29311e81233167bd03de16bf0c +Author: Alexander Strange +Date: Wed Jul 30 20:14:56 2008 -0400 + + Cosmetics: whitespace adjustments. + +commit 20997d60c8ec84dd0dd68055901e847c4b4e171a +Author: Alexander Strange +Date: Sat Jun 27 22:33:17 2009 -0400 + + Frame threading for VP3 [2/2]. + + The performance with different thread counts is different from + MPEG codecs; trying more or less granular synchronization would + be interesting. + +commit 20a85842c46b547331c5884e015dd781108c6d17 +Author: Alexander Strange +Date: Sat Oct 11 16:43:39 2008 -0400 + + Save PAFF vs MBAFF information for pictures. + + This already exists differently in mainline, but this way is more useful + since MPEG-2 has field pictures but not MBAFF. + +commit 20d6c336b37a7bf7313865a397f19ef33595adf8 +Author: Alexander Strange +Date: Tue Dec 23 17:49:51 2008 -0500 + + More todo entries + +commit 210b4a63100e5f4ba5ab23e84460614ca59b7817 +Merge: fc957c7 59b0bd5 +Author: Alexander Strange +Date: Mon May 24 22:26:23 2010 -0400 + + Merge mainline. + +commit 21cede4223d4bcfcc0f6a91bbc84354238201fea +Author: Alexander Strange +Date: Mon Apr 19 03:30:45 2010 -0400 + + Fix possible overlapping memcpy()+crash at the end of decode + + Increasingly dissatisfied with having to do this. + +commit 22a56df3f22e5c32c5f2fd06db8d644157da1877 +Author: Alexander Strange +Date: Mon Jul 14 23:12:17 2008 -0400 + + Remove dead code. + +commit 22d953bd1ef2b61ec272be03aa8f81587e0ac046 +Author: Alexander Strange +Date: Wed Jun 25 04:54:34 2008 -0400 + + Remove zeroing mbskip_table + It's unnecessary with the previous commit. + +commit 22e9455a663acc4d34f76130f2603b41b3940b9e +Author: Alexander Strange +Date: Fri Aug 22 16:25:45 2008 -0400 + + Comment and rename context variables in pthread.c. + +commit 2331711a5ff0908a37005a0e500804a5a8a61e5d +Author: Michael Niedermayer +Date: Wed Apr 6 00:15:42 2011 +0200 + + Fix ffmpeg-mt fixme in h264 + + Uncommenting this code no longer seems to cause valgrind problems or crashes. + Behavior is unchanged. + +commit 234887b836f9b0306388d20499c8025ac916e11b +Author: Alexander Strange +Date: Tue Aug 19 21:17:15 2008 -0400 + + Normalize if (err) + +commit 2412ad4778734a19638c997d5567f5d53d135a9a +Author: Alexander Strange +Date: Mon Jan 17 15:57:00 2011 -0500 + + pthread: Document release_delayed_buffers + +commit 24345e509df0b92a3592cfb15db12b1aecd78ffe +Author: Alexander Strange +Date: Tue Aug 26 02:26:07 2008 -0400 + + Fix spelling and rewrap multithreading.txt to the right number of columns. + +commit 2485cfd74cf5012fdce8582b7094ddbd09bd70c9 +Author: Alexander Strange +Date: Sun May 24 03:38:22 2009 -0400 + + 10l: pred_direct_motion fix missed several mb_type accesses + + I have not proven this correct yet; it's not too hard with some work + (record the last row accessed and waited for, and make sure they + correspond). Therefore, I suspect it still isn't correct, since + framecrc still shows mismatches. It does fix the worst visible + errors, though. + +commit 25a2f117ad6d6dc2592e77369bed23e53241b218 +Author: Alexander Strange +Date: Fri Jan 21 03:24:41 2011 -0500 + + Cosmetic: shorter line variable declaration + +commit 26151296236e0381c1c40e0d97ead8c5ab26b57c +Author: Alexander Strange +Date: Tue Nov 2 02:33:12 2010 -0400 + + vp3: Lift up loop-invariant checks and simplify away 'border' which == 1 + +commit 27026500c9a25bf409b55186d9bceada4bf2ba5c +Author: Alexander Strange +Date: Sat Jul 19 02:09:18 2008 -0400 + + Fix mpegvideo crashing without --enable-pthreads due to the number of thread_contexts changing. + + -threads X no longer has any effect since all threading code is now gone without an actual threading library. + I think this is a nice minor size optimization, but if it's necessary to keep regression tests working with frame-threaded encoding I'll have to revisit it. + +commit 2742b2a142ff98e4611f96ddf47ab5a5233f4692 +Author: benoit +Date: Thu Jan 10 10:15:07 2008 +0000 + + Reduce the size of the replaceTable entries. + Patch by Diego 'Flameeyes' Petten +� flameeyes commit 287e761820e85514e00eb6c5958496ecb61825cb +Author: Alexander Strange +Date: Thu Dec 24 22:21:37 2009 -0500 + + Fix error return being ignored in VP3 allocate_tables(). + + Based on a patch by Yuriy M. Kaminskiy. + +commit 29c2b04f5074e49aa63cf50fb90e3a51e853ad9d +Author: Alexander Strange +Date: Sat Apr 4 00:35:28 2009 -0400 + + More todos related to init api + +commit 2a7a86a64f153befafabcbb987e2793fa4bb0e18 +Author: Alexander Strange +Date: Sat Jun 27 22:17:41 2009 -0400 + + Split out error returns in VP3. + +commit 2a9b493a5a0f46f43959ce2466849dd6a6217012 +Author: Alexander Strange +Date: Wed Feb 2 02:12:29 2011 -0500 + + Fix memory abandonment + unnecessary realloc in mpeg4 + + Fixes Sample1.mkv from ffms running out of address space (and more). + Note the file doesn't display properly in ffplay, so there's still bugs left. + +commit 2ae310bf292c1f34be006e9be7fbceb4c0f1b068 +Author: Alexander Strange +Date: Tue Jun 3 04:20:42 2008 -0400 + + Comment next_*_index. + +commit 2b74560715c3d4f331156d8745ce801c1de4d467 +Author: Alexander Strange +Date: Tue Nov 18 14:31:17 2008 -0500 + + Revert accidental warning change + +commit 2b7d2acccb45e89bfc77564bcdaee68fcb4ac4c7 +Author: Alexander Strange +Date: Tue Feb 1 23:05:43 2011 -0500 + + Revert 99ed04d4d7b7183a4d0a1b8833eee3b506e13ff0 + + Broke big_buck_bunny_720p_stereo.ogg with 2 threads. + +commit 2bbb64dae018cbb09ea47a6bdcb184f551136c26 +Author: Alexander Strange +Date: Wed Dec 15 16:15:21 2010 -0500 + + Fix definition of CODEC_CAP_FRAME_THREADS to not conflict. + +commit 2bc23e009291d727eed7a4f803a2793f5fa715b0 +Author: Alexander Strange +Date: Tue Aug 26 03:03:38 2008 -0400 + + Update avcodec.h comments + +commit 2bcbffdbf53bd2918ba6ade66d12fb97021032c7 +Author: Alexander Strange +Date: Sun Jun 15 20:26:59 2008 -0400 + + Combine all the condition variables into one. + +commit 2beb042a202d00dbb2baef3970f058994aeec027 +Author: Alexander Strange +Date: Sat Aug 23 19:32:56 2008 -0400 + + Split thread_algorithm into two more sanely defined variables. + + Also improves correctness in some ways. + +commit 2c0e016af759adfdc34a6a1b8592ec0a1ef56da9 +Merge: d5ea5fc c2c8552 +Author: Alexander Strange +Date: Thu May 7 17:36:13 2009 -0400 + + Merge mainline. + + Uses the minimal changes to get the new AVPacket API working. + + Conflicts: + libavcodec/avcodec.h + libavcodec/h264.c + libavcodec/mimic.c + libavcodec/options.c + libavcodec/utils.c + +commit 2c3cd96bf1cb1757407c973416f7928d492e2156 +Author: Alexander Strange +Date: Mon Aug 18 22:59:19 2008 -0400 + + Cosmetic rearranging of MPEG update_context functions + +commit 2cb0db5ba7d77ed8180f0551462c836047ea262e +Author: Alexander Strange +Date: Thu Jun 18 16:19:33 2009 -0400 + + Fix invalid Mimic stream handling + frame threads + + Releasing a frame after frame_setup_done isn't allowed, and + it must do report_decode_progress as if it was finished. + +commit 2d0370118996148f1c64b9c6b4a2ff632fcaf609 +Author: Alexander Strange +Date: Sun Aug 31 03:56:04 2008 -0400 + + Add fixme for copying packet data. + +commit 2e121780400cb6630a66a0b7bd3fe84ad539b882 +Author: Alexander Strange +Date: Fri Jul 11 18:21:08 2008 -0400 + + Increase the released buffer size to 16. H264 can release this many at an IDR, can other codecs have even more? + +commit 2e5a5baf540ae0d1ac16ae52f66254b7233aabf7 +Merge: 5d82241 31f0027 +Author: Alexander Strange +Date: Tue Mar 29 04:35:46 2011 -0400 + + Merge branch 'master' of git://git.libav.org/libav + + Conflicts: + libavcodec/dsputil.c + libavcodec/mpegvideo.c + libavcodec/snow.c + libavcodec/vp8.c + libavcodec/x86/dsputil_mmx.c + +commit 2e9d8893eac232b782b479378cf13d484ab9cc1e +Author: Alexander Strange +Date: Wed May 28 22:49:33 2008 -0400 + + Add thread.h + +commit 2eeab8f6ad07611e46b3377ddf73e1d7f1f2bb78 +Author: Alexander Strange +Date: Sun Aug 24 21:16:31 2008 -0400 + + General description and porting guide + +commit 2f1fec650f4bb351fa819fb7e11b4766a43fa30f +Author: Alexander Strange +Date: Tue Aug 19 01:20:32 2008 -0400 + + Simplify mimic_decode_end changes + +commit 2f48eac011767ba2d60329c10a22499c228a31d8 +Author: Alexander Strange +Date: Tue Nov 18 15:27:24 2008 -0500 + + Missed fixing pthread.c in merge. + +commit 2f8f77021011eec5af8cab80ee7bdc574ad3f37b +Author: Alexander Strange +Date: Fri Jan 21 03:01:42 2011 -0500 + + pthread: Style and comment nitpick for validate_thread_parameters() + +commit 300b5819426ed6b35aaa480502070382e5295111 +Author: Alexander Strange +Date: Sun Aug 17 14:07:06 2008 -0400 + + Copy aspect ratio info between contexts. + +commit 3029628ce39e37c9ae77cb78f22ab9d4846e6610 +Author: Alexander Strange +Date: Sun Aug 31 15:15:15 2008 -0400 + + Fix compiler warnings + +commit 303cd6307958792faac1ce8c8c81eea2651b002f +Author: Alexander Strange +Date: Thu Jun 19 18:31:17 2008 -0400 + + Use MPV_report_decode_progress in mpeg12, and call it before mb_y++. + +commit 30e540672df8523a47013d92592b744459040904 +Author: Alexander Strange +Date: Mon Oct 13 15:00:39 2008 -0400 + + Make every thread lock the same buffer_mutex for get_buffer. + + Otherwise it isn't actually protecting anything... + +commit 3106e8ebe7c55eba3e41f3a11cc23eb249a4ff3b +Author: Alexander Strange +Date: Mon Jul 14 23:09:47 2008 -0400 + + Always set thread_context[0] in MpegEncContext. + This fixes mpeg* encoders always crashing, but most of the regression tests are still failing. + +commit 3127a4bd6e36bb2d9cd2fe12a96fa776d94fed94 +Author: michaelni +Date: Sat Nov 2 10:47:44 2002 +0000 + + added BeOS net_server support (R5 network stack), basically the same + problems as with winsock (sockets != fd), and the broken select(). + based on older patch by Andrew Bachmann. + patch by (Fran +commit 314c2b1d2f94be3b6aca3dd1ae0f30c05f10f2ee +Merge: 9816b66 bd8850b +Author: Alexander Strange +Date: Tue Feb 17 22:41:31 2009 -0500 + + Merge branch 'master' of git://git.mplayerhq.hu/ffmpeg + + Conflicts: + + libavcodec/avcodec.h + libavcodec/mimic.c + libavcodec/mpeg12.c + libavcodec/mpegvideo.c + +commit 314e5630e389457319ff2d11e856fab6b1d8b250 +Author: benoit +Date: Mon Jan 7 12:47:14 2008 +0000 + + Move wmv1_scantable to .rodata section by making it an array of arrays. + Patch by Diego 'Flameeyes' Petten +� flameeyes commit 31e3f669b598302b2a487dab84e08bf4d1e79983 +Author: Alexander Strange +Date: Thu May 7 18:06:52 2009 -0400 + + Fix mplayer patch's calculation of extra delay. + + It's only (num_threads-1) frames with MT on, not num_threads. + +commit 31f1a603dcfe885c41d123832f102a3ccc55c6dd +Author: Alexander Strange +Date: Sun Aug 24 00:20:03 2008 -0400 + + Rename threading functions with 'decode' in their name + +commit 333777b56b942a11db5d672433357bcbbf0d6e47 +Author: Alexander Strange +Date: Tue Aug 19 01:14:48 2008 -0400 + + Cosmetic changes to mimic + +commit 33bc3cc94a5a6e2679306da899afb1e0ce6b78c6 +Author: Alexander Strange +Date: Thu Aug 14 14:01:15 2008 -0400 + + Reindent. + +commit 3444ffe523dd65b788791dfb2c6cbd7031cfec97 +Author: Alexander Strange +Date: Wed Aug 6 20:24:44 2008 -0400 + + Cosmetics: rename last_thread to prev_thread to avoid final vs. previous confusion. + +commit 344df336a0b5e70ef9fcea33f612f759bc045552 +Author: Alexander Strange +Date: Mon Apr 19 03:31:30 2010 -0400 + + Reindent + +commit 3547c7f44108f1080f90de1844c36fb172528994 +Author: Alexander Strange +Date: Sat Feb 20 19:40:48 2010 -0500 + + API simplification: remove ff_report/await_frame_progress() + + The field variants are enough. + Note that mpegvideo.c thread code doesn't need to support any codecs + with field pictures. + +commit 3630d89a7bd6443f9aeda2f6997fb2ea5da5c97d +Author: Alexander Strange +Date: Thu Dec 18 12:36:20 2008 -0500 + + Copy dequant4/8_buffer between H264 decoding threads. + + Fixes at least: + MSG00 ED.mkv + freedom EP1 sample.mkv + made with unknown encoders. + +commit 36977df5243521eaa3ab1b67f3c89d1a1ba4c8f7 +Author: Alexander Strange +Date: Mon Aug 18 22:03:25 2008 -0400 + + Move copying idct_algo to the right place + +commit 379271216e0d522b675e97189ab5d4e5cf7f5f70 +Author: Alexander Strange +Date: Mon Apr 19 03:35:28 2010 -0400 + + Update todo. + +commit 37b38ff868fa39f75df9c1bd543fd1c2dc7134ae +Author: Alexander Strange +Date: Sat Feb 20 20:31:16 2010 -0500 + + Update the comment for FF_THREAD_FRAME. + +commit 382e06ef4ba568c565b9d67b33b1688a32b2b80e +Author: Alexander Strange +Date: Tue May 11 06:21:06 2010 -0400 + + pthread: Use av_fast_malloc to allocate the frame buffer + + Also delete the FIXME; it's impossible because the AVPacket memory + API doesn't actually work. + +commit 3934d02026fb67b46441176c4160c0f854c12825 +Author: Alexander Strange +Date: Mon Jul 21 18:10:58 2008 -0400 + + Reindent. + +commit 39eee0b91b9b6b75c54ff68d51ecc0ba1816c88f +Author: Alexander Strange +Date: Sun Jun 22 03:36:24 2008 -0400 + + Multithreading support for MPEG-4 + This requires more parallelism barriers than usual because of the horrible skip MB structure in B-frames. + +commit 3ad85b1741ca6d36126bbf674f5b82d550107bae +Merge: ff4c627 4495490 +Author: Alexander Strange +Date: Tue Oct 6 16:12:06 2009 -0400 + + Merge branch 'master' of git://git.mplayerhq.hu/ffmpeg + + Conflicts: + libavcodec/avcodec.h + libavcodec/mpegvideo_enc.c + libavcodec/snow.c + libavcodec/vp3.c + +commit 3afd3f52b940d0bfa756e1a7496a20d103c5a7f0 +Author: Alexander Strange +Date: Fri Jul 25 03:25:00 2008 -0400 + + Merge MPV_update_picture_pointers() into its only caller. + +commit 3ba8143c5da92197eb45fa120bfa95b38adfd3bf +Author: michaelni +Date: Sat Nov 2 10:35:07 2002 +0000 + + added BeOS net_server support (R5 network stack), basically the same + problems as with winsock (sockets != fd), and the broken select(). + based on older patch by Andrew Bachmann. + patch by (Fran +commit 3bac11e47a0ec7c6036c53a1173bce276abccfeb +Merge: 53fff22 3d42d49 +Author: Alexander Strange +Date: Sat Apr 9 21:30:16 2011 -0400 + + Merge mainline. + + Conflicts: + libavcodec/h264.c + +commit 3bef1503e0f23c0f30c2e3b2de64a9b2618807d2 +Author: Alexander Strange +Date: Sat Jun 27 16:18:44 2009 -0400 + + Add debugging hooks to show ff_report/ff_await calls. + +commit 3c3a3648317737830fc863371b455624d093f8e6 +Author: Alexander Strange +Date: Sat Oct 18 17:39:17 2008 -0400 + + Fix possible null pointer access after seek. + +commit 3c7a8d94b97003b118c2438343d06ad7cf26198a +Author: Alexander Strange +Date: Tue Mar 9 00:04:51 2010 -0500 + + Reimplement VP3 multithreading. + + Synchronization is now not very fine-grained, because it reuses + vp3_draw_horiz_band which runs every ~64 pixel rows. + +commit 3cfd7b2e788c3d8e31c91ed529f3e3730f836395 +Author: Alexander Strange +Date: Mon Jun 23 23:14:05 2008 -0400 + + Wrong kind of #if. + +commit 3f7521893b9072181763ea176ef8da0c0ad1922a +Merge: ed42183 206c937 +Author: Alexander Strange +Date: Sun Oct 10 01:47:32 2010 -0400 + + Merge mainline. + + API change: CODEC_CAP_FRAME_THREADS is now defined as 0x800. + + Conflicts: + libavcodec/avcodec.h + +commit 3f858091f8f3cd43f1eed396e85f6956ee5068a0 +Author: Alexander Strange +Date: Tue Aug 19 02:35:52 2008 -0400 + + Fix losing frames at the end of an encode + +commit 3ffe81697018042b27a31f20c1d30c988b688d60 +Author: Alexander Strange +Date: Thu Jun 12 18:22:42 2008 -0400 + + Reindent. + +commit 401a6bc7f0fe26963f63778c5092ae96c4262634 +Author: Alexander Strange +Date: Thu Jun 25 19:07:58 2009 -0400 + + Frame threading for VP3 [1/2] + + update_context function and compatibility fixes. + +commit 40265f10de7698bb2fe23857cf261a0f04fe18a1 +Author: Alexander Strange +Date: Mon Oct 13 14:19:27 2008 -0400 + + Fix edge drawing for non-mod-16 files. + +commit 4074c8bfba918988029ce106eda3d41486f12966 +Author: Alexander Strange +Date: Sat Jul 12 00:11:35 2008 -0400 + + Copy more MpegEncContext variables. + These are needed for proper DivX/H.264 decoding. + +commit 40ffd3a664e36f44ebdf4d2603e42c7c59502599 +Author: Alexander Strange +Date: Thu Jul 23 21:40:06 2009 -0400 + + 100l, fix compile error introduced by automerge + +commit 4118a72e28be1cee657561a1f45dc3ce160dbf07 +Author: Alexander Strange +Date: Thu Mar 10 02:46:14 2011 -0500 + + Update todo.txt + +commit 41e0f81a58493a0a15cb18c7ff00920f0fd124a3 +Author: Alexander Strange +Date: Sun Aug 24 02:52:18 2008 -0400 + + Remove unneeded stubs from thread.h + +commit 4259f9fcf4edc5c92bc02d37d85493b3eb917075 +Merge: 2615129 fb61692 +Author: Alexander Strange +Date: Tue Nov 2 02:36:20 2010 -0400 + + Merge branch 'master' of git://git.mplayerhq.hu/ffmpeg + +commit 4293f5ba301cd751257705bfe6fc8b12337dccab +Author: Alexander Strange +Date: Mon Jul 14 23:20:17 2008 -0400 + + Disable multithreading for packed B-frames. + The bitstream buffer is updated after decoding, so it has to be changed to find the frame end before starting the actual decode. Assuming that's not too slow. + +commit 42b521db9177ed2d4e62845659fdcd44c59757f9 +Author: Alexander Strange +Date: Fri May 8 00:40:57 2009 -0400 + + 10l: dequant_coeff must be copied along with dequant_buffer + + Fixes more Blu-Ray streams which change CQM, including Slumdog + Millionaire. + + Noticed by Haruhiko Yamagata. + +commit 435ace7689e2794ddbb4013de097bdaf487f7365 +Author: Alexander Strange +Date: Sat Apr 9 21:47:12 2011 -0400 + + Update test scripts to use ffmpeg instead of ffmpeg_g + +commit 435adcd213762869c6a6f806481450216720b364 +Merge: 6ee99a7 11dcccd +Author: Alexander Strange +Date: Thu Mar 10 01:25:24 2011 -0500 + + Merge remote-tracking branch 'socrep/last_mainline_point' into last_git_point + +commit 451af22792e7bec6f3b347ba801ba186102a85da +Author: Alexander Strange +Date: Mon Jul 14 04:13:33 2008 -0400 + + Call draw_edges per-MB-row instead of per-frame when possible. + This is necessary for multithreading, since rows aren't complete until their edges are mirrored. + It should also be somewhat more cache-efficient, but I haven't benchmarked it properly yet. + I don't like adding new MpegEncContext variables, but edge_y lets it do the right thing wrt. error resilience and codecs that don't call ff_draw_horiz_slice. + +commit 452fb04633126605afbb2cd0d6383bb75fe01f38 +Author: michaelni +Date: Fri Nov 8 20:54:44 2002 +0000 + + ringbuffer patch by (Fran +commit 4681ac8f618586d4a3ecb04784b9cf896d070f1b +Author: Alexander Strange +Date: Tue May 11 14:43:29 2010 -0400 + + Cosmetics: vertical alignment + +commit 468eba33060aa87117ac6b617d4eae776951cbf6 +Merge: 3c7a8d9 aa86abc +Author: Alexander Strange +Date: Tue Mar 9 00:55:42 2010 -0500 + + Merge mainline. + + The error condition in vp3_decode_frame was uglified to make the + diff simpler. + + Conflicts: + libavcodec/vp3.c + +commit 46a45ad599db4037006b335fca2c7b7bed7018ab +Author: Alexander Strange +Date: Sat Aug 2 00:22:16 2008 -0400 + + Clear thread variables in avcodec after freeing them. + +commit 46b495ebc4a7fb7662580791e4ed10130b00fead +Author: Alexander Strange +Date: Thu Jun 12 17:16:31 2008 -0400 + + Don't allocate duplicate contexts if they're not going to be used. + +commit 46ec6b90e7b2d6b1d83a207025a691c56176d686 +Author: Alexander Strange +Date: Mon Jun 16 18:21:04 2008 -0400 + + Multithreading support for MPEG-1. + +commit 46fc25f5c225e2f33430e31a0d0ad375455e9cef +Author: Alexander Strange +Date: Mon Nov 1 12:20:12 2010 -0400 + + Update todo.txt + +commit 473799e0c3b647d73046c3b4de30e85bf57ba610 +Author: Alexander Strange +Date: Tue Aug 19 21:16:59 2008 -0400 + + Whitespace fix + +commit 47869edb7f0aede0a2bfd178ef9937e28bf8b01f +Author: Alexander Strange +Date: Sun Feb 14 23:41:12 2010 -0500 + + Fix buffer leak in VP3 by allowing update_context() with the same context. + + I assumed update_context() would only be used to copy values, so skipped + calling it with duplicate parameters (during flush and free) for optimization. + + But VP3's release_buffer call was moved from the end of decoding to the + end of update_context(), so flushing would skip releasing a frame and + eventually run out of buffers. + + Unfortunately this makes update_context() much uglier in codecs that + already worked, because memcpy doesn't allow src and dst to be the same. + +commit 480a82da7912bc5034a4b0bc2090879920567521 +Author: Alexander Strange +Date: Thu Sep 30 01:13:43 2010 -0400 + + Update todo. + + ffplay/ffmpeg support for better a/v sync support is in progress. + If Theora uses PTS (I think it does), then once ffmpeg.c i + ready it can be submitted to mainline. + +commit 4845b04ed3d6bc513a272da718629d110bc8186f +Author: benoit +Date: Mon Jan 7 12:43:04 2008 +0000 + + Mark the tables in g726.c as constant. + Patch by Diego 'Flameeyes' Petten +� flameeyes commit 485d8e9e3c5de803075c8440922e6e09b10a1e57 +Author: Alexander Strange +Date: Sun Sep 14 20:45:58 2008 -0400 + + Fix ff_report_*_progress side of H264 multithreading and merge draw_horiz_band into it. + +commit 4874d258345ec305b0eca78c41491878d42a900d +Author: Alexander Strange +Date: Tue May 11 14:45:39 2010 -0400 + + Cosmetics: reorder variable declarations + +commit 48d2183d902db7cc42c9f84d2bad6eccc35d0221 +Author: Ronald Bultje +Date: Mon Apr 11 14:58:11 2011 -0400 + + Release unused pictures even when not calling ff_h264_frame_start() + + Unused pictures assigned to the thread can build up and cause it to + run out of buffers if the thread only ever decodes bottom field pictures. + +commit 48d7f5a8f3f14535d74f0e4b0a736e3f5dc336b2 +Author: Alexander Strange +Date: Mon Aug 18 19:58:18 2008 -0400 + + Factor out freeing delayed released buffers. + +commit 49652059c673eb977e5b69ffb0c8a543c3210e16 +Merge: a2efd25 48e59eb +Author: Alexander Strange +Date: Sat Jan 15 17:01:41 2011 -0500 + + Merge mainline. + + Conflicts: + doc/APIchanges + libavcodec/avcodec.h + libavcodec/h264.c + libavcodec/utils.c + +commit 4969bb89e592c003a560e321f3cacb412a192db9 +Author: Alexander Strange +Date: Thu Jul 31 14:30:40 2008 -0400 + + Copy avcC variables in H264Context. + +commit 496ec27adcef84278e650b29f4d22aba383d705a +Author: Alexander Strange +Date: Sat Sep 13 16:20:03 2008 -0400 + + Correct interlaced draw_edges. + + There is still a race condition when fields are decoded in different threads, + so for now we pretend EMU_EDGE is set instead of using the edges. + +commit 498ddbb3b2d78819540c1b8fff9a2bc495a33346 +Merge: aaa05da 95b6213 +Author: Alexander Strange +Date: Wed Nov 3 18:34:04 2010 -0400 + + Merge mainline. + + Conflicts: + libavcodec/avcodec.h + +commit 49e377f9f23904ed790e98175b1575bba6ecc6cb +Author: Alexander Strange +Date: Tue Jul 15 03:30:28 2008 -0400 + + Add update_context() for H.264. + This seems to lose reference frames for my PAFF sample, which I'll fix after I find out how PAFF works. + +commit 4adb7fbed7dcb12dda0f3919188334a3b96efb0a +Author: Alexander Strange +Date: Mon Aug 18 20:02:12 2008 -0400 + + Cosmetics: get rid of unhelpful comments, useless braces, and some whitespace/align issues + +commit 4af5480a021156089c193ce2215994cfd170e4e6 +Merge: 2f48eac 1bf5327 +Author: Alexander Strange +Date: Fri Nov 28 22:48:24 2008 -0500 + + Merge mainline. + + Conflicts: + + libavcodec/h264.c + libavcodec/mpegvideo_enc.c + +commit 4b9ce55576ab27f6a45d542bfda7c1e21fb967f8 +Merge: 1fae9e9 435adcd +Author: Alexander Strange +Date: Thu Mar 10 01:54:16 2011 -0500 + + Merge branch 'git_equiv_of_mainline' + +commit 4c726e5e30e1f48619eecbec5442acd63e895318 +Author: Alexander Strange +Date: Wed May 28 22:40:30 2008 -0400 + + Rename pthread.c to thread.c + The remaining *thread.c files will be merged into it later. + +commit 4c802e44f13672dd4527f51fc2f07a1e21be4a5c +Author: Alexander Strange +Date: Mon Jun 2 04:31:45 2008 -0400 + + Simplify ff_await_decode_progress. + + Always set and allocate the progress pointer, so ff_await_decode_progress doesn't have to check for threading to be on. + +commit 4cdd15a3cf5dfec32ace278cd445f04130ddbee0 +Author: Alexander Strange +Date: Sat Jan 15 19:26:14 2011 -0500 + + pthread: Call external get_buffer() on the client's thread by default + + This fixes several mplayer VOs that crashed when they were called from decoding + threads. + + Not a complete fix as mplayer still doesn't work right with draw_horiz_band() + being called from decoding threads, but that doesn't crash at least. + +commit 4d2f536b72ec9121b5afe858b69c93d9cc75f20a +Author: Alexander Strange +Date: Sat Aug 30 04:20:20 2008 -0400 + + Simplify draw_edges changes by removing edge_y (which is useless with slices) + +commit 4d8525ab388d34e128629b08ab88c6a16f3aa406 +Author: michaelni +Date: Sun Jul 21 07:59:17 2002 +0000 + + nanosleep patch by Fran +commit 4edb9a7f780a6eaef36512724e6a34c3f38d67ce +Author: Alexander Strange +Date: Mon Feb 15 00:31:31 2010 -0500 + + Disable mpeg1 frame threading. + + Seeking doesn't work (it triggers false error conditions) and it doesn't + pass test.sh (-threads 2-4 match but 1 doesn't somehow). Will be reenabled + when those are fixed. + +commit 4f9364563f388af84b9a02930b375ff52eee1394 +Merge: 3bac11e 347b375 +Author: Alexander Strange +Date: Sat Apr 9 21:30:47 2011 -0400 + + Merge branch 'master' of git://git.libav.org/libav + +commit 4fb1fdf1ca1a48aff176b8f833ca596d245d6d36 +Author: Alexander Strange +Date: Tue Jul 15 03:30:50 2008 -0400 + + Reindent. + +commit 4fb33e68ec34cbc135ce4ebb86f7e1399ba97115 +Author: Alexander Strange +Date: Mon Jun 23 22:11:58 2008 -0400 + + Merge statements. + +commit 5022ee29ac6d4b2ee992115c3bf997e7bd1ab7a4 +Author: Alexander Strange +Date: Thu Jun 5 20:30:27 2008 -0400 + + Add delayed_release_buffer for handling reference frames. + +commit 5066a4656963dd3b4e847a540353bf71d318de14 +Author: michaelni +Date: Tue Nov 5 00:07:05 2002 +0000 + + lrintf detection (based upon a patch by Fran +commit 50d1ce2db57e39b6115642d3c4397e9f67f758e3 +Author: Alexander Strange +Date: Sun May 24 00:08:03 2009 -0400 + + Call codec init at a more reasonable time. + + Previously it was delayed until the first decode_video() call, + but it can be moved into avcodec_thread_init(). This makes pix_fmt + available to clients after init again, which should make them happier. + +commit 50eaf4979eb085e2c58c06912bb0c885404d4470 +Author: Alexander Strange +Date: Thu Aug 28 17:39:28 2008 -0400 + + Simplify changes to non-pthreads and don't call thread_init from open if it was already called. + + This will cause an assert failure if clients call thread_init again after open. + +commit 51428e56c71512a57f81d85acee3ced7cc0d2983 +Merge: 00425e9 03586fd +Author: Alexander Strange +Date: Sat Jul 4 16:41:31 2009 -0400 + + Merge branch 'master' of git://git.mplayerhq.hu/ffmpeg + +commit 517d68c2642aee3c14fc71031c1e44c0803a664e +Author: Alexander Strange +Date: Mon Mar 8 04:43:06 2010 -0500 + + h264: change the definition of col_fieldoff to avoid divisions + +commit 5186276ed120294fb6a4f2cf5a40d5019012482f +Author: Alexander Strange +Date: Sun Jan 16 22:01:18 2011 -0500 + + libavfilter input_get_buffer is thread-safe + + Slightly faster ffplay playback + +commit 51ead6d2c40c5defdd211f435aec49b19f5f6a18 +Author: Ronald Bultje +Date: Mon Apr 11 10:14:38 2011 -0400 + + h264: Fix decoding race condition with PAFF + + A thread can release a Picture and immediately reuse the same Picture + for a different frame. This is fine, unless the picture released was + a field-picture. In that case, there may be a future thread still decoding + the second field of the picture, and reusing it overwrites the shared fields + in the Picture. + + Fixed by tracking ownership of Pictures and allowing it to be reassigned + to the second thread's context. + + Fixes conformance sample HPCAMAPALQ_BRCM_B.264. + vsync still fails, and therefore FATE does as well. + +commit 521f07e3cf2dfb9b0473027ae2fbb6bd4f203ce4 +Merge: 7d0709e 4a8d06e +Author: Alexander Strange +Date: Sun May 31 00:08:08 2009 -0400 + + Merge mainline. + + Conflicts: + libavcodec/avcodec.h + +commit 52b214211060b56e7aac6b9743fa27bc79f789d1 +Author: Alexander Strange +Date: Wed May 28 02:15:47 2008 -0400 + + Enable multithreading for Mimic. + +commit 5323bc6e8adbff2b6849a08e9e071f22241fd807 +Author: Alexander Strange +Date: Sat Feb 20 22:48:51 2010 -0500 + + Cosmetics: add () to function name + +commit 5340d1ffae10b1545d88b9dd8ca86a5a3aaffca7 +Author: Alexander Strange +Date: Wed May 28 02:15:47 2008 -0400 + + Enable multithreading for Mimic. + +commit 534516ac79adc69d8773ff934955532a92db2cf1 +Author: Alexander Strange +Date: Sat Aug 16 00:01:07 2008 -0400 + + Fix a memory corruption bug in update_context and reenable H264 multithreading. + +commit 535de6d374ab6b06041f5e3cb392327abd2ce054 +Merge: 6abde3d cc8161e +Author: Alexander Strange +Date: Tue May 11 04:08:37 2010 -0400 + + Merge mainline. + +commit 5380fee33a871580fe9f3424767eaf2362c8cde0 +Merge: ef2d866 08c0efd +Author: Alexander Strange +Date: Sun Jun 13 23:43:37 2010 -0700 + + Merge mainline. + +commit 538a29e12f115390a64ceb3d4909a4a67cad26cd +Author: Alexander Strange +Date: Tue Aug 19 15:48:55 2008 -0400 + + Make diff smaller + +commit 53c86e82af6757c12df3a99aede6862a311f050b +Merge: fa8a82e ae2df26 +Author: Luca Barbato +Date: Sat May 3 16:13:06 2008 +0200 + + Merge branch 'master' of git://git.mplayerhq.hu/ffmpeg + +commit 53cd195c8885125351a03cfb6f1d93e66d433b86 +Author: Alexander Strange +Date: Mon Nov 15 05:00:01 2010 -0500 + + Rewrite multithreading.txt + +commit 53fff221cdb9f18df2f2f52bd48731ce0fa9e114 +Author: Maksym Veremeyenko +Date: Wed Mar 30 13:20:23 2011 +0300 + + mingw32 compilation after 'unbreak avcodec_thread_init' + +commit 5402adfa2e9c159e7d13ee07e142cb035a77ef95 +Author: Alexander Strange +Date: Tue Dec 16 16:54:20 2008 -0500 + + Only write to stderr once for each av_log(). + + This makes logging somewhat easier to read with multiple threads. + +commit 541d79def90226cc9b17e6ccc9eb2ff2549bea46 +Author: Alexander Strange +Date: Fri May 15 17:54:20 2009 -0400 + + Remove useless volatile qualifiers + + All such accesses must be protected by a mutex anyway, which is + already a memory barrier, so this doesn't change anything (assuming + a working compiler). + +commit 544c6a6709833f1a449b8faf4478ab529e269240 +Author: Alexander Strange +Date: Sun Mar 29 02:28:29 2009 -0400 + + Frame threading support for HuffYUV decoding + +commit 54c0c3d2ce69606a5aa508659d3322f48ada77cb +Author: Alexander Strange +Date: Wed Sep 3 11:59:59 2008 -0400 + + Call decode_postinit from the right place to avoid race conditions + +commit 552a89508fddc64d4217b9d845e458f504b63593 +Author: Alexander Strange +Date: Sat Jun 27 15:22:52 2009 -0400 + + Print md5s of test output files in test.sh. + +commit 55c511eedb24ffb09aef7072c02e911576c9900b +Author: Alexander Strange +Date: Mon Jan 25 02:47:19 2010 -0500 + + Did a todo item + +commit 574d2e5b942aa1e093bf768cc6321f3b081d3aeb +Author: Alexander Strange +Date: Sat Jul 5 23:36:08 2008 -0400 + + Merge enum with its only use. + +commit 578f45c15026e778ef54694d98a9ec446810a897 +Author: Alexander Strange +Date: Sun Jun 15 17:42:56 2008 -0400 + + Reindent. + +commit 5918efedbb7928031b6af745acb8b4233c08fb06 +Merge: 7d09b68 c2a400d +Author: Alexander Strange +Date: Thu Aug 14 21:37:03 2008 -0400 + + Merge branch 'mainline' + +commit 59d787ffccaf42e992229649c23e624ea7d71635 +Author: Alexander Strange +Date: Mon Nov 15 05:39:12 2010 -0500 + + Delete os2thread.c which is gone from mainline + +commit 5a7146bf75a2170f33ff25b88b91f667574d2919 +Author: Alexander Strange +Date: Wed Aug 11 01:33:20 2010 -0700 + + vp3: Fix a crash decoding files with +Date: Fri Apr 1 19:19:34 2011 -0400 + + pthread: validate_thread_parameters() ignored slice-threading being intentionally off + +commit 5b7c668d1f64facfe8b9f86e2491085595fa9bc7 +Author: Alexander Strange +Date: Tue Aug 12 20:26:26 2008 -0400 + + Document thread-safety requirements for user callbacks in AVCodecContext. + +commit 5bacdcc1a52e2b1d32bad9e9f250ceb6cc37f366 +Author: Alexander Strange +Date: Sat Oct 11 15:40:47 2008 -0400 + + Fix progressive height values in avail_motion() + +commit 5c46573ed07b092aea0db6560ade77bc299c28cb +Author: Alexander Strange +Date: Mon May 25 22:16:23 2009 -0400 + + Whitespace error + +commit 5c4c8ed51da0be4f141a4de339db77f4a0a6c783 +Author: Alexander Strange +Date: Mon Sep 1 03:18:55 2008 -0400 + + Remove unused variable + +commit 5d3c2f7512746dd0adf067952ed38d8111d7571d +Merge: 7041a16 5a70b15 +Author: Luca Barbato +Date: Sun Jul 6 12:38:18 2008 +0900 + + Merge branch 'master' of git://git.mplayerhq.hu/ffmpeg + +commit 5d53ada4cbd323d66b61965b1442d0abd63361b2 +Author: Alexander Strange +Date: Sun Jan 24 17:00:18 2010 -0500 + + Don't load PerThreadContext until it's needed in ff_await/report_*. + + Should avoid crashes if anything calls them without using ff_get_buffer. + +commit 5d7dfbb887f263b036224bf4510db176fa6cff73 +Author: Alexander Strange +Date: Mon Jun 16 18:18:53 2008 -0400 + + Utility functions for mpegvideo threading. + +commit 5d82241b49a1fb1dbecd1b279045cce9f099c775 +Author: Alexander Strange +Date: Thu Mar 24 03:34:48 2011 -0400 + + Update todo. + +commit 5eb0c649c780e26a77085bd213f945d88761ad00 +Author: Alexander Strange +Date: Mon Jan 4 04:12:44 2010 -0500 + + Make ffplay -drp the default. + + Ignoring reordered/delayed PTS never works with frame threading. + This may be changing behavior too much; I haven't tested this + with non-mt files, but I think the current behavior must cause + A/V desync even there. + +commit 5eb679f0fff432ba2c9e0cdada254dbe4bd4a45d +Author: Alexander Strange +Date: Mon Nov 15 02:53:14 2010 -0500 + + Remove width/height changing checks from h264/mpeg12 + + These should be moved to pthread.c update_context_from_thread() if they're needed, + not kept in specific codecs. Hopefully the error return from get_buffer() is + enough to make it not crash anyway. + +commit 5edf2cc5acbb410ba50a3770e8565fb39206f406 +Author: Alexander Strange +Date: Mon Jun 16 18:20:54 2008 -0400 + + Multithreading support for mpegvideo decoding in general. + +commit 5ef4af7de47c3913ddc1e09e43887ac04ecfaba3 +Author: Alexander Strange +Date: Sun Jun 15 01:58:15 2008 -0400 + + Fix ff_delayed_release_buffer crashing with slice-threading. + +commit 604ee5471f21d310f4014011a20c00c28a31995b +Merge: 3792712 7838828 +Author: Alexander Strange +Date: Wed Apr 21 22:04:21 2010 -0400 + + Merge branch 'master' of git://git.mplayerhq.hu/ffmpeg + +commit 607edd221a3b7a300fbaa4a5495ffd30f8dc9fa8 +Author: stefano +Date: Mon Jul 26 14:30:47 2010 +0000 + + Define static functions fill_image_linesize() and + fill_image_data_ptr(). ff_fill_linesize() and ff_fill_pointer() now wrap + these functions. + + The new functions are more generic, and are going to be exported in a + future patch. + + Patch by S.N. Hemanth Meenakshisundaram smeenaks # ucsd commit 60be6c15c4d23c5107f14e408043988918a44c76 +Author: Alexander Strange +Date: Sat Jun 20 16:07:58 2009 -0400 + + Add a valgrind script so I don't have to type it all the time. + +commit 614d2308b343ec6af6bf72ada08884684bb66df0 +Author: Alexander Strange +Date: Wed Sep 3 22:55:22 2008 -0400 + + Update header guard + +commit 62830f5772dd8971032aa9f8d52a8f6c00c92487 +Author: Alexander Strange +Date: Thu Jul 17 19:04:19 2008 -0400 + + Remove next_delayed_pic, it doesn't prevent any race conditions. + + This part is now entirely out of sync with mainline. + +commit 62ba7a4acc98b691ab3152356cf0c21a52f7e03b +Author: Alexander Strange +Date: Sun Jun 15 19:22:41 2008 -0400 + + Fix the main thread hanging if there's an error before all of the frame is decoded. + +commit 63d086d2585d3275a6b9068ee1ca957617ecf902 +Merge: 314c2b1 712afbf +Author: Alexander Strange +Date: Wed Feb 18 21:29:44 2009 -0500 + + Merge branch 'master' of git://git.mplayerhq.hu/ffmpeg + +commit 63f663f09320851b9ed76f489fdab590da2fc7f0 +Merge: 64df3aa d61efce +Author: Luca Barbato +Date: Sat May 10 07:51:22 2008 +0200 + + Merge branch 'master' of git://git.mplayerhq.hu/ffmpeg + +commit 63ff6aa525faf65f86dfbc8ec571fd260844100f +Author: Alexander Strange +Date: Sat Oct 23 18:07:14 2010 -0400 + + Don't set avctx->thread_count to 0 in avcodec_thread_init. + + h264 crashes during decode init with 0 (instead of 1) threads. + Note that this isn't a regression from -mt, but is actually a bug present in mainline. + + -threads 0 should preferrably set auto threads, but doesn't. + +commit 641f2752c16aaa25c5854d34726b72f226003b87 +Author: Luca Barbato +Date: Sat May 3 12:20:42 2008 +0200 + + Ignore stuff + +commit 6446d2b0931c6a9637077b18b98af911d438057f +Author: Alexander Strange +Date: Thu May 7 01:38:16 2009 -0400 + + Update mplayer.diff line numbers to match mplayer r29269 (20090505) + +commit 647f6cf3144934e3c2c22b06601d23a1217a2b86 +Author: Alexander Strange +Date: Sat May 23 20:09:07 2009 -0400 + + H264: Print an error instead of failing silently for size changes with slice threads. + +commit 64df3aa6a32a87d96f650b8535c88e1d65b52524 +Merge: 53c86e8 72c8992 +Author: Luca Barbato +Date: Sun May 4 22:24:35 2008 +0200 + + Merge branch 'master' of git://git.mplayerhq.hu/ffmpeg + +commit 65b3e34fc8a52f4f1a48fce7c8cddd80db8fade9 +Author: Alexander Strange +Date: Mon Nov 1 12:20:24 2010 -0400 + + Update the test script to show results more clearly + +commit 65e8486a1dd1efbf2750d0bc25c326f8dc836bcd +Author: Alexander Strange +Date: Sun Mar 29 03:10:53 2009 -0400 + + Fix nonsense 2am code - left the huffman tables uninited. + + It would be faster to copy the VLCs but it would require more code. + And this could be factored into another function. + +commit 661ca4010c548e135ce1c0c819d0c05a94b66985 +Author: Alexander Strange +Date: Fri Jul 10 14:32:04 2009 -0400 + + Cosmetics: get rid of pointless parameter. + +commit 66204771dd8e479d30ef71ad85c162e1a34e4104 +Merge: 3f75218 76dd0e7 +Author: Alexander Strange +Date: Sat Oct 23 17:41:42 2010 -0400 + + Merge mainline. + + Conflicts: + libavcodec/avcodec.h + libavcodec/options.c + +commit 66a34dee4443dd6ccabb53ca09a1c45bc95f4d24 +Author: Alexander Strange +Date: Tue Aug 12 00:39:28 2008 -0400 + + Don't run the last part of decode_update_context() when the last frame was dropped. + + This fixes mplayer -framedrop crashing. Of course, they're still run in some cases when it wouldn't be without threads, but those are all error conditions. + +commit 66cf3f781d73fed502d80cce01dbd16b25bc3a71 +Author: Alexander Strange +Date: Sat Aug 2 19:27:12 2008 -0400 + + Correct 6b037a88 for PAFF/MBAFF. + +commit 66d9c0c9f6b2a4309dd4a41f88dd9a1dccb323e3 +Author: Alexander Strange +Date: Sat Aug 23 19:56:21 2008 -0400 + + Wait for predecode to finish just before calling update_context, instead of as soon as possible. + +commit 66ef4712c357514602f6b47311874e9ebf7376e3 +Author: Alexander Strange +Date: Wed Jun 4 15:57:36 2008 -0400 + + Handle zero-byte input correctly. (for CODEC_CAP_DELAY) + +commit 68682144289b05c830fd64a651526c4708666874 +Author: Alexander Strange +Date: Tue Aug 19 04:08:42 2008 -0400 + + Fix accidentally calling execute_ref_pic_marking() while draining delayed_pics at the end. + +commit 686ea24614fded4d7501f71901aae61f5160f018 +Author: Alexander Strange +Date: Sun Jan 16 22:15:28 2011 -0500 + + Update APIchanges to match mainline_patches branch + +commit 68ef172444124e9e6dd2a69df00ae72a64e795cb +Author: Alexander Strange +Date: Tue May 11 05:34:20 2010 -0400 + + Pass the complete AVPacket through pthread.c decoding + + Part of a patch from VLC. + +commit 6913bf9451bdaef16cd7748c93358baeec57d33b +Author: Michael Niedermayer +Date: Wed Apr 6 00:14:56 2011 +0200 + + Fix REBASE_PICTURE with h.264 + + It was possible for last_picture_ptr to point into h.ref_list + instead of h.s.picture, which caused a bad pointer to be set. + Fixes some valgrind warnings, presumably improves behavior but + no changes were found. + +commit 6998f46dec036f2ab39d6389747a95a7f5808f19 +Author: Alexander Strange +Date: Sat Feb 20 22:32:39 2010 -0500 + + Cosmetics: Rename init_copy and update_context to have 'thread' in the name + +commit 69f085cebf61a64352e623d3c4a5d6032329473d +Author: Alexander Strange +Date: Wed Jun 10 11:33:47 2009 -0700 + + Don't change avctx->thread_count if frame_thread_init() fails. + +commit 69f6e77a9a9ddfc386d43f5a350df5c960c0203d +Author: Alexander Strange +Date: Sun Aug 24 04:11:52 2008 -0400 + + Remove useless check + +commit 6a26fe72383c0ab088c8d92733221bf2911231ce +Author: Alexander Strange +Date: Fri Oct 17 14:45:47 2008 -0400 + + Fix nonsense logic in copy_parameter_set() + +commit 6a3821cf92ef5aaba020a0b7c8d06df5926bd362 +Author: Alexander Strange +Date: Tue Jun 3 04:13:55 2008 -0400 + + Merge statements in mimic. + +commit 6abde3d9e6ccfb062c6f547334171665386b0d85 +Merge: d8014c6 4448f8c +Author: Alexander Strange +Date: Fri May 7 04:42:38 2010 -0400 + + Merge mainline. + + Conflicts: + libavcodec/avcodec.h + libavcodec/options.c + +commit 6ae441be729df8064f1b1244acc82fead9cb1918 +Author: Alexander Strange +Date: Tue Aug 19 01:27:54 2008 -0400 + + Reduce code duplication in MPV_lowest_referenced_row + +commit 6b037a889a34f8f2dd8ad188cda6f4d09d9f4710 +Author: Alexander Strange +Date: Sun Jul 27 00:58:54 2008 -0400 + + Avoid a deadlock in damaged streams where the current picture ends up in h->ref_list. + +commit 6b5aa5cb4d105c4ed118d5ea07f64bbe1e94d135 +Author: Alexander Strange +Date: Sat May 23 23:10:33 2009 -0400 + + Remove inaccurate comment. + + ff_report_frame_setup_done() is called properly for the first field. + +commit 6c575595d9d0e2974e326ad86db61bb61163753a +Author: Alexander Strange +Date: Tue Aug 19 21:01:51 2008 -0400 + + Add flag for thread algorithm + +commit 6d4679e9d5fedff6aa1eed964aa1449716f02682 +Author: Alexander Strange +Date: Wed Jan 20 02:17:36 2010 -0500 + + Add a FIXME comment to a commented-out part of h264.c. + +commit 6e508a7ab927ce7280688d822d3529dfbf17ec88 +Author: Alexander Strange +Date: Thu Sep 4 17:40:59 2008 -0400 + + Fix field progress allocation. + +commit 6fad2f2300fb9e6288d4c9cdf3028d07d3dd63a9 +Author: Alexander Strange +Date: Mon Jan 17 15:41:20 2011 -0500 + + pthread: Fix missing mutex unlock in error condition + + Also remove stray ; + +commit 700a6622f378b5169d8d54ea5bdb4d8b67262a22 +Author: Alexander Strange +Date: Tue Jun 24 23:29:40 2008 -0400 + + Merge another ++. + +commit 701ddc74e17de9f76eabf00a9e8d16adac7c2954 +Author: michaelni +Date: Tue Nov 5 00:38:06 2002 +0000 + + BeOS Audio ouput patch by (Fran +commit 7041a164baed1c643f0cfa1207fbb2fd06d81f38 +Merge: 84cde2e 483385a +Author: Luca Barbato +Date: Sun Jun 29 16:34:45 2008 +0900 + + Merge branch 'master' of git://git.mplayerhq.hu/ffmpeg + +commit 70595dcbdbc01bb1f8f331c0998ee11f04577091 +Author: Alexander Strange +Date: Sun Jan 24 17:33:22 2010 -0500 + + unnecessary freep + +commit 706e94d6531daa0b179613dbef51af8ec5bbe1dd +Merge: 7e928f6 e42b282 +Author: Alexander Strange +Date: Sat Jul 17 18:47:45 2010 -0700 + + Merge mainline and swscale. + + One valgrind test currently fails. + + Conflicts: + libavcodec/avcodec.h + libavcodec/beosthread.c + libavcodec/h264.c + libavcodec/options.c + libavcodec/os2thread.c + libavcodec/utils.c + tests/ref/vsynth1/rgb + tests/ref/vsynth1/yuv + tests/ref/vsynth2/rgb + tests/ref/vsynth2/yuv + +commit 70bf5912700d0519f3d607784654c394633effac +Author: Alexander Strange +Date: Wed Jun 18 21:58:17 2008 -0400 + + Add an mpegvideo wrapper around ff_report_decode_progress. + +commit 70fb3fdcf2c5f01a555d87f8113efb50286493f7 +Merge: 1d15df4 0b034be +Author: Luca Barbato +Date: Mon Jun 9 18:03:54 2008 +0200 + + Merge branch 'master' of git://git.mplayerhq.hu/ffmpeg + +commit 71419720215a7ca7d1b1780564f21cb51d9df0a2 +Author: Alexander Strange +Date: Wed Aug 6 15:45:52 2008 -0400 + + Copy all the MPEG-2 interlacing flags, as well as *_picture, in ff_mpeg_update_context(). + +commit 73608e1fa14434599aab86d2198a05ec4ca21c59 +Merge: a5285ae 6a7ac9c +Author: Alexander Strange +Date: Wed Sep 16 14:38:47 2009 -0400 + + Merge branch 'master' of git://git.mplayerhq.hu/ffmpeg + + The definition of CODEC_CAP_FRAME_THREADS changed, but + clients shouldn't have had to check it for anything. + +commit 73ad08d3b0867db89e5a81b9aec44b053e855ab3 +Author: Alexander Strange +Date: Thu Mar 24 03:31:14 2011 -0400 + + Draw edges in MPV_frame_end when encoding + + These pictures don't get draw_horiz_band called on them. + I thought I had tried this, but after thinking about it realized I'd made + a typo the first time. + + Fixes make test. + +commit 74f382ae597d9cf69c885bc03c716d18fdbd413c +Author: Alexander Strange +Date: Mon Mar 16 23:12:44 2009 -0400 + + Disable frame threading for MPEG-4 + + It seems to have problems with packed B-frames in mplayer. + I don't know if any other players work (at least ffplay does). + +commit 753aecc29f8f4727326f0f371fa99fefbc369d0c +Author: Alexander Strange +Date: Tue Jul 15 02:58:51 2008 -0400 + + Lift H.264 display-order code before decode_slices. + This is needed for multithreading and should get us closer to CODEC_CAP_DRAW_HORIZ_BAND. + +commit 759176e401ebe8911e071f860f59b05d482315d0 +Author: Alexander Strange +Date: Thu Mar 10 02:36:33 2011 -0500 + + Reorder picture_count in mpegvideo to fix ARM asm + +commit 75d4208c3a6ea4b9973b05ce930258ca8c3db224 +Author: Alexander Strange +Date: Wed Jun 25 01:06:31 2008 -0400 + + Disable mbskip copy avoidance harder with threads on + Fixes seeking in mpeg4. + +commit 76211d5890819ae687cc73520bcda17115a65697 +Author: Alexander Strange +Date: Sat Aug 23 23:14:10 2008 -0400 + + Update threading comments in avcodec.h + +commit 776e2fc2d7df09d184caf414cb1d93829fe1c38d +Author: Alexander Strange +Date: Tue Mar 9 01:11:58 2010 -0500 + + Fix missed things in previous VP3 commits + + Optimization improvements only, because the pessimizations hid the bugs. + +commit 77f7818ac7b881a5aa024e31147255ed3a413141 +Author: Alexander Strange +Date: Sun Jan 24 19:00:24 2010 -0500 + + Fixed memory leak in todo + +commit 78c5ca40fac2dc13dac72cada9cc4b80551ee94c +Author: Alexander Strange +Date: Sun Jan 16 02:31:44 2011 -0500 + + Update todo.txt + +commit 78feacc6fae50a72dff68e75d0f718bc136dbe7b +Author: Alexander Strange +Date: Sat Jun 21 23:05:45 2008 -0400 + + Copy the other parts of MpegEncContext needed for h263 + I'm not sure if mbskip can be made compatible with frame threads yet, so it's all zeroed for now. + +commit 795b6f2d87b241e98472c8d9771d4327712c6db9 +Merge: 20d6c33 4f24e1c +Author: Alexander Strange +Date: Tue Jan 13 01:52:27 2009 -0500 + + Merge mainline. + + The conflict fix in h264.c has a strange-looking diff + but probably isn't a problem. + Reverted regression tests to mainline's. + + Conflicts: + + libavcodec/avcodec.h + libavcodec/h264.c + libavcodec/mpegvideo.c + libavcodec/utils.c + tests/seek.regression.ref + +commit 79f3159ebbc55b4f2f885943badc5a847ecd612f +Author: Alexander Strange +Date: Tue Aug 26 03:09:09 2008 -0400 + + Split longer lines + +commit 7a08d7653f38851bd950264fa78174616395fd9a +Author: Alexander Strange +Date: Sat Jun 21 22:09:12 2008 -0400 + + Park all the threads in ff_frame_thread_free before ending them. + +commit 7aabc98254731f46d39fb0770b1445fe332797de +Author: Alexander Strange +Date: Wed Jan 20 02:38:42 2010 -0500 + + The mplayer patch doesn't need to change vd_ffmpeg anymore. + +commit 7b14ed499f5dab39586f3b75ee03e29425b9383e +Author: Alexander Strange +Date: Fri Aug 22 16:25:59 2008 -0400 + + Remove an unused variable. + +commit 7b46b8dc0c04a77108f0150a6fdf58a9b65d4aed +Author: Alexander Strange +Date: Fri Jul 11 18:02:57 2008 -0400 + + Use USE_AVCODEC_EXECUTE instead of checking thread_count in h264. + +commit 7c7f43547b0ad8907d097b99a66f0fc3f171c9f3 +Author: Alexander Strange +Date: Thu Jul 31 18:22:55 2008 -0400 + + Rename H264Context got_avcC to got_extradata. + +commit 7d0709ea04d6f2023052506c969d6db9b79f2963 +Author: Alexander Strange +Date: Tue May 26 00:39:26 2009 -0400 + + Reindent + +commit 7d09b684e9948bbe0e663e40ff0ce616018c0091 +Author: Alexander Strange +Date: Thu Aug 14 20:30:42 2008 -0400 + + Revert some h264 multithreading changes to make merging easier. + +commit 7e85791de30c9005ac722afd59c713c7faef5d7e +Author: Alexander Strange +Date: Tue Aug 19 15:41:14 2008 -0400 + + Retypeset/fix comments + +commit 7e8d959053b29d975c600eb89eb453496a860961 +Author: stefano +Date: Sat May 15 17:34:45 2010 +0000 + + Avoid mixed declaration and code, fix C89 compatibility. + + Patch by Fran +commit 7e928f69148f6c90d35715f4380accb6fc4e88c4 +Author: Alexander Strange +Date: Thu Jun 24 02:41:43 2010 -0700 + + todo: Add secondary bug not fixed in last commit + +commit 7eac0bccc22daa54db7c40b530cf692af3f41274 +Author: Alexander Strange +Date: Thu Jun 18 16:55:03 2009 -0400 + + Update todo. + +commit 7ec92357ae09969eb5254ab6954b712d95b4630f +Author: benoit +Date: Tue May 22 07:58:22 2007 +0000 + + cosmetic v1/v2 renaming + patch by Andreas +�commit 7f86539559480910beab0ef568571dbe524ecda1 +Author: Alexander Strange +Date: Mon Jan 25 02:46:29 2010 -0500 + + Rename avail_motion() and associated functions to something better. + + What did "avail" mean, anyway? + +commit 7fc3b0d1f996b8a832017095244a3187b8d80f38 +Author: Alexander Strange +Date: Sat Apr 4 00:23:21 2009 -0400 + + Remove client calls to avcodec_thread_init. + + This function has no effect under ffmpeg-mt, since avcodec_open() + calls it anyway. + +commit 802206985550e6f685e42595f529133186388acc +Author: Alexander Strange +Date: Mon Nov 15 05:19:58 2010 -0500 + + Update todo.txt + +commit 8047714299aa3fb377b011cd68858b76a666c7cc +Author: Alexander Strange +Date: Mon Aug 25 19:39:24 2008 -0400 + + Whitespace nits + +commit 80a20f0fda854e6c8de05b971164d25425105c82 +Author: Alexander Strange +Date: Sat Aug 23 21:52:47 2008 -0400 + + Don't call ff_report_decode_progress for h264 B-frames. + +commit 80a7538f955a9cd931d840e1cb4e4c81e9d85165 +Author: Alexander Strange +Date: Mon Nov 15 04:14:51 2010 -0500 + + Write APIchanges. + + avcodec_thread_init() will not be deprecated in this repository to + avoid generating warnings for users who shouldn't remove it just yet. + +commit 80ab88e74f9864442afca19ecc6ee0428623ff22 +Author: Alexander Strange +Date: Sun Jun 15 17:46:30 2008 -0400 + + Cosmetics: rename context variable. + +commit 8218d5319067aa1ac06c601e5dc530ebdab7c01f +Author: Alexander Strange +Date: Mon Aug 18 18:43:02 2008 -0400 + + Properly handle error returns from codec functions. + +commit 821c4d0996689ab27d5ab1b6bca0695503b02670 +Author: Alexander Strange +Date: Sat Jun 21 22:54:52 2008 -0400 + + Add 16x8 and 8x8 MVs to MPV_lowest_referenced_row() + +commit 822ed86c0ac4de7c38d443e23fcabf1b627118ea +Merge: e340cac 17c125c +Author: Alexander Strange +Date: Tue Nov 18 13:58:23 2008 -0500 + + Merge mainline. + + Conflicts: + + libavcodec/h264.c + libavcodec/mpegvideo_enc.c + +commit 82324906156d303d5f3b3e10a1855bf05614ebfc +Author: Alexander Strange +Date: Sun Jul 18 02:24:09 2010 -0700 + + Revisit d812c6f8b1d897734d6f7b5f1a5c95d3aa10a3ea + + The sps/pps_buffers logic wasn't correct, considering that SPS/PPS + can be found far before the first working frame. + + Unfortunately this adds more code than it removes. + + Fixes a crash and a memory leak in premiere_paff.ts. + +commit 824ee1ac826b89b84cc93fb77f38ec6530909f2b +Merge: 686ea24 11dcccd +Author: Alexander Strange +Date: Mon Jan 17 03:39:49 2011 -0500 + + Merge remote branch 'mainline/master' + +commit 83b344d87b97ef6b72e84c145f2185f87ce22e9b +Author: Alexander Strange +Date: Sat Apr 4 00:27:47 2009 -0400 + + Forbid calling avcodec_thread_init after avcodec_open. + + Although ffplay used to do this, it never worked, since codecs + were free to check thread_count in their init functions. + +commit 83c7cc1ca1afe68b339b8554634a3a1effc76b45 +Author: Alexander Strange +Date: Tue Aug 19 21:24:03 2008 -0400 + + Add more to todo + +commit 83cbbb1a92d58a850d5b254b5f54e78a7bad8ca5 +Merge: ae7e6bb 7e61a90 +Author: Alexander Strange +Date: Sun May 30 09:59:29 2010 -0700 + + Merge mainline. + + Conflicts: + libavcodec/avcodec.h + libavcodec/h264.c + +commit 8414fc85d03776bc622c9451e9b08f047af42676 +Author: Uoti Urpala +Date: Sun Jan 2 11:52:30 2011 +0200 + + pthread: fix failure to initialize frame fields after flush + + Commit b67d7055bf ("Clear returned pictures immediately after copying + them.") moved some code used to (re)initialize per-thread data before + starting to decode a new frame. The commit changed this to be done + after the results of decoding the previous frame had been returned to + the caller. This was buggy: when decoding state is flushed some + decoded frames may never be returned to caller, and thus there would + be no reinitialization before reusing the same thread for another + frame after the flush. In particular, *got_picture_ptr could be + incorrectly set when calling avcodec_decode_video2() after seeking. + + Move the initialization code back to the previous location before + starting to decode a frame, but leave a line setting + PerThreadContext->got_picture to 0 also after returning a frame and + add a comment explaining why it is there. + +commit 846ae640182b4775db5b32cb027d964bf85d54a5 +Author: Alexander Strange +Date: Fri Jan 21 03:16:03 2011 -0500 + + Longer comments in thread.h + +commit 84a94407509525ffca2e1691a73d186d0d10b1fd +Author: Alexander Strange +Date: Tue Aug 19 01:14:36 2008 -0400 + + Remove whitespace change from mainline + +commit 84cde2e4c7d97f3a9b5f9d4a4c722ccf38c82742 +Merge: f139f42 e73c602 +Author: Luca Barbato +Date: Tue Jun 24 13:31:01 2008 +0200 + + Merge branch 'master' of git://git.mplayerhq.hu/ffmpeg + +commit 854cff1a75a0c4433d6a25517326b2660a56693d +Author: Alexander Strange +Date: Wed May 28 01:05:33 2008 -0400 + + Enable multithreaded MDEC. + +commit 85730bc96115f75524f2780059a26ee6dbd8695e +Author: Alexander Strange +Date: Sat Aug 16 01:30:59 2008 -0400 + + H264: Skip filling in the parts of frame num gaps that are bigger than the number of reference frames. + + My sample with a 256 frame or so gap doesn't work with ff_delayed_release_buffer otherwise. + No change on MR3_TANDBERG_B.264. + +commit 8666b987a1df652d830db8bae9c2d56287a8fc88 +Author: Alexander Strange +Date: Sat Aug 16 14:18:13 2008 -0400 + + Clarify comment for AVCodecContext frame_number + + Number of frames returned vs. decoded isn't the same anymore + +commit 8682f8c0c7396bfe1bf9b4be3293beb4c6a10927 +Author: Alexander Strange +Date: Fri Aug 22 03:25:03 2008 -0400 + + Rename and update comments for AVCodecContext variables. + +commit 86c6c4cff0bf8a734592f31591ec6fafb456387b +Author: Alexander Strange +Date: Tue Mar 9 01:46:32 2010 -0500 + + Cosmetics: fix overindent + +commit 878ad7601ad8eddec124877eb9b30b3df4a8c8b8 +Author: Alexander Strange +Date: Tue Feb 1 21:45:18 2011 -0500 + + Add missing test script. + + Haven't used this one in a while. + +commit 87a9ad1b28ec7a4c9b08b949486010098c06a752 +Author: Alexander Strange +Date: Mon Jul 14 23:17:13 2008 -0400 + + Don't copy padding_bug_score. + This changes during h263 decode so it introduces a race condition. + Having a score for only every 1/n-threads frames is hopefully not too much less inaccurate. + +commit 880990f352fd8d557538535fc0496aec47d1c407 +Author: Alexander Strange +Date: Tue Aug 19 00:42:56 2008 -0400 + + Cosmetics: rename input and output context members + +commit 8884655418183d2ccde654febc9a88e8398c978a +Merge: 8232490 f991c07 +Author: Alexander Strange +Date: Sun Aug 1 04:46:21 2010 -0700 + + Merge mainline. + + Conflicts: + libavcodec/avcodec.h + libavcodec/vp8.c + +commit 8919a66d8ff492adc9455fd73f1da05d154281ff +Author: Alexander Strange +Date: Sat Jan 15 19:27:39 2011 -0500 + + Re-enable multithreaded mpeg4. + + Seems to work in mplayer, and is needed so I can investigate fixing the buffer + age+skip optimization. + +commit 8969edf8b07437e9110db82b7c75e57c00c3e842 +Author: Alexander Strange +Date: Fri Aug 22 02:53:04 2008 -0400 + + Split a long line further. + +commit 899a30063b23ff008bbea3560c28fa194cfb1d77 +Author: Alexander Strange +Date: Mon Aug 11 18:04:42 2008 -0400 + + Simple patch to keep the non-pthreads OSes working. + + They ignore thread_algorithm being set by the user for some minor simplicity gain, since I'd still like to see these files gone from mainline. + +commit 8a2e487269389d778ddf517baaff590b0a7b3f46 +Author: Alexander Strange +Date: Sun Jan 24 16:55:35 2010 -0500 + + Don't allocate thread_opaque progress with frame threading off. + + It's not needed for anything and the extra check in ff_await/report_* + isn't slow. + +commit 8aa204a70a7f068f46f00e0983b4617f8030544a +Author: Alexander Strange +Date: Thu May 29 00:19:26 2008 -0400 + + Fix comments for new avcodec fields. + +commit 8ae6601b670156b36b227e2a3c0d9cdc72294bd5 +Merge: c91d7a2 cef0309 +Author: Alexander Strange +Date: Sun May 23 01:43:27 2010 -0400 + + Merge mainline. + + Conflicts: + libavcodec/avcodec.h + +commit 8ae9683ebce1e42c5bd1a24a2bcdcbf2cbfe6ccb +Author: Alexander Strange +Date: Sun Jan 16 02:29:08 2011 -0500 + + Update mplayer.diff to work around incompatibility with draw_horiz_band() + +commit 8af63f450185c3b15cc2ca32d2bc1a19f5d2a28e +Author: Alexander Strange +Date: Sat Feb 20 20:02:34 2010 -0500 + + Cosmetics: rename thread.h functions for consistency + +commit 8b7a5375ad0956f546c2b614594b79c3ec54de3d +Merge: 3ad85b1 875fcc3 +Author: Alexander Strange +Date: Wed Oct 28 13:11:58 2009 -0400 + + Merge mainline. + +commit 8ba50a98f87edb2b87df042f09573ea8be4a8696 +Author: Alexander Strange +Date: Sun Mar 28 03:54:31 2010 -0400 + + h264: Fix ff_h264_execute_ref_pic_marking() not being called with PAFF+threads + + With some PAFF files, field_end() can call ff_h264_execute_ref_pic_marking() + during slice header decoding. This was disabled with threads on, which was wrong. + + This patch fixes it at the cost of making control flow more confusing. + + Partial fix for Chalet-Tire.mp4 from ffdshow. + +commit 8c946d1672281fc997dfb2679e7cbed48dd09216 +Author: Alexander Strange +Date: Mon Jul 14 23:07:07 2008 -0400 + + Set decoding progress as high as possible when multithreading is off. + This avoids possible crashes from trying to lock progress_mutex when it hasn't been created. + +commit 8d466e182aa89ca8cfbe57ce60f2a1e2a7ecebc7 +Author: Alexander Strange +Date: Mon Oct 13 14:37:22 2008 -0400 + + Fix incorrect frame num gap handling. + + Fixes ORF1HD.Demo-Loop.720p.DD5.1.mkv from x264 samples. + +commit 8d8229014f489e1b2417676d9753f784d995e6c0 +Author: Alexander Strange +Date: Mon Dec 1 17:21:38 2008 -0500 + + Don't crash if flush_buffers is called after init and before the first decode. + + Fixes mplayer -ss + +commit 8f759fa0e956f8cc33ccd423cefae23e25c16caf +Merge: 9be00ab 1e8ecf7 +Author: Luca Barbato +Date: Tue May 20 11:46:04 2008 +0200 + + Merge branch 'master' of git://git.mplayerhq.hu/ffmpeg + +commit 9017898687ebedca27e47fdd13e6e5e208a5fbb6 +Author: Alexander Strange +Date: Thu Aug 28 00:52:29 2008 -0400 + + Pad the frame data properly + +commit 9059683b29cd601361e477289a194e679aa72f8c +Author: Alexander Strange +Date: Thu Jun 12 16:22:27 2008 -0400 + + Limit ff_find_unused_picture to only part of s->picture. + + Otherwise, a thread may call delayed_release_buffer and then later allocate a picture in the same place, reusing the other Picture variables while they're still in use. + +commit 9077d0ba4ed18e1f106723d155e81461c8951764 +Author: Alexander Strange +Date: Wed Feb 17 00:55:36 2010 -0500 + + Comment recent change to update_context API. + + Notes: + - It might be possible to revert this by making the vp3 decoder + behave like mpegvideo. Not faster but the code will be simpler. + - I don't like any of the old comments, they're too wordy. + +commit 9153938f1c1f0933ec59cee14cc26b8f99bd9090 +Merge: 661ca40 e48fb07 +Author: Alexander Strange +Date: Thu Jul 23 21:14:58 2009 -0400 + + Merge mainline. + +commit 91a7b18346baf82e0ccf6dfb53ada22299396f17 +Author: Alexander Strange +Date: Sat Aug 16 16:42:33 2008 -0400 + + Call codec init and free on the first thread context instead of the main context. + + This is needed so we can stop using the main context for decoding threads. + +commit 91a7c2254bb3e82862c4cd916bd9f2ac1dd4c170 +Author: lucabe +Date: Thu Sep 23 09:16:05 2010 +0000 + + Allow to set the frame rate in v4l2 devices + Patch by Jos +� Miguel Gon +commit 91cd95a84759702b85de68047d21a6ef9d32eaca +Merge: 77f7818 f9f7b02 +Author: Alexander Strange +Date: Sun Jan 24 21:39:20 2010 -0500 + + Merge mainline and libswscale. + + Upstream now always calls avcodec_thread_init(). + It's better to do that differently here, so the + current code in ffmpeg.c has been kept. + +commit 92672ea0eee93244cc78e5023f6469c5b21754b5 +Author: Alexander Strange +Date: Mon Aug 18 19:10:01 2008 -0400 + + Simplify: better use of variable names instead of weird struct accesses + +commit 93ac615ccf788df20279aa613f3fdc78d4bfcf18 +Author: Alexander Strange +Date: Mon Jul 14 23:56:22 2008 -0400 + + Simplify assert. + +commit 9457fb1458998f893b7e1f06f1144f8203cd0025 +Author: Alexander Strange +Date: Mon May 25 22:38:36 2009 -0400 + + Don't try to check list1 when it's not filled. + + 9.1s -> 9.0s on 5cm.mp4 + +commit 94985fa9745e2affd0cf3145fa35cb8ae87e7848 +Author: Alexander Strange +Date: Sun May 31 00:08:41 2009 -0400 + + Ensure the minor version is higher than mainline. + + Missed this in previous merges, but I think it's important + to avoid confusing anyone reading ffmpeg tool output. + +commit 9576774bbee0215c0ab7bbb868ff35dff00ab900 +Author: Alexander Strange +Date: Sun Aug 24 03:02:44 2008 -0400 + + Merge ff_*_release_buffer into one function for simplicity and correctness (the non-delayed version was not really ever safe). + +commit 967e65496780c089956f2dc199b541dae3a3d9cb +Author: Alexander Strange +Date: Thu Dec 18 14:37:04 2008 -0500 + + Some todo entries I forgot to add + +commit 96d6751af35556785037bdddb500eeb7b47795e6 +Author: Alexander Strange +Date: Mon Jul 14 23:08:45 2008 -0400 + + Call ff_thread_init() before the codec init. + This makes USE_AVCODEC_EXECUTE() properly available during init. + +commit 9816b66fb55fe03fd6f2a4db9390bdaa59eac697 +Merge: 1292a18 918f7b5 +Author: Alexander Strange +Date: Thu Jan 22 03:39:04 2009 -0500 + + Merge branch 'master' of git://git.mplayerhq.hu/ffmpeg + + Changed the value of CODEC_CAP_FRAME_THREADS and + adjusted use of config variables to match mainline. + + Conflicts: + + libavcodec/h263.c + libavcodec/h264.c + libavcodec/mpeg12.c + libavcodec/mpegvideo.c + libavcodec/pthread.c + libavutil/common.h + +commit 99ed04d4d7b7183a4d0a1b8833eee3b506e13ff0 +Author: Alexander Strange +Date: Fri Jan 21 01:34:57 2011 -0500 + + Remove change to compute_pkt_fields which is no longer needed + + May have been fixed by introduction of pkt_dts, but I'm not sure. + Either way, tests pass. + +commit 9a88884c03cd40d1fcbd247f1b004848fb629a11 +Author: Alexander Strange +Date: Wed Aug 6 20:55:20 2008 -0400 + + Simplify thread init and make more of its functions static. + +commit 9b27ce1e721a021128380e47e83a06f25c52e998 +Author: Alexander Strange +Date: Fri May 15 15:53:28 2009 -0400 + + Fix race condition decoding H264 direct prediction + + There may be some code merging possible here. + +commit 9bac2ee137d9b8152e3beb98681b07f665cd58ee +Author: Alexander Strange +Date: Thu Jun 5 20:36:38 2008 -0400 + + Cosmetics: rename ff_mt_*_buffer. + +commit 9be00ab6113d71a020eea4fd4483b8483efbb29d +Merge: 63f663f 1531623 +Author: Luca Barbato +Date: Sun May 11 08:53:10 2008 +0200 + + Merge branch 'master' of git://git.mplayerhq.hu/ffmpeg + +commit 9c241058a255e1da6adec7db81e22d4ff8b2b6b2 +Author: Alexander Strange +Date: Tue Aug 19 04:09:25 2008 -0400 + + Copy the entire reference list arrays in case they're used. + + And that's it for SoC period commits. + +commit 9cd1083269334de974acdf13dd94451c178a0eca +Author: Alexander Strange +Date: Tue Mar 29 04:47:23 2011 -0400 + + Fix mdec + + init_copy rotted due to data structure changes. + +commit 9e0e492fe88ec0c7ec400e9afdbef8356280fc16 +Author: Alexander Strange +Date: Tue Aug 5 00:21:25 2008 -0400 + + Update the guard clause on avcodec_thread_execute(). + + It already works fine, since all codecs check USE_AVCODEC_EXECUTE themselves before calling it, but the function is for some reason part of the public API. + +commit 9e615b8534c98947cbbe6ada5047e95c36e14cde +Author: Alexander Strange +Date: Wed Sep 3 20:40:45 2008 -0400 + + Rename symbols to not mention decoding + +commit 9e981c8d263986e67de6170895125b1de7e62ddd +Author: Alexander Strange +Date: Wed Aug 11 02:05:50 2010 -0700 + + vp3: fix mt decode of 4:2:2 and 4:4:4 content + + The threading improvements are poor and looks strange: + real 0m14.337s + user 0m13.200s + sys 0m1.132s + + real 0m13.434s + user 0m19.409s + sys 0m7.091s + + real 0m11.610s + user 0m21.870s + sys 0m7.303s + + real 0m7.976s + user 0m20.681s + sys 0m3.277s + + There may be a bug related to await_reference_row() being called too many times, + as it's in a loop per-chroma superblock and there are 2x as many of those + in 4:2:2, but not 2x as many MVs. + + No idea why 4 threads have less sys overhead. + +commit 9ec47e33af6776b94875c91288db852a333a6f63 +Author: Alexander Strange +Date: Sat Jun 21 22:01:43 2008 -0400 + + Split the code for completing all current frames out of ff_frame_thread_flush. + +commit 9ec9f0868de2df3d3448dec887e7440ebb006b27 +Author: Alexander Strange +Date: Mon Aug 2 16:14:21 2010 -0700 + + Fix the last commit testing the wrong variable. + + Luckily the idea was still right. + +commit 9ede817a98a263093ca7965f8754a1770ef031de +Author: Alexander Strange +Date: Fri Jul 11 23:01:47 2008 -0400 + + Add a new -debug for tracing get_buffer calls. + +commit 9f15b87679392902206264383c16c7440d8c0f06 +Author: Alexander Strange +Date: Sun Jul 6 15:35:10 2008 -0400 + + Extra line snuck in while merging mainline. + +commit 9f6a425684e0fd0ac3f8bbd37ca4e2bc96e05d5b +Author: Alexander Strange +Date: Mon May 25 20:30:08 2009 -0400 + + Fix race condition with MBAFF frames. + + mb_linesize is 2*linesize for MB_MBAFF too, which wasn't counted + in mc_dir_part_y, so the part of the MV added to 16*mb_y was 1/2 + the right magnitude. Fix this by halving mb_y too (safe) and + doubling row values for MBAFF later. + +commit 9ff8764a15cce3fcf3f64270d7d4ec52a3ca7d1a +Merge: 94985fa 08bbd7d +Author: Alexander Strange +Date: Sun May 31 01:19:07 2009 -0400 + + Merge branch 'master' of git://git.mplayerhq.hu/ffmpeg + +commit a1005396f05f5bc13c6aa6875337dbd0e6c4cd03 +Author: Alexander Strange +Date: Wed Aug 6 20:45:06 2008 -0400 + + Merge framethread.c into pthread.c. + + Git doesn't track this very well... + +commit a1a5c549efd3a376fd5c8c77d49acfab89f8fdba +Author: Alexander Strange +Date: Sat Jul 12 02:19:59 2008 -0400 + + Factor out size of delayed_pic. + +commit a210b422361b051ba73c115fe6bf65eaa745b19a +Merge: f9515a4 ec6213f +Author: Alexander Strange +Date: Thu Dec 24 22:08:34 2009 -0500 + + Merge mainline and update swscale. + + As a side effect, this fixes Theora/VP3 decode being broken. + + Conflicts: + ffmpeg.c + libavcodec/avcodec.h + libavcodec/h264.c + libavcodec/mpeg12.c + libavcodec/mpegvideo.c + libavcodec/vp3.c + +commit a2371d6c9b8837b472e22539642883979eac2ddf +Author: Alexander Strange +Date: Tue Nov 18 14:26:37 2008 -0500 + + Update todo. + +commit a2efd25ba04e0cb61823cbf765651f437b691b09 +Author: Alexander Strange +Date: Thu Jan 6 06:31:45 2011 -0500 + + Update todo.txt and move one issue out of bug fixes that isn't a major issue + +commit a2fb22fb6988742ee28ee61e2e21fa05125517a9 +Author: Alexander Strange +Date: Sat Aug 30 04:20:03 2008 -0400 + + Don't prefix static function names. + +commit a3a2674e27f8f2641d1603ee9e92e854289a0527 +Author: Alexander Strange +Date: Tue Feb 1 23:13:49 2011 -0500 + + Fix pkt_pts change to ffmpeg.c + + Caused tons of regressions in make fate. + This needs to be merged to mainline_patches. + +commit a4599a7f4e4a865a0b402297b4f5a11e9ca34a27 +Author: benoit +Date: Thu Jan 10 10:16:36 2008 +0000 + + Make pp_help a constant array of characters to move it to .rodata. + Patch by Diego 'Flameeyes' Petten +� flameeyes commit a5285ae4d452abed92f43e2a7a24dd821343a39c +Merge: a7b8cb3 6a3f0e9 +Author: Alexander Strange +Date: Sun Aug 23 22:31:19 2009 -0400 + + Merge branch 'master' of git://git.mplayerhq.hu/ffmpeg + +commit a564fda546ce3bfd04cf8a0e4ec4fb1b6d40e010 +Merge: 287e761 5b4608b +Author: Alexander Strange +Date: Mon Jan 4 03:56:32 2010 -0500 + + Merge mainline and libswscale. + + Auto-merge failed on h263.c for no apparent reason; the patch was + reimplemented by hand. Note that mt isn't enabled for h263 at the moment. + + Conflicts: + ffmpeg.c + ffplay.c + libavcodec/h263.c + +commit a5cdcc9d4efcc043c01019f632dc1e5ad318802a +Author: Alexander Strange +Date: Mon May 25 20:16:54 2009 -0400 + + Rewrite mc_dir_part_y(). + + The previous one used a completely wrong value for filter_height + and didn't properly account for MVs extending past the top of the screen. + I'm not sure if MVs can be more than -pic_height, if they can this + may still be wrong. + +commit a61ab604725f647c1bcb46aa8cfb303a5c78a2b0 +Author: Alexander Strange +Date: Thu Jun 25 16:39:14 2009 -0400 + + Theora: factor out updating last_frame. + +commit a74b85567073a424d5b7fc4bd8cc1e125df170f5 +Author: Alexander Strange +Date: Mon Sep 1 02:34:59 2008 -0400 + + Comment adjustment + +commit a7b8cb3c942fed6c80111519ba5505f11d61f3af +Merge: 17dcbec 23e6da5 +Author: Alexander Strange +Date: Thu Aug 20 16:47:50 2009 -0400 + + Merge branch 'master' of git://git.mplayerhq.hu/ffmpeg + +commit a903974adc7c8dd33dfb0acc4e2d6d10c09a23c8 +Author: Alexander Strange +Date: Wed Nov 11 12:45:09 2009 -0500 + + Add a next_outputed_poc to H264Context. + + Doesn't do anything yet, but makes the next merge easier. + +commit aa11b5e0df5dfcaba21552e4864807f7aa65f5c5 +Author: Alexander Strange +Date: Tue May 11 06:36:55 2010 -0400 + + pthread: Remove pointless line from frame_worker_thread() + + It was introduced in the first commit, where it probably did something. + +commit aaa05da15fa7710503544d4a94319cb10d49a8f2 +Author: Alexander Strange +Date: Tue Nov 2 02:59:16 2010 -0400 + + vp3: Remove redundant y*fragment_width+x calculations + +commit aacc74c0e2b047340a1a22f5c28aa03a4294aa03 +Author: Alexander Strange +Date: Mon Jul 14 03:40:15 2008 -0400 + + Reindent. + +commit ab4c84dd28c0375a6ed4f77f37ada3b94b2136a0 +Author: Alexander Strange +Date: Mon Dec 1 17:20:10 2008 -0500 + + Don't hide the warning about direct rendering in mplayer. + +commit abb53ce0e02d31fb282f55cecb58f9b0c4f5c136 +Author: Alexander Strange +Date: Sun Feb 6 19:18:31 2011 -0500 + + pthread: Remove useless line + +commit ac2e1b12b5e608b80581d731c4f3a0d6c033e9e0 +Author: benoit +Date: Tue May 29 14:35:29 2007 +0000 + + allocate PPS and SPS dynamically + patch by Andreas +�commit ac4539fba6d825d683d4a7d27f0045d068fe4595 +Author: benoit +Date: Mon Jan 7 12:48:42 2008 +0000 + + Mark the ff_svq1_frame_size_table as constant. + Patch by Diego 'Flameeyes' Petten +� flameeyes commit ac4c37360b21a14e9b26502a299f831b8448a10b +Author: Alexander Strange +Date: Mon Nov 15 02:43:15 2010 -0500 + + Cosmetics: remove the COPY() macro + +commit ac7f2102c4249a89144c36944e13bf6be56e9190 +Author: kabi +Date: Mon Apr 8 12:32:01 2002 +0000 + + * support for .au .gif .mov .mp4 by Fran +commit adfaa1f86196156e30c54799303269f4a4f84a2d +Author: Alexander Strange +Date: Sat Jul 26 16:14:00 2008 -0400 + + Cosmetics: split a long line. + +commit ae2790af78a332a6aa836607a14546c5cc1865e5 +Author: Alexander Strange +Date: Sun Oct 12 18:55:48 2008 -0400 + + Add multithreading for PAFF/MBAFF. + +commit ae4251429ee5e333fc705c61959417c1d9364b9e +Author: Alexander Strange +Date: Tue Nov 18 14:15:24 2008 -0500 + + Switch to mphq git module + +commit ae7e6bb9708a0f0dac89295c788266e0f15899d2 +Author: Alexander Strange +Date: Tue May 25 03:14:27 2010 -0400 + + H.264: Fix rare race condition. + + h->mb was not cleared when initializing a new decoder thread. + This could cause wrong pixel values in the first macroblock of + the first frame to be decoded by each thread. + + I suspect this is nearly the last visible bug affecting x264 content. + + Fixes [SS]_Angel_Beats!_-_06_(1280x720_H.264)_[A01DDBD8].mkv. + +commit af52a126f36cd6339f9f4a1152103ef88b4b8fee +Author: Alexander Strange +Date: Sat Jun 27 18:09:49 2009 -0400 + + Call handle_delayed_releases() before update_context(). + + This allows releasing frames in update_context(), which would + previously cause a race condition/deadlock. + +commit af79370b65b396e05c319d29356e456a8f5e8233 +Author: benoit +Date: Mon Jan 7 12:44:49 2008 +0000 + + Make the av_class member of PPContext a poiner to constant AVClass. + Patch by Diego 'Flameeyes' Petten +� flameeyes commit afafe7361da5a9373d02dc60d597da8f2185edd3 +Author: michaelni +Date: Sat Nov 2 10:31:37 2002 +0000 + + added perm inheritance from ffmpeg_g (it looks like 'strip' in BeOS doesn't keep them, though the Linux one does !?) + patch by (Fran +commit afc391b7ab5eda271733bbe55ef46118aba75bff +Author: michaelni +Date: Sat Jul 20 20:05:50 2002 +0000 + + beos/mov/adpcm patch by Fran +commit afe0428ae38f68a467b43cc9358b7a1a2f85d36b +Author: Alexander Strange +Date: Sat Aug 16 18:09:11 2008 -0400 + + Fix memory leak in mpegvideo + +commit b05eb30ba838b981c769217e1d2215777484f25a +Author: Alexander Strange +Date: Fri Jan 21 02:34:46 2011 -0500 + + Make the src parameter of update_thread_context() const + +commit b07e45974b2772e3a747502f976dc08d0ffcff74 +Author: Alexander Strange +Date: Thu Jun 18 16:21:03 2009 -0400 + + Indent. + +commit b125b68fe6dc2d0064d45d0cffc3bcb47263f32c +Author: Alexander Strange +Date: Sun Jan 24 18:50:32 2010 -0500 + + Remove fixed entry from the todo. + +commit b18683e3adc997b19cf56f459ce5f8a7428c0909 +Author: diego +Date: Sun Oct 18 14:34:45 2009 +0000 + + Fix typo that mistakenly slipped into previous commit: + CONFIG_MPEG_XVMC_DECODER was changed to CONFIG_MPEGVIDEO_XVMC_DECODER. + patch by Onur K +� +commit b1c8c18fe11d3155b1df6a19117d14fa633bcd15 +Author: michaelni +Date: Sat Nov 2 10:39:22 2002 +0000 + + added MACE (Macintosh Audio Compression/Expansion) 3:1 & 6:1 support + contribution by Laszlo Torok + 4CC 'MAC3' and 'MAC6' in Quicktime. + It works for mono streams, needs to be fixed for stereo when I get my hands on a stereo sample :) + patch by (Fran +commit b3cdfccd2b11e247e0c17e02d0c958888da5585b +Author: Alexander Strange +Date: Mon Nov 15 04:14:41 2010 -0500 + + avcodec.h: Update comments + +commit b3d5e9333051802b20446076605b404e418323c4 +Author: Alexander Strange +Date: Tue May 26 00:34:11 2009 -0400 + + Skip unnecessary lock-wait-unlocks for condition variables. + +commit b3e3f071ca5ad99444bac95e4128c01a8ae7bae3 +Author: Alexander Strange +Date: Thu Jun 11 11:32:00 2009 -0700 + + Split out if (current_slice == 1) + +commit b4221d5453d6dc893e87b77eecc845da121ddb56 +Author: Alexander Strange +Date: Mon Aug 18 17:06:32 2008 -0400 + + Reorder ff_frame_thread_free to fix memory errors. + + This fixes using mutexes after they're destroyed and not calling release_buffer on every buffer. + Unfortunately the change to MPV_common_end is exactly the opposite of what's needed for supporting width/height changes. + +commit b483ed4f4af9444cfaa6ff9336645d799d2254dd +Author: Alexander Strange +Date: Wed Aug 6 20:33:51 2008 -0400 + + Remove the unused debugging counters from frame threading. + +commit b67d7055bf60313c40b6369f98cfc9d1eae3aefb +Author: Alexander Strange +Date: Tue Sep 2 00:52:48 2008 -0400 + + Clear returned pictures immediately after copying them. + + This isn't protected by a mutex but is still safe. + Needed for the next commit. + +commit b68110d079914d16c9fc5d1cc8c6e10d78dbdbca +Author: Alexander Strange +Date: Sat Aug 16 15:05:49 2008 -0400 + + H264: Set the decode progress for fake reference frames to the maximum. + + Fixes deadlock in premiere-paff.ts at the expense of some indeterminism on the first frame. + +commit b77accec9077ae8f072091fc7301d661bc9487ba +Merge: 5d3c2f7 392faa1 +Author: Luca Barbato +Date: Tue Jul 29 15:11:05 2008 +0200 + + Merge branch 'master' of git://git.mplayerhq.hu/ffmpeg + +commit b7d182610b592eef0714c1d2de18c3233a289b69 +Author: Alexander Strange +Date: Sun May 24 01:06:33 2009 -0400 + + Update mplayer.diff whitespace + +commit b7e0f1a3bfd00b0256dcdd3efc4b7b77c086e70e +Author: Alexander Strange +Date: Sun Aug 24 22:38:42 2008 -0400 + + Rename doxygen group to not conflict with h264 + +commit b88c3baf94247f2687ca0c05b0ce6af7c905e02a +Author: Alexander Strange +Date: Mon May 24 22:40:00 2010 -0400 + + Fix more old merge glitches. + +commit b9a8973031be583af53be890ccdef07841394385 +Author: Alexander Strange +Date: Sun Jun 15 22:31:35 2008 -0400 + + Use output_cond for notifying the main thread. + +commit ba073d39f18679835b48b96f20feae96dad1f343 +Author: Alexander Strange +Date: Mon Apr 11 23:00:19 2011 -0400 + + h264: cosmetic whitespace change + +commit ba8b789143dc6a14c29393e40fb361c1a3e2ccd4 +Author: Alexander Strange +Date: Sat Aug 16 01:53:10 2008 -0400 + + Update todo + +commit babb66241ae51e2956aa698d425c645ad056936e +Author: Alexander Strange +Date: Fri Oct 17 14:52:35 2008 -0400 + + Copy avctx->height/width for mpegvideo. + + Not sure what the difference between the three width variables is, really. + +commit bad2bf8621c04791f0d9a0a2873a3b6042d4ba83 +Author: Alexander Strange +Date: Sun May 24 00:48:57 2009 -0400 + + Copy new fields in update_context_from_copy(). + +commit bb67674aa57e23893f2f19bd4ffb4a92b5a01e83 +Merge: 06ac5ac 6051838 +Author: Alexander Strange +Date: Sun Jun 20 17:39:15 2010 -0700 + + Merge branch 'master' of git://git.mplayerhq.hu/ffmpeg + +commit bba0e098a75f14af80bfd4fdfdf9edcaf8f3fee5 +Author: Alexander Strange +Date: Sat Jun 20 03:32:19 2009 -0400 + + Factor out vp3 table allocation into new function. + +commit bbc5744117da188c43e00c4f02f6ff0fe984d4f8 +Author: Alexander Strange +Date: Sun Jul 13 15:52:21 2008 -0400 + + Print the AVCodecContext address in av_log instead of AVClass. + This makes logging much easier to read when there's more than one context. + +commit bc1cc6f39a0f6df2cc1d0fecd3eb14efd150763a +Author: Alexander Strange +Date: Wed Feb 3 01:29:21 2010 -0500 + + Cosmetics: Don't use #if HAVE_PTHREADS in thread.h. + + These two macros will be removed entirely in the future. + +commit bd392934097dc5c909e9b06550ec1d13d92fa134 +Author: Alexander Strange +Date: Fri Aug 15 23:34:32 2008 -0400 + + Set output_size properly before calling the decoder so it doesn't return nonsense and crash at the end + +commit bd63cf4721466aea490f6f0455a32060d572d5ba +Author: michaelni +Date: Sun Jul 21 07:54:53 2002 +0000 + + YUV410P to YUV420P patch by Fran +commit bdaeaaa58f24393027e112c02896b23fe0b3cc01 +Author: Alexander Strange +Date: Mon Oct 13 11:23:47 2008 -0400 + + Add buffer padding to the end of bitstream_buffer. + + Fixes a warning in valgrind. + +commit bdef29429d4f488012cb492e61cf20ffe0b858a7 +Author: Alexander Strange +Date: Sun Jul 6 15:48:52 2008 -0400 + + Fix compilation with threads disabled. + +commit be45bc423ba576e1d06df3664cfe91e02d78ffa5 +Author: Alexander Strange +Date: Mon Feb 15 00:00:35 2010 -0500 + + Fix a deadlock in mpeg1 threaded decoding + + Fake frames need their progress set to INT_MAX. + + This can be triggered by seeking in mpeg1, but this is not the correct fix, + since seeking to keyframes does seem to work properly without threads. + +commit bf806642ab67148d93a4f24e7dbdc8644575c45b +Author: Alexander Strange +Date: Sun Jan 24 18:59:28 2010 -0500 + + When frame_thread_init() fails, free the failed thread context as well. + +commit bffb1c874ec2c9f7ea9c6830d852955a3c2805a0 +Author: Alexander Strange +Date: Wed Aug 6 20:51:34 2008 -0400 + + Make ff_*_thread_free static. + +commit c01185fe11dd2ce35f798d16faec17fcfc64c7c4 +Author: kabi +Date: Fri Mar 8 09:09:57 2002 +0000 + + * BeOS patch by Fran +commit c05a51580b56d1479083b1460dc29492b3fb6b16 +Author: Alexander Strange +Date: Tue Aug 19 00:53:15 2008 -0400 + + Track allocated buffer size properly. Don't allocate buffer padding since the user already did it. + +commit c1b0bddeaf947ef49c63b412918d73fe7a645ba5 +Author: Alexander Strange +Date: Mon Nov 15 04:08:01 2010 -0500 + + pthread: Update and sort the fields copied in update_context_from_thread/update_context_from_user + + Changes to pthread.c are finished. + +commit c29d645dfd2c8168e7c9009638ddb88928e706be +Author: Alexander Strange +Date: Tue May 11 06:12:26 2010 -0400 + + Copy time_base between threads. + + Appears to be used by the h263 decoder. + +commit c2a400d3a5da10f8f2a9c2aa89d9396efe428029 +Merge: b77acce e96a4b0 +Author: Luca Barbato +Date: Thu Aug 14 22:16:09 2008 +0200 + + Merge branch 'master' of git://git.mplayerhq.hu/ffmpeg + +commit c2e19261fe08c2d96d4bf082e97bebcdf12566f2 +Author: Alexander Strange +Date: Sat Feb 20 21:24:24 2010 -0500 + + Remove USE_FRAME_THREADING and USE_AVCODEC_EXECUTE macros. + + Requested in original review, might help making sure pthread emulation + works for encoding tests. + +commit c2e9a1fc965de63271c7c4ddffd7e938ce1bfd93 +Author: benoit +Date: Tue Nov 6 16:28:32 2007 +0000 + + ffplay currently needs special handling for pausing in some protocols. + Patch by Bj +�rn Axelsson: bjorn ; axelsson commit c2eed2a91101a90f2172e81755ca4d655de90443 +Author: Alexander Strange +Date: Wed Nov 3 22:13:07 2010 -0400 + + vp3: Cosmetic changes + +commit c370b927b6d1f0e092e43d58ee29046e5accad1a +Author: Alexander Strange +Date: Sun Feb 6 19:18:10 2011 -0500 + + Improve comment in avcodec.h + +commit c378f545f65d536e55ebe1ac85d170a15e7748eb +Author: Alexander Strange +Date: Wed Aug 6 20:12:01 2008 -0400 + + Reindent. + +commit c45bb41ec61522dcdb97618a0f6fafd8a32d529b +Author: benoit +Date: Mon Jan 7 12:42:02 2008 +0000 + + Make v4l.c's video_formats constant and static. + Patch by Diego 'Flameeyes' Petten +� flameeyes commit c4649d2e370c04c7f5cfcf0b444edc6116ba03f8 +Author: Alexander Strange +Date: Mon Jan 25 03:16:09 2010 -0500 + + Avoid freeing buffers twice when closing mpegvideo. + + This fixes a harmless "unreleased buffers" warning due to the design + of delayed releasing. This is probably a bad way to do it (won't + work if resolution changing is supported) but I can't think of a + better one that's simple. + +commit c5137d0d9e355aecc7e60cef0d2314468b77a147 +Author: Alexander Strange +Date: Sat Jan 15 22:52:30 2011 -0500 + + Update todo.txt + +commit c563b57b187279c1af0f723110bdab815fac6385 +Merge: 65e8486 6a3327b +Author: Alexander Strange +Date: Fri Apr 3 21:23:47 2009 -0400 + + Merge mainline. + + Conflicts: + libavcodec/avcodec.h + libavcodec/mpegvideo.c + +commit c58218c681e51a1b392ddb0177dcff8fc8e99d1c +Author: Alexander Strange +Date: Tue Aug 12 00:45:01 2008 -0400 + + Use HAVE_PTHREADS instead of ENABLE_PTHREADS for mplayer compatibility. + +commit c5ca1f6b5227f8f7a26f889c123c4358ee15596e +Author: Alexander Strange +Date: Sat Jan 15 22:51:43 2011 -0500 + + Pass pkt_dts properly through multithreading + + A/V sync should work in all cases now once guess_correct_pts()/clients + adopt AVFrame.pkt_dts. + +commit c6a59ddd734c7ca92862bce47ec686e16da627ee +Author: Alexander Strange +Date: Fri Jun 19 18:32:12 2009 -0400 + + Remove frame_num stuff from todo. + + The current code is actually correct. + +commit c6bbd5d91408d6dd795dfbbdfba2cef62696d765 +Author: michael +Date: Sun Jan 8 17:06:26 2006 +0000 + + fixing second last time Fran +commit c6f5097967de5ed420cd56a1a77b60a705fcee48 +Author: Alexander Strange +Date: Sat Aug 16 05:09:03 2008 -0400 + + Disable frame threading if low_delay or randomly truncated frames are used. + +commit c75cec5217fc23206476e2d1c894e8a6ddcd81b9 +Author: Alexander Strange +Date: Sun Mar 29 02:25:19 2009 -0400 + + Fix missing ff_get/release_buffer calls in mdec. + +commit c83670eeb613b9509555d4ddcac559a37cc1c5bc +Merge: 2063f77 dde06af +Author: Alexander Strange +Date: Wed Dec 15 15:20:06 2010 -0500 + + Merge mainline. + + Version wasn't updated this time. + + Conflicts: + doc/APIchanges + libavcodec/avcodec.h + +commit c91d7a205df4dd224461b96749b9ce12e2bf6825 +Merge: 4874d25 04c74fc +Author: Alexander Strange +Date: Wed May 19 16:51:42 2010 -0400 + + Merge mainline. + + Conflicts: + libavcodec/avcodec.h + libavcodec/options.c + libavcodec/utils.c + +commit ca89b49eff34604b1354888cd041f474d988c122 +Author: Alexander Strange +Date: Mon Jun 23 04:16:16 2008 -0400 + + Fix ff_frame_thread_flush() + It should setup the context to be just like decoding starting from scratch. + +commit cac4bca0570a9b9ffdd3b49590fe1e41fd5568b0 +Author: Alexander Strange +Date: Sat Jun 27 15:02:21 2009 -0400 + + Fix conditions for drawing edges. + + They shouldn't be drawn for B-frames/intra only (for speed) + and when hwaccel is on (for correctness). + +commit cba830597c99b7a6de57b3cd2209d22598bb72b1 +Author: Alexander Strange +Date: Sat Feb 13 22:45:07 2010 -0500 + + Backport VP3 crash/deadlock fix from mainline r21781. + + Previously, if get_buffer() failed when allocating a golden frame, + it would access it in a later frame without checking it first. + r21781 unintentionally fixed this. + + This should be impossible to trigger, but some other bug in -mt + causes this with frequent seeking. + +commit cbaa375d4cb1320093199e8abe1ce7bcf389036d +Author: michaelni +Date: Sat Nov 2 21:05:54 2002 +0000 + + gcc optimization on BeOS (patch by Fran +commit cbc8d8bec42b371522b0724f27454a96881c4164 +Author: Alexander Strange +Date: Mon Apr 19 02:47:32 2010 -0400 + + Disable multithreading the first field in PAFF. + + At least one PAFF .mp4 file has two fields per packet, which can't + work with -mt - instead it needs to split the fields up like packed + B-frames do. + + Fixes Chalet-Tire.mp4. Pessimizes otherwise working files. + +commit cc33ba7cd7ebbf14b62b0783fb7272e41b484aea +Author: Alexander Strange +Date: Tue May 11 14:41:53 2010 -0400 + + Cosmetics: arbitrary reordering of some pthread struct members + +commit ccd0d039a3d2fd70a9e947cc2faf79ca091dd687 +Author: Luca Barbato +Date: Fri Apr 25 21:52:45 2008 +0200 + + Incorporate swscale as submodule + +commit cd71fb4386961bc860c3abc4cf464b580366d57d +Author: Alexander Strange +Date: Tue Jan 25 16:33:26 2011 -0500 + + Forgot to git add the test failures list + +commit cdc193d0dbc2f0775d177f46036eca0d813f56ff +Author: Alexander Strange +Date: Sun Jul 6 15:53:33 2008 -0400 + + Use static functions instead of macros for consistency. + +commit cf2561f8dcc3143f9c479bba1d9be91339f23726 +Author: Alexander Strange +Date: Fri Jan 21 02:22:56 2011 -0500 + + Write longer comments for callbacks + + Also neglected to update get_buffer to mention thread_safe_callbacks + +commit cf528d74cd7321219880eb06b94a8de0ba5741ff +Author: Alexander Strange +Date: Sun Aug 17 16:50:51 2008 -0400 + + Fix another memory leak. + +commit cf56bb126e7c056740e51c6c13304b03260b4b47 +Merge: ccd0d03 08baa31 +Author: Luca Barbato +Date: Sat May 3 12:18:40 2008 +0200 + + Merge branch 'master' of git://git.mplayerhq.hu/ffmpeg + +commit d0c772c8021702ca79ce2aceeba75902231c0101 +Author: michaelni +Date: Tue Jul 23 22:05:35 2002 +0000 + + patch by Fran +commit d103d4fac41b32915b45534d49d1e6a195b4220b +Author: Alexander Strange +Date: Wed Feb 3 01:00:14 2010 -0500 + + Simplify thread.h by removing the stub functions. + + They don't really help anything, if (HAVE_PTHREADS && ...) is sufficient. + +commit d15ab0f03a257293c0e13eac8b9b031da73c48f3 +Author: Alexander Strange +Date: Tue Jun 3 04:41:33 2008 -0400 + + Macroize some threading checks. + +commit d21f769ead6bd4c24d867b7e9beeb8ffcc86b271 +Author: Alexander Strange +Date: Wed Aug 6 20:36:04 2008 -0400 + + Revert renaming pthread.c. + +commit d2f8287d8526f814bcc88d827775d39ddc5c5f22 +Author: Alexander Strange +Date: Mon Jan 17 14:34:22 2011 -0500 + + Update todo.txt to put important things at the top + +commit d359ab19a25afa7dae20229e62dc0e37b6179ea7 +Author: michaelni +Date: Mon Jul 22 01:44:08 2002 +0000 + + adpcm encoding patch by Fran +commit d419a1c1d30e1b171fba7dc31a909e77a08016ba +Author: Alexander Strange +Date: Sun Aug 24 03:51:18 2008 -0400 + + Comment utility functions in pthread.c + +commit d460fd8d253c90f20536dffe69a6ea20dc113106 +Author: Alexander Strange +Date: Tue Aug 19 15:57:28 2008 -0400 + + Simplify codec close + +commit d4fad7c7f05e6fd7d677eaf1069e04c94b946a0c +Merge: f3f3d11 980ab8d +Author: Alexander Strange +Date: Tue Feb 2 21:41:11 2010 -0500 + + Merge mainline and libswscale. + + ffplay's pts reordering is better now, so ffplay.c has been reverted + to mainline. + + Conflicts: + ffplay.c + libavcodec/avcodec.h + libavcodec/h264.c + +commit d5227efafd855f028338480f937b6ad4a86ef7ac +Author: Alexander Strange +Date: Thu Jun 12 18:24:28 2008 -0400 + + Don't check MAX_THREADS unless slice threading is on. + +commit d5c16c23327d84373fca125b884254550b79c8d7 +Author: mmu_man +Date: Sun Jan 23 09:59:36 2005 +0000 + + Revert the fixed-size-sample patch as it brokes and others + WTF I thought I had commited this yesterday... was probably too asleep :commit d5ea5fc7342e3a1b082659bccd5ffd90a911b780 +Author: Alexander Strange +Date: Thu May 7 01:19:55 2009 -0400 + + Replace the number of frames option with a number of frames to skip. + + The old option wasn't really useful (ffmpeg -t saves more time) + and this is needed to deal with broken stream clips, which are + common and tend to decode differently under mt anyway, which I + don't really care about. + +commit d611b2bcb3ce231242f566cee08a61798a36abc8 +Author: Alexander Strange +Date: Thu Jun 18 05:03:36 2009 -0400 + + Fix race condition upon return from decode_init(). + + We can't call report_frame_progress on every returned frame, + because they may be returned while a past thread is still decoding + them. Instead ensure frames always have this called on them after + their decode is done. + + Should fix all bugs for valid H.264 streams without frame num gaps. + +commit d62b7c03b163c3dc067f122ab9fec44de87b37ae +Author: Alexander Strange +Date: Tue Mar 9 01:54:27 2010 -0500 + + VP3: Only call await_reference_row() for luma + + 4.3% -> 2.1% cpu on big_buck_bunny_1080p_stereo.ogg. + It should be further reducable since VP3 has limited MV range. + +commit d6bb0443c9b316b8cf29720524b4819fb2e6b6a1 +Author: Alexander Strange +Date: Thu Sep 4 01:50:20 2008 -0400 + + Don't mention nonexistant variables in comments + +commit d71a7eef9e540b00b0f91d840116e43206390645 +Author: Alexander Strange +Date: Mon May 24 16:45:27 2010 -0400 + + h264: Delete lines accidentally left behind during a merge + +commit d7cfe6d5cbffa42e178d88d7c647d37431e21861 +Author: Alexander Strange +Date: Tue Feb 1 22:20:19 2011 -0500 + + Fix dropped frames at the beginning of h264 decoding, fixes FATE tests + + Patch by Ronald Bultje (rsbultje@gmail.com) + +commit d8014c67ff1ef20ca05302dea9e262a3089d996e +Merge: 604ee54 4ce0d81 +Author: Alexander Strange +Date: Sat May 1 04:03:03 2010 -0400 + + Merge branch 'master' of git://git.mplayerhq.hu/ffmpeg + +commit d812c6f8b1d897734d6f7b5f1a5c95d3aa10a3ea +Author: Alexander Strange +Date: Thu Jun 24 02:25:25 2010 -0700 + + Fix crash on close when decoding a single-frame h264 file with 3+ threads + + Problematic code path: + 1. sps_buffers[0] is allocated in the first thread's codec context when the + decoder is opened. + 2. The first thread context is memcpy'd to the other threads by frame_thread_init(). + 3. The first thread is closed and its sps_buffers[0] is freed. + 4. The third thread is closed. + Because it never got to decode a frame, update_thread_context was never called, + and sps_buffers[0] still contained the first thread's pointer. + + Fixed by not trying to free sps/pps buffers if the thread wasn't initialized. + I didn't properly consider this when designing it but this seems to be the + best approach anyway. + + Fixes still2.mp4 crash from Chromium + +commit d84fc3dfd3e051c782d063ccba4cc8cadba38797 +Author: michaelni +Date: Tue Nov 5 00:56:08 2002 +0000 + + MIN/MAX sys/param.h patch by (Fran +commit d93fe0ea6b1b8121fdb9521fa7eeac0dc494deeb +Author: benoit +Date: Tue Nov 6 16:19:09 2007 +0000 + + Allow propagation of stream selection through the ASF demuxer to the + MMSH protocol handler. + Patch by Bj +�rn Axelsson: bjorn ; axelsson commit d955ab0dfa73578eaa6a9d1dcb821ce9db409738 +Author: Alexander Strange +Date: Tue Mar 29 04:53:11 2011 -0400 + + Update todo. More items appeared... + +commit da70ded7141aa191b92672c343cd29a0014d861f +Author: Alexander Strange +Date: Thu Dec 18 13:27:51 2008 -0500 + + Update todo + +commit da7bdb1273da15a90bfe08ead91e397247916d11 +Author: Alexander Strange +Date: Tue Jun 24 03:24:17 2008 -0400 + + Get rid of tabs + +commit da86d2da9f6a76238a9d788ecd77f714981e666d +Author: Alexander Strange +Date: Thu Sep 4 01:40:51 2008 -0400 + + Reindent. + +commit da95175e7ce1f911db992fef213322345200feaf +Author: Alexander Strange +Date: Mon Jul 14 01:52:37 2008 -0400 + + Add a parameter to not draw top/bottom in draw_edges. + +commit db2a99d28931128c8598067ae06444ab79f579f8 +Author: Alexander Strange +Date: Tue Jun 9 17:29:47 2009 -0700 + + Fix typo in comment. + +commit dbfbadaa095b65a724ac848d551cfa2aa33e2f6a +Author: Alexander Strange +Date: Tue May 11 05:16:14 2010 -0400 + + Update todo. + + Got another h264 bug report with the same cause as before. + +commit dc53861aadac1d43391b28e4e9793393b26394b9 +Author: Alexander Strange +Date: Wed Jun 18 20:52:34 2008 -0400 + + Always set decode progress to the maximum at the end of decoding + This saves doing it for frames with AC partitioning and such. + We can't do it if the codec didn't return a frame, so there is still an opportunity for deadlocks here, maybe. + +commit dc7c4d436681e43a9f351dd18f70d0dc008aa55e +Author: benoit +Date: Thu Jan 10 10:18:00 2008 +0000 + + Make MMX vectors constants. + Patch by Diego 'Flameeyes' Petten +� flameeyes commit dd9e04497937b7fffdcc65a2b41e36089412d975 +Author: Alexander Strange +Date: Tue Mar 29 17:18:21 2011 -0400 + + Remove unnecessary parameter from ff_thread_init() and fix behavior + + thread_count passed to ff_thread_init() is only used to set AVCodecContext. + thread_count, and can be removed. Instead move it to the legacy implementation + of avcodec_thread_init(). + + This also fixes the problem that calling avcodec_thread_init() with pthreads + enabled did not set it since ff1efc524cb3c60f2f746e3b4550bb1a86c65316. + +commit ddc8310d2a9300139d1821954dfa2d0b775edaa1 +Author: Alexander Strange +Date: Thu Feb 11 22:12:03 2010 -0500 + + Fix mutex leak introduced in 0040d6f2ba. + + If allocate_progress() failed, the error condition returned before + unlocking its mutex. + +commit de365823ec9546a3bd688690e79fc15281a68f1f +Author: Alexander Strange +Date: Wed Jun 23 01:26:42 2010 -0700 + + todo: fix ugly word wrapping + +commit de736aacd945d66109197a6f04baf915d458f5ac +Merge: 7eac0bc 780a37c +Author: Alexander Strange +Date: Thu Jun 18 17:53:09 2009 -0400 + + Merge mainline. + +commit de8abf54671555bb166bb1d44a34fe14e360e2a5 +Author: Alexander Strange +Date: Sun Jan 24 16:37:24 2010 -0500 + + Rename and document MAX_DELAYED_RELEASED_BUFFERS. + +commit dedc2982f2f845357f28dff401fe5df8510c6a8f +Author: benoit +Date: Tue May 22 08:28:32 2007 +0000 + + id3v2 writer + patch by Andreas +�commit df444fadf045bf70058da9b074b8f848fc2209b1 +Merge: 14bdf76 1476e6a +Author: Alexander Strange +Date: Tue Mar 9 02:04:43 2010 -0500 + + Merge branch 'master' of git://git.mplayerhq.hu/ffmpeg + +commit df5d7acdcd0dcbfca6f8fd4f76c9369cb1674435 +Author: Alexander Strange +Date: Sat Aug 16 17:32:24 2008 -0400 + + Don't reuse the user's AVCodecContext for the first decoding thread, and copy more values between them as needed. + + This fixes a large class of race conditions (coded_frame works again) and should improve frame dropping. + +commit dfb8be0a60b9562cf7bb6e54dd67088ff51f83b0 +Author: Alexander Strange +Date: Tue Jun 24 21:35:14 2008 -0400 + + Call avcodec_get_frame_defaults() before decoding. + +commit e0285f04bed7fefba5f75d05c81b145f44fc49f5 +Author: Alexander Strange +Date: Thu Jul 31 18:40:46 2008 -0400 + + Use got_extradata instead of frame_number to guard against rereading extradata. + + frame_number is no longer valid internally, since I don't want to change its definition from the user's perspective. + mpeg12 does the same thing, but I can't find or create any mpeg1+extradata samples to check it. + +commit e044d5c79ab340cf52842ba8452d670959eb37c0 +Merge: 3c3a364 5115473 +Author: Alexander Strange +Date: Fri Nov 7 04:54:47 2008 -0500 + + Merge mainline into ffmpeg-mt + + - Handle reordered_opaque properly + - Picture.field_picture is a duplicate of Picture.mbaff, + but is necessary, since interlaced_frame can't be trusted + and mbaff can't be interpreted without it. + +commit e0dc361e0f0aa315320a549a4fda3424226c556f +Author: Alexander Strange +Date: Mon Sep 1 03:35:23 2008 -0400 + + Update todo + +commit e174657cbb973abf5de9085d00d85ac04d29a475 +Author: Alexander Strange +Date: Thu Aug 28 17:11:09 2008 -0400 + + Move avcodec_thread_init call before avcodec_open in ffplay. + + It makes no sense to have it after, since a decoder is not forbidden from reading it during init. + Encoders already do. + +commit e1f49541b976cdd091aa41f116e7c9fd0c740cf3 +Author: Alexander Strange +Date: Tue Jun 17 23:35:55 2008 -0400 + + Fix rounding for mpeg1 MVs. + +commit e23b687201a076161384fbc7a2f76bd0092dd34c +Author: Alexander Strange +Date: Wed Jan 20 02:36:18 2010 -0500 + + Include the delay from frame threads in has_b_frames. + + This is an API change, but anything that already counted thread_count + just has an incorrectly high max delay size, which shouldn't be a + problem. + +commit e2b9383929e2c703eabd1df8afcb9fa5ad7106ec +Author: Alexander Strange +Date: Sun Jun 15 17:36:59 2008 -0400 + + Add choice of threading algorithm to AVCodecContext. + + Use it to simplify USE_* macros. + FF_THREAD_AUTO needs to be handled better - even if a codec can handle frame-threads, we still don't want to use them if there are enough slices available. + +commit e2ecdd48d664f2660bfd661f1cef6276b986743b +Author: Alexander Strange +Date: Fri Jul 25 03:12:58 2008 -0400 + + Simplify mpeg_decode_update_context. + +commit e303003362829a7f2f1dcbc45d6abc9ac7a59b6a +Author: Alexander Strange +Date: Thu Aug 14 22:59:01 2008 -0400 + + Reindent. + +commit e340cacc56545c5fc3a903c68fec99e8921d579e +Author: Alexander Strange +Date: Sat Nov 8 06:13:23 2008 -0500 + + Disable r15412 for now to avoid crashes. + + update_context can't handle picture pts not pointing to picture and I couldn't think of a better way to do it at 5 am. + May not actually fix anything. + +commit e345a54e5f86d9777e4c3ccb04aad84f9cd77ff0 +Author: Alexander Strange +Date: Mon Mar 8 04:55:43 2010 -0500 + + Add optimization note to todo. + +commit e39c3828e02fe71ce627170bc8c26a558f29f4b8 +Author: Alexander Strange +Date: Mon Feb 15 00:39:39 2010 -0500 + + Update todo + +commit e3f13a4f70b1310309ebb462b1011721cb3692fe +Author: Alexander Strange +Date: Thu Sep 4 14:05:31 2008 -0400 + + Rename new symbols to be shorter + +commit e4565c5731bfcd8808d02f47f115e21dc6fc8b35 +Merge: 4b9ce55 fb61a7c +Author: Alexander Strange +Date: Thu Mar 10 02:25:55 2011 -0500 + + Merge branch 'master' of git://git.ffmpeg.org/ffmpeg + + Conflicts: + .gitignore + doc/APIchanges + ffplay.c + libavcodec/arm/asm-offsets.h + libavcodec/avcodec.h + libavcodec/h264.c + libavcodec/mpegvideo.h + libavcodec/options.c + libavcodec/pthread.c + libavcodec/thread.h + libavcodec/utils.c + libavcodec/vp3.c + libavcodec/vp8.c + libavformat/utils.c + +commit e45cf6d46cb45e6edcf9e4ac368b2a013ba30158 +Author: Alexander Strange +Date: Thu Aug 14 04:01:08 2008 -0400 + + Add todo and some other files. + + Trailing whitespace in mplayer isn't my fault. + +commit e4df986f3d2d3e1be9b0f4eeda463fa854910b8f +Author: Alexander Strange +Date: Thu Aug 28 00:41:52 2008 -0400 + + Revert unnecessary setting of the wrong variable + +commit e53d020b37ca26ffa4cdb22d2b40321897f52ba9 +Author: Alexander Strange +Date: Sat Aug 23 20:39:06 2008 -0400 + + Warn if users try to use frame threading without pthreads. + +commit e717770ee8437c296e012e908b772ba2eaeb2ed3 +Author: Alexander Strange +Date: Tue Jul 15 03:16:22 2008 -0400 + + Create next_delayed_pic for multithreading purposes + unreference_pic is intentionally unchanged. + +commit e71a2b5017728022fa1f992a8b541260615016b2 +Author: Alexander Strange +Date: Wed Jun 18 23:22:01 2008 -0400 + + Use USE_FRAME_THREADING instead of checking for thread_opaque, since it might be the wrong type. + +commit e74ef89858732b9fc4a90c8ec8fbb701407eb987 +Author: Alexander Strange +Date: Wed May 28 22:50:22 2008 -0400 + + Split setting avctx->thread_count from the rest of pthread init. + Make sure it's called from whichever of avcodec_open and avcodec_thread_init comes later. + +commit e7519b6532409e332fc9727ea5a57e148e6655a6 +Author: benoit +Date: Thu May 15 01:03:48 2008 +0000 + + Make av_set_string() fail when number could not be set. + Patch by Stefano Sabatini stefanocommit e8bc7da9d69234ebbcbde371c5a0e20f8b5cfccc +Author: Alexander Strange +Date: Mon Jan 25 02:59:00 2010 -0500 + + Remove accidental extra variable declaration + +commit e95251807c0ae66ffef1e4ad113b9773a287fa5a +Author: Alexander Strange +Date: Sat Jun 27 22:14:45 2009 -0400 + + Get rid of static variables in VP3. + + These are pointless and might behave wrong with thread-local + statics. + +commit e9a0e5eaf5207321baf90160b1094300f3810ecf +Author: Alexander Strange +Date: Mon Jun 23 21:21:44 2008 -0400 + + Use FF_INPUT_BUFFER_PADDING_SIZE for the buffer. + +commit ea396d38059476a54c5855e0bd81955c60238b22 +Author: Alexander Strange +Date: Wed Nov 3 22:50:02 2010 -0400 + + Rewrite comments in thread.h and fix parameter names in ff_thread_decode_frame + +commit ebce21c15f3aaf1b4512436ed8fc2e71a504bb11 +Merge: 3630d89 5570afd +Author: Alexander Strange +Date: Thu Dec 18 12:49:54 2008 -0500 + + Merge mainline. + + Conflicts: + + libavcodec/avcodec.h + libavcodec/mpegvideo.c + libavcodec/utils.c + +commit ed3e2ae1277cc425ef133f10700ace86629381ef +Author: Alexander Strange +Date: Sun Jul 13 16:05:09 2008 -0400 + + Remove useless variable. + +commit ed42183540e2a886a7368b8220e0b50aaf363551 +Author: Alexander Strange +Date: Thu Sep 30 16:53:03 2010 -0400 + + Fix hang decoding VP3/Theora. + + draw_horiz_band changed to only draw the displayed height instead of the + decoded height. This meant that we never reported progress for the last few + decoded pixels, but still awaited them, which deadlocked. + + This shouldn't cause any race conditions, because it always decodes the last + few pixels along with the last decoded pixels. + + Patch by Yuriy Kaminsky (yumkam mail ru). + +commit ed5e8392e2fce8e6b0468de4ae1a4310d338ee46 +Author: Alexander Strange +Date: Thu Aug 28 02:29:08 2008 -0400 + + Simplify(?) threaded avcodec_flush_buffers + +commit ed728b0a05c2154b07cc3d8330d5900dbc45f1d7 +Author: Alexander Strange +Date: Tue May 27 23:25:47 2008 -0400 + + Guard against avcodec_thread_execute() being called without being setup. + +commit edb60439feb2c5d39cda314178686eea151185b3 +Author: Alexander Strange +Date: Mon Nov 1 12:54:47 2010 -0400 + + vp3: Assume MVs are their maximum length of 16 pixels + + This makes it worse (although slightly simpler) in preparation for further + optimization. + +commit ee8430539ec7cc23b7cf6332e26751f539315d5b +Author: Alexander Strange +Date: Sun Jul 6 15:56:28 2008 -0400 + + Don't include the codecs' threading support functions without some kind of threading enabled. + As a side effect this makes non-pthreads threading even more problematic. + +commit eed4b9708287066ccc1b3042110f7c3379f63ee2 +Author: Alexander Strange +Date: Thu Aug 28 01:44:44 2008 -0400 + + Simplify disabling MB skipping + +commit ef26f878e0e581cb61f1e9b376bec4f7ff07397a +Author: Alexander Strange +Date: Tue Mar 9 01:48:18 2010 -0500 + + Cosmetics: fix outdated comment + +commit ef2d8664f1eff56e969801ecd1c5b7c729902819 +Merge: 11b1a8e 9c7037f +Author: Alexander Strange +Date: Tue Jun 8 14:29:22 2010 -0700 + + Merge mainline and libswscale + +commit efd1fb08db3e7964357dc00fd514cfb156b4ee69 +Author: Alexander Strange +Date: Thu Jun 11 11:33:09 2009 -0700 + + Reindent. + +commit f139f42301a5ee861f1a91cdfcceb2a85349fa29 +Merge: 70fb3fd 7210b4e +Author: Luca Barbato +Date: Sun Jun 22 12:08:59 2008 +0200 + + Merge branch 'master' of git://git.mplayerhq.hu/ffmpeg + +commit f143b66d9bf8b23985bf8ec6acf8273c3e9ccd1d +Author: Alexander Strange +Date: Tue Aug 19 21:12:32 2008 -0400 + + Handle NULL threads if they aren't started because of an init error. + +commit f1936d87290c7444090d6cb101b0d7c9270f0a81 +Author: benoit +Date: Thu Jun 24 15:22:33 2010 +0000 + + Set an opaque alpha value when decoding rgba ffv1. + Patch by Thad Ward coderjoe69commit f1fe312cb47cbc540da764cbab3582739a20a8d2 +Author: Alexander Strange +Date: Thu Jun 5 20:30:58 2008 -0400 + + Cosmetics: make thread.h look like other prototypes. + +commit f374d2ee585d7f6c98ffd3a7803223552497904e +Author: Alexander Strange +Date: Fri Jan 21 04:13:06 2011 -0500 + + Simplify change to avcodec_close() and fix a merge glitch in avcodec_open() + +commit f3c88f32b8c806b352cf6e00d6ac80fd32e9f54c +Author: Alexander Strange +Date: Wed Sep 3 11:45:09 2008 -0400 + + Field picture API support + +commit f3f3d1189de648862ca204676dd7591262f590df +Author: Alexander Strange +Date: Mon Jan 25 04:12:34 2010 -0500 + + Add todo note about a change to thread.h I mean to do. + +commit f4d4d43f3a596941b2214ac1e71bb818eb230d6b +Author: Alexander Strange +Date: Fri Jan 21 02:43:30 2011 -0500 + + Minor update to thread.h comment + +commit f4fb456b114eafc22b8ab9bb0bb3e7f13a4fbd9a +Author: Alexander Strange +Date: Tue Nov 2 02:56:12 2010 -0400 + + vp3: Revert motion_y removal + + Although it doesn't have much of an effect on speed either way, I reconsidered + the simplification I wanted to do, and now I'd rather keep this as an example + of proper multithreading structure. + +commit f52df8ebae0ad1db15c5e804a458ca81e04c6156 +Author: Alexander Strange +Date: Mon Aug 25 14:33:09 2008 -0400 + + Fix whitespace mistake + +commit f550857de3ffcb6b2980c4c952b7e84db478d399 +Merge: d62b7c0 a175a04 +Author: Alexander Strange +Date: Sat Mar 27 02:01:59 2010 -0400 + + Merge mainline. + + Conflicts: + libavcodec/avcodec.h + libavcodec/h264.c + libavcodec/options.c + libavcodec/vp3.c + +commit f5596f046c05bc7d8afda7658f891d69587934f0 +Author: Alexander Strange +Date: Mon Nov 15 01:38:36 2010 -0500 + + Rewrite comments and cosmetic changes to pthread.c + + Some small code changes, but there shouldn't be any behavior change. + +commit f695698a78e07a45f4cc9d24ae95fd73f25600e7 +Author: Alexander Strange +Date: Wed Jan 26 12:43:05 2011 -0500 + + Update todo.txt with review feedback + +commit f6d7d0c03c8d7c91a39c9374d9cee83e32627681 +Author: Alexander Strange +Date: Sun Feb 6 19:04:21 2011 -0500 + + pthread: Cosmetic changes and renaming + + Rename frame->packet, picture->frame. + Use /**< to point to the right field in doxygen. + Fix some typos. + +commit f71e7068faabecc32abc798a09b9df403f85e33f +Merge: 2bbb64d a4f892e +Author: Alexander Strange +Date: Thu Jan 6 05:45:03 2011 -0500 + + Merge mainline. + + Conflicts: + doc/APIchanges + +commit f7cc4441b7046a542ef655575ce3e8684ff12e02 +Merge: bba0e09 9eac0a6 +Author: Alexander Strange +Date: Sat Jun 20 15:58:38 2009 -0400 + + Merge mainline. + +commit f9515a4e57356bce4d652451fbaccd071d91dbe9 +Merge: a903974 0c28ee7 +Author: Alexander Strange +Date: Wed Nov 11 15:38:20 2009 -0500 + + Merge mainline. + + In h264, next_outputed_poc is now used in decode_postinit() + where mainline uses outputed_poc. + + Conflicts: + libavcodec/avcodec.h + libavcodec/h263dec.c + libavcodec/h264.c + libavcodec/utils.c + +commit f9b01bbf85d68f23a81ec5325fae81c8518cc385 +Author: Alexander Strange +Date: Mon May 25 20:06:00 2009 -0400 + + Remove unnecessary check from mc_dir_part_y(). + + This was already remove from mc_dir_part(). I hope it's unnecessary + here too. + +commit fa3f68f39f4a96a1170eadfe6ba4677d5d25017f +Author: Alexander Strange +Date: Sat Aug 16 04:23:20 2008 -0400 + + Document functions in thread.h + +commit fa8a82e991280b7ccac89ed2a29b332e609bc370 +Author: Luca Barbato +Date: Sat May 3 15:18:01 2008 +0200 + + Switch to the gitorius mirror of libswscale + +commit fafaae289235b361b6786745dcbdf6fa938c3c2e +Author: Alexander Strange +Date: Thu Dec 4 01:46:22 2008 -0500 + + Don't compare pthread_t to NULL + + It's not required to be a pointer, and it doesn't + need to be validated since pthread_join will just + return an error if it doesn't exist. + + Reverts f143b66d9bf8b23985bf8ec6acf8273c3e9ccd1d + +commit fb1afd9eba5fe2752b83c4b3de24ed88e14b534a +Author: Alexander Strange +Date: Sat Mar 14 00:56:54 2009 -0400 + + Rewrite todo (again...) split up so other people should be able to understand it. + Add yuvcmp, though maybe it should go somewhere else. + +commit fb1f31ff6cbcbbde72920e731223fd0fb8f05d02 +Author: Alexander Strange +Date: Sat Aug 30 04:26:47 2008 -0400 + + Update multithreading doc + +commit fb7dfc0e9e9ff8a5030cde46e28d49d6ce73e453 +Author: Alexander Strange +Date: Sun Jan 24 22:15:56 2010 -0500 + + Always call avcodec_thread_init() in avcodec_open(). + + This matches upstream behavior, but neither of them have any effect. + It allows implementing automatic thread counts, though. + +commit fbb871069bd106bfd47d215216be01d1ef30aec8 +Author: Alexander Strange +Date: Sun Feb 14 23:47:42 2010 -0500 + + Reindent vp3.c. + +commit fc957c71da6c9a7e5c769e15f256652352f7b4a4 +Author: Alexander Strange +Date: Mon May 24 17:31:38 2010 -0400 + + Fix compile with --disable-optimizations. + + gcc can't remove dead code like: + int threaded = HAVE_PTHREADS; + if (threaded) ... + +commit fd1b8587a4186b30c5922e3053c869726cca23df +Author: Alexander Strange +Date: Thu Nov 4 03:55:19 2010 -0400 + + Remove ff_thread_finish_frame() as it seems not useful enough + +commit fd9ae0065aa268c4b3e46706d775cf4ba1df8ed3 +Author: Alexander Strange +Date: Wed May 28 01:34:30 2008 -0400 + + Obfusticate the decoder to make the context copyable earlier. + +commit fda3e64cd474b5886457c6a1ffff8906f76a9bbc +Author: Alexander Strange +Date: Thu Jun 18 16:11:26 2009 -0400 + + Mimic: move up a line changing buf_ptrs. + + No effect on decoding, but it breaks the rule about changing + things after frame_setup_done. + +commit fdb381e68a3828dcc7eb1c93cf174b702cc78d2c +Author: Alexander Strange +Date: Wed Feb 17 00:39:42 2010 -0500 + + Cosmetics: rename function parameters + +commit fe4e238f573bab53760408b3376dbba0255e5b51 +Author: Alexander Strange +Date: Mon May 25 20:00:50 2009 -0400 + + Fix unnecessarily long wait for direct+progressive MBs. + +commit fe529c93b41f2d7406b76e7e5943b82acd789cb4 +Author: benoit +Date: Tue May 22 08:23:45 2007 +0000 + + id3v2 reader + patch by Andreas +�commit febe154099b8f31817e8c047cb3c8dee51b52117 +Author: Alexander Strange +Date: Wed Jun 16 14:54:00 2010 -0700 + + Fix merge glitch: pix_fmts should have been deleted + +commit feca6e0009da2b344b2c1be8f30a55c23623d77e +Merge: 2485cfd feaafaa +Author: Alexander Strange +Date: Mon May 25 19:58:17 2009 -0400 + + Merge branch 'master' of git://git.mplayerhq.hu/ffmpeg + +commit ff08d3a1629ab442f78a1d2fde496b727a1a9deb +Author: Alexander Strange +Date: Sat Jul 12 22:26:43 2008 -0400 + + Fix MPV_lowest_referenced_row to not be completely wrong. + The not handling qpel and emu_edge bugs were masked by the other bugs preventing almost all parallelism. + +commit ff4c627baab555a4ea6275c919d9f4259adc0e58 +Author: Alexander Strange +Date: Tue Oct 6 15:41:35 2009 -0400 + + Word-wrap todo.txt. + + Try to make some of it cleaner + so other people can actually + use it. + +commit ff69da3564ab912f7e7331f8c8389a96a254e16f +Author: Alexander Strange +Date: Sun Aug 1 20:33:57 2010 -0700 + + Fix the decoder not returning any frames if the frame count is less than the number of threads + + Fixes ./mt-work/test.sh with still2.mp4 + diff --git a/doc/avconv.texi b/doc/ffmpeg.texi similarity index 67% rename from doc/avconv.texi rename to doc/ffmpeg.texi index bf72c4c9229..e14885c5b57 100644 --- a/doc/avconv.texi +++ b/doc/ffmpeg.texi @@ -1,8 +1,8 @@ \input texinfo @c -*- texinfo -*- -@settitle avconv Documentation +@settitle ffmpeg Documentation @titlepage -@center @titlefont{avconv Documentation} +@center @titlefont{ffmpeg Documentation} @end titlepage @top @@ -15,18 +15,18 @@ The generic syntax is: @example @c man begin SYNOPSIS -avconv [global options] [[infile options][@option{-i} @var{infile}]]... @{[outfile options] @var{outfile}@}... +ffmpeg [global options] [[infile options][@option{-i} @var{infile}]]... @{[outfile options] @var{outfile}@}... @c man end @end example @chapter Description @c man begin DESCRIPTION -avconv is a very fast video and audio converter that can also grab from +ffmpeg is a very fast video and audio converter that can also grab from a live audio/video source. It can also convert between arbitrary sample rates and resize video on the fly with a high quality polyphase filter. -avconv reads from an arbitrary number of input "files" (which can be regular +ffmpeg reads from an arbitrary number of input "files" (which can be regular files, pipes, network streams, grabbing devices, etc.), specified by the @code{-i} option, and writes to an arbitrary number of output "files", which are specified by a plain output filename. Anything found on the command line which @@ -58,20 +58,20 @@ options apply ONLY to the next input or output file and are reset between files. @item To set the video bitrate of the output file to 64kbit/s: @example -avconv -i input.avi -b 64k output.avi +ffmpeg -i input.avi -b:v 64k output.avi @end example @item To force the frame rate of the output file to 24 fps: @example -avconv -i input.avi -r 24 output.avi +ffmpeg -i input.avi -r 24 output.avi @end example @item To force the frame rate of the input file (valid for raw formats only) to 1 fps and the frame rate of the output file to 24 fps: @example -avconv -r 1 -i input.m2v -r 24 output.avi +ffmpeg -r 1 -i input.m2v -r 24 output.avi @end example @end itemize @@ -82,10 +82,12 @@ The format option may be needed for raw input files. @chapter Stream selection @c man begin STREAM SELECTION -By default avconv tries to pick the "best" stream of each type present in input -files and add them to each output file. For video, this means the highest -resolution, for audio the highest channel count. For subtitle it's simply the -first subtitle stream. +By default ffmpeg includes only one stream of each type (video, audio, subtitle) +present in the input files and adds them to each output file. It picks the +"best" of each based upon the following criteria; for video it is the stream +with the highest resolution, for audio the stream with the most channels, for +subtitle it's the first subtitle stream. In the case where several streams of +the same type rate equally, the lowest numbered stream is chosen. You can disable some of those defaults by using @code{-vn/-an/-sn} options. For full manual control, use the @code{-map} option, which disables the defaults just @@ -103,7 +105,7 @@ described. @table @option @item -f @var{fmt} (@emph{input/output}) -Force input or output file format. The format is normally autodetected for input +Force input or output file format. The format is normally auto detected for input files and guessed from file extension for output files, so this option is not needed in most cases. @@ -113,22 +115,25 @@ input file name @item -y (@emph{global}) Overwrite output files without asking. +@item -n (@emph{global}) +Do not overwrite output files but exit if file exists. + @item -c[:@var{stream_specifier}] @var{codec} (@emph{input/output,per-stream}) @itemx -codec[:@var{stream_specifier}] @var{codec} (@emph{input/output,per-stream}) Select an encoder (when used before an output file) or a decoder (when used before an input file) for one or more streams. @var{codec} is the name of a decoder/encoder or a special value @code{copy} (output only) to indicate that -the stream is not to be reencoded. +the stream is not to be re-encoded. For example @example -avconv -i INPUT -map 0 -c:v libx264 -c:a copy OUTPUT +ffmpeg -i INPUT -map 0 -c:v libx264 -c:a copy OUTPUT @end example encodes all video streams with libx264 and copies all audio streams. For each stream, the last matching @code{c} option is applied, so @example -avconv -i INPUT -map 0 -c copy -c:v:1 libx264 -c:a:137 libvorbis OUTPUT +ffmpeg -i INPUT -map 0 -c copy -c:v:1 libx264 -c:a:137 libvorbis OUTPUT @end example will copy all the streams except the second video, which will be encoded with libx264, and the 138th audio, which will be encoded with libvorbis. @@ -138,7 +143,7 @@ Stop writing the output after its duration reaches @var{duration}. @var{duration} may be a number in seconds, or in @code{hh:mm:ss[.xxx]} form. @item -fs @var{limit_size} (@emph{output}) -Set the file size limit. +Set the file size limit, expressed in bytes. @item -ss @var{position} (@emph{input/output}) When used as an input option (before @code{-i}), seeks in this input file to @@ -155,6 +160,18 @@ The offset is added to the timestamps of the input files. Specifying a positive offset means that the corresponding streams are delayed by @var{offset} seconds. +@item -timestamp @var{time} (@emph{output}) +Set the recording timestamp in the container. +The syntax for @var{time} is: +@example +now|([(YYYY-MM-DD|YYYYMMDD)[T|t| ]]((HH[:MM[:SS[.m...]]])|(HH[MM[SS[.m...]]]))[Z|z]) +@end example +If the value is "now" it takes the current time. +Time is local time unless 'Z' or 'z' is appended, in which case it is +interpreted as UTC. +If the year-month-day part is not specified it takes the current +year-month-day. + @item -metadata[:metadata_specifier] @var{key}=@var{value} (@emph{output,per-metadata}) Set a metadata key/value pair. @@ -167,12 +184,12 @@ also possible to delete metadata by using an empty value. For example, for setting the title in the output file: @example -avconv -i in.avi -metadata title="my title" out.flv +ffmpeg -i in.avi -metadata title="my title" out.flv @end example To set the language of the first audio stream: @example -avconv -i INPUT -metadata:s:a:0 language=eng OUTPUT +ffmpeg -i INPUT -metadata:s:a:1 language=eng OUTPUT @end example @item -target @var{type} (@emph{output}) @@ -182,14 +199,14 @@ Specify target file type (@code{vcd}, @code{svcd}, @code{dvd}, @code{dv}, (bitrate, codecs, buffer sizes) are then set automatically. You can just type: @example -avconv -i myfile.avi -target vcd /tmp/vcd.mpg +ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg @end example Nevertheless you can specify additional options as long as you know they do not conflict with the standard, as in: @example -avconv -i myfile.avi -target vcd -bf 2 /tmp/vcd.mpg +ffmpeg -i myfile.avi -target vcd -bf 2 /tmp/vcd.mpg @end example @item -dframes @var{number} (@emph{output}) @@ -216,6 +233,14 @@ Specify the preset for matching stream(s). @item -stats (@emph{global}) Print encoding progress/statistics. On by default. +@item -debug_ts (@emph{global}) +Print timestamp information. It is off by default. This option is +mostly useful for testing and debugging purposes, and the output +format may change from one version to another, so it should not be +employed by portable scripts. + +See also the option @code{-fdebug ts}. + @item -attach @var{filename} (@emph{output}) Add an attachment to the output file. This is supported by a few formats like Matroska for e.g. fonts used in rendering subtitles. Attachments @@ -227,7 +252,7 @@ with @code{-map} or automatic mappings). Note that for Matroska you also have to set the mimetype metadata tag: @example -avconv -i INPUT -attach DejaVuSans.ttf -metadata:s:2 mimetype=application/x-truetype-font out.mkv +ffmpeg -i INPUT -attach DejaVuSans.ttf -metadata:s:2 mimetype=application/x-truetype-font out.mkv @end example (assuming that the attachment stream will be third in the output file). @@ -238,11 +263,11 @@ will be used. E.g. to extract the first attachment to a file named 'out.ttf': @example -avconv -dump_attachment:t:0 out.ttf INPUT +ffmpeg -dump_attachment:t:0 out.ttf INPUT @end example To extract all attachments to files determined by the @code{filename} tag: @example -avconv -dump_attachment:t "" INPUT +ffmpeg -dump_attachment:t "" INPUT @end example Technical note -- attachments are implemented as codec extradata, so this @@ -331,6 +356,21 @@ form @var{num}:@var{den}, where @var{num} and @var{den} are the numerator and denominator of the aspect ratio. For example "4:3", "16:9", "1.3333", and "1.7777" are valid argument values. +@item -croptop @var{size} +@item -cropbottom @var{size} +@item -cropleft @var{size} +@item -cropright @var{size} +All the crop options have been removed. Use -vf +crop=width:height:x:y instead. + +@item -padtop @var{size} +@item -padbottom @var{size} +@item -padleft @var{size} +@item -padright @var{size} +@item -padcolor @var{hex_color} +All the pad options have been removed. Use -vf +pad=width:height:x:y:color instead. + @item -vn (@emph{output}) Disable video recording. @@ -351,15 +391,18 @@ at the exact requested bitrate. On pass 1, you may just deactivate audio and set output to null, examples for Windows and Unix: @example -avconv -i foo.mov -c:v libxvid -pass 1 -an -f rawvideo -y NUL -avconv -i foo.mov -c:v libxvid -pass 1 -an -f rawvideo -y /dev/null +ffmpeg -i foo.mov -c:v libxvid -pass 1 -an -f rawvideo -y NUL +ffmpeg -i foo.mov -c:v libxvid -pass 1 -an -f rawvideo -y /dev/null @end example @item -passlogfile @var{prefix} (@emph{global}) Set two-pass log file name prefix to @var{prefix}, the default file name -prefix is ``av2pass''. The complete file name will be +prefix is ``ffmpeg2pass''. The complete file name will be @file{PREFIX-N.log}, where N is a number specific to the output -stream. +stream + +@item -vlang @var{code} +Set the ISO 639 language code (3 letters) of the current video stream. @item -vf @var{filter_graph} (@emph{output}) @var{filter_graph} is a description of the filter graph to apply to @@ -381,12 +424,23 @@ Set SwScaler flags. Discard threshold. @item -rc_override[:@var{stream_specifier}] @var{override} (@emph{output,per-stream}) -rate control override for specific intervals +Rate control override for specific intervals, formatted as "int,int,int" +list separated with slashes. Two first values are the beginning and +end frame numbers, last one is quantizer to use if positive, or quality +factor if negative. @item -deinterlace Deinterlace pictures. This option is deprecated since the deinterlacing is very low quality. Use the yadif filter with @code{-filter:v yadif}. +@item -ilme +Force interlacing support in encoder (MPEG-2 and MPEG-4 only). +Use this option if your input file is interlaced and you want +to keep the interlaced format for minimum losses. +The alternative is to deinterlace the input stream with +@option{-deinterlace}, but deinterlacing introduces losses. +@item -psnr +Calculate PSNR of compressed frames. @item -vstats Dump video coding statistics to @file{vstats_HHMMSS.log}. @item -vstats_file @var{file} @@ -398,7 +452,9 @@ Intra_dc_precision. @item -vtag @var{fourcc/tag} (@emph{output}) Force video tag/fourcc. This is an alias for @code{-tag:v}. @item -qphist (@emph{global}) -Show QP histogram. +Show QP histogram +@item -vbsf @var{bitstream_filter} +Deprecated see -bsf @item -force_key_frames[:@var{stream_specifier}] @var{time}[,@var{time}...] (@emph{output,per-stream}) Force key frames at the specified timestamps, more precisely at the first frames after each specified time. @@ -442,15 +498,21 @@ of supported sample formats. @table @option @item -atag @var{fourcc/tag} (@emph{output}) Force audio tag/fourcc. This is an alias for @code{-tag:a}. +@item -absf @var{bitstream_filter} +Deprecated, see -bsf @end table @section Subtitle options: @table @option +@item -slang @var{code} +Set the ISO 639 language code (3 letters) of the current subtitle stream. @item -scodec @var{codec} (@emph{input/output}) Set the subtitle codec. This is an alias for @code{-codec:s}. @item -sn (@emph{output}) Disable subtitle recording. +@item -sbsf @var{bitstream_filter} +Deprecated, see -bsf @end table @section Audio/Video grab options @@ -485,7 +547,7 @@ graphs (see the @option{-filter_complex} option) to the output file. For example, to map ALL streams from the first input file to output @example -avconv -i INPUT -map 0 output +ffmpeg -i INPUT -map 0 output @end example For example, if you have two audio streams in the first input file, @@ -493,7 +555,7 @@ these streams are identified by "0:0" and "0:1". You can use @code{-map} to select which streams to place in an output file. For example: @example -avconv -i INPUT -map 0:1 out.wav +ffmpeg -i INPUT -map 0:1 out.wav @end example will map the input stream in @file{INPUT} identified by "0:1" to the (single) output stream in @file{out.wav}. @@ -503,21 +565,80 @@ For example, to select the stream with index 2 from input file index 6 from input @file{b.mov} (specified by the identifier "1:6"), and copy them to the output file @file{out.mov}: @example -avconv -i a.mov -i b.mov -c copy -map 0:2 -map 1:6 out.mov +ffmpeg -i a.mov -i b.mov -c copy -map 0:2 -map 1:6 out.mov @end example To select all video and the third audio stream from an input file: @example -avconv -i INPUT -map 0:v -map 0:a:2 OUTPUT +ffmpeg -i INPUT -map 0:v -map 0:a:2 OUTPUT @end example To map all the streams except the second audio, use negative mappings @example -avconv -i INPUT -map 0 -map -0:a:1 OUTPUT +ffmpeg -i INPUT -map 0 -map -0:a:1 OUTPUT @end example Note that using this option disables the default mappings for this output file. +@item -map_channel [@var{input_file_id}.@var{stream_specifier}.@var{channel_id}|-1][:@var{output_file_id}.@var{stream_specifier}] +Map an audio channel from a given input to an output. If +@var{output_file_id}.@var{stream_specifier} is not set, the audio channel will +be mapped on all the audio streams. + +Using "-1" instead of +@var{input_file_id}.@var{stream_specifier}.@var{channel_id} will map a muted +channel. + +For example, assuming @var{INPUT} is a stereo audio file, you can switch the +two audio channels with the following command: +@example +ffmpeg -i INPUT -map_channel 0.0.1 -map_channel 0.0.0 OUTPUT +@end example + +If you want to mute the first channel and keep the second: +@example +ffmpeg -i INPUT -map_channel -1 -map_channel 0.0.1 OUTPUT +@end example + +The order of the "-map_channel" option specifies the order of the channels in +the output stream. The output channel layout is guessed from the number of +channels mapped (mono if one "-map_channel", stereo if two, etc.). Using "-ac" +in combination of "-map_channel" makes the channel gain levels to be updated if +input and output channel layouts don't match (for instance two "-map_channel" +options and "-ac 6"). + +You can also extract each channel of an input to specific outputs; the following +command extracts two channels of the @var{INPUT} audio stream (file 0, stream 0) +to the respective @var{OUTPUT_CH0} and @var{OUTPUT_CH1} outputs: +@example +ffmpeg -i INPUT -map_channel 0.0.0 OUTPUT_CH0 -map_channel 0.0.1 OUTPUT_CH1 +@end example + +The following example splits the channels of a stereo input into two separate +streams, which are put into the same output file: +@example +ffmpeg -i stereo.wav -map 0:0 -map 0:0 -map_channel 0.0.0:0.0 -map_channel 0.0.1:0.1 -y out.ogg +@end example + +Note that currently each output stream can only contain channels from a single +input stream; you can't for example use "-map_channel" to pick multiple input +audio channels contained in different streams (from the same or different files) +and merge them into a single output stream. It is therefore not currently +possible, for example, to turn two separate mono streams into a single stereo +stream. However splitting a stereo stream into two single channel mono streams +is possible. + +If you need this feature, a possible workaround is to use the @emph{amerge} +filter. For example, if you need to merge a media (here @file{input.mkv}) with 2 +mono audio streams into one single stereo channel audio stream (and keep the +video stream), you can use the following command: +@example +ffmpeg -i input.mkv -f lavfi -i " +amovie=input.mkv:si=1 [a1]; +amovie=input.mkv:si=2 [a2]; +[a1][a2] amerge" -c:a pcm_s16le -c:v copy output.mkv +@end example + @item -map_metadata[:@var{metadata_spec_out}] @var{infile}[:@var{metadata_spec_in}] (@emph{output,per-metadata}) Set metadata information of the next output file from @var{infile}. Note that those are file indices (zero-based), not filenames. @@ -549,12 +670,12 @@ file index can be used to create a dummy mapping that just disables automatic co For example to copy metadata from the first stream of the input file to global metadata of the output file: @example -avconv -i in.ogg -map_metadata 0:s:0 out.mp3 +ffmpeg -i in.ogg -map_metadata 0:s:0 out.mp3 @end example To do the reverse, i.e. copy global metadata to all audio streams: @example -avconv -i in.mkv -map_metadata:s:a 0:g out.mkv +ffmpeg -i in.mkv -map_metadata:s:a 0:g out.mkv @end example Note that simple @code{0} would work as well in this example, since global metadata is assumed by default. @@ -564,34 +685,81 @@ Copy chapters from input file with index @var{input_file_index} to the next output file. If no chapter mapping is specified, then chapters are copied from the first input file with at least one chapter. Use a negative file index to disable any chapter copying. -@item -debug +@item -debug @var{category} Print specific debug info. +@var{category} is a number or a string containing one of the following values: +@table @samp +@item bitstream +@item buffers +picture buffer allocations +@item bugs +@item dct_coeff +@item er +error recognition +@item mb_type +macroblock (MB) type +@item mmco +memory management control operations (H.264) +@item mv +motion vector +@item pict +picture info +@item pts +@item qp +per-block quantization parameter (QP) +@item rc +rate control +@item skip +@item startcode +@item thread_ops +threading operations +@item vis_mb_type +visualize block types +@item vis_qp +visualize quantization parameter (QP), lower QP are tinted greener +@end table @item -benchmark (@emph{global}) Show benchmarking information at the end of an encode. Shows CPU time used and maximum memory consumption. Maximum memory consumption is not supported on all systems, it will usually display as 0 if not supported. +@item -benchmark_all (@emph{global}) +Show benchmarking information during the encode. +Shows CPU time used in various steps (audio/video encode/decode). @item -timelimit @var{duration} (@emph{global}) -Exit after avconv has been running for @var{duration} seconds. +Exit after ffmpeg has been running for @var{duration} seconds. @item -dump (@emph{global}) Dump each input packet to stderr. @item -hex (@emph{global}) When dumping packets, also dump the payload. @item -re (@emph{input}) Read input at native frame rate. Mainly used to simulate a grab device. +@item -loop_input +Loop over the input stream. Currently it works only for image +streams. This option is used for automatic FFserver testing. +This option is deprecated, use -loop 1. +@item -loop_output @var{number_of_times} +Repeatedly loop output for formats that support looping such as animated GIF +(0 will loop the output infinitely). +This option is deprecated, use -loop. @item -vsync @var{parameter} Video sync method. +For compatibility reasons old values can be specified as numbers. +Newly added values will have to be specified as strings always. @table @option -@item passthrough +@item 0, passthrough Each frame is passed with its timestamp from the demuxer to the muxer. -@item cfr +@item 1, cfr Frames will be duplicated and dropped to achieve exactly the requested constant framerate. -@item vfr +@item 2, vfr Frames are passed through with their timestamp or dropped so as to prevent 2 frames from having the same timestamp. -@item auto +@item drop +As passthrough but destroys all timestamps, making the muxer generate +fresh timestamps based on frame-rate. +@item -1, auto Chooses between 1 and 2 depending on muxer capabilities. This is the default method. @end table @@ -607,8 +775,30 @@ the parameter is the maximum samples per second by which the audio is changed. without any later correction. @item -copyts Copy timestamps from input to output. -@item -copytb -Copy input stream time base from input to output when stream copying. +@item -copytb @var{mode} +Specify how to set the encoder timebase when stream copying. @var{mode} is an +integer numeric value, and can assume one of the following values: + +@table @option +@item 1 +Use the demuxer timebase. + +The time base is copied to the output encoder from the corresponding input +demuxer. This is sometimes required to avoid non monotonically increasing +timestamps when copying video streams with variable frame rate. + +@item 0 +Use the decoder timebase. + +The time base is copied to the output encoder from the corresponding input +decoder. + +@item -1 +Try to make the choice automatically, in order to generate a sane output. +@end table + +Default value is -1. + @item -shortest Finish encoding when the shortest input stream ends. @item -dts_delta_threshold @@ -626,7 +816,7 @@ may be reassigned to a different value. For example, to set the stream 0 PID to 33 and the stream 1 PID to 36 for an output mpegts file: @example -avconv -i infile -streamid 0:33 -streamid 1:36 out.ts +ffmpeg -i infile -streamid 0:33 -streamid 1:36 out.ts @end example @item -bsf[:@var{stream_specifier}] @var{bitstream_filters} (@emph{output,per-stream}) @@ -634,18 +824,21 @@ Set bitstream filters for matching streams. @var{bistream_filters} is a comma-separated list of bitstream filters. Use the @code{-bsfs} option to get the list of bitstream filters. @example -avconv -i h264.mp4 -c:v copy -bsf:v h264_mp4toannexb -an out.h264 +ffmpeg -i h264.mp4 -c:v copy -bsf:v h264_mp4toannexb -an out.h264 @end example @example -avconv -i file.mov -an -vn -bsf:s mov2textsub -c:s copy -f rawvideo sub.txt +ffmpeg -i file.mov -an -vn -bsf:s mov2textsub -c:s copy -f rawvideo sub.txt @end example -@item -tag[:@var{stream_specifier}] @var{codec_tag} (@emph{output,per-stream}) +@item -tag[:@var{stream_specifier}] @var{codec_tag} (@emph{per-stream}) Force a tag/fourcc for matching streams. -@item -cpuflags mask (@emph{global}) -Set a mask that's applied to autodetected CPU flags. This option is intended -for testing. Do not use it unless you know what you're doing. +@item -timecode @var{hh}:@var{mm}:@var{ss}SEP@var{ff} +Specify Timecode for writing. @var{SEP} is ':' for non drop timecode and ';' +(or '.') for drop. +@example +ffmpeg -i input.mpg -timecode 01:02:03.04 -r 30000/1001 -s ntsc output.mpg +@end example @item -filter_complex @var{filtergraph} (@emph{global}) Define a complex filter graph, i.e. one with arbitrary number of inputs and/or @@ -664,7 +857,7 @@ added to the first output file. For example, to overlay an image over video @example -avconv -i video.mkv -i image.png -filter_complex '[0:v][1:v]overlay[out]' -map +ffmpeg -i video.mkv -i image.png -filter_complex '[0:v][1:v]overlay[out]' -map '[out]' out.mkv @end example Here @code{[0:v]} refers to the first video stream in the first input file, @@ -675,16 +868,49 @@ of overlay. Assuming there is only one video stream in each input file, we can omit input labels, so the above is equivalent to @example -avconv -i video.mkv -i image.png -filter_complex 'overlay[out]' -map +ffmpeg -i video.mkv -i image.png -filter_complex 'overlay[out]' -map '[out]' out.mkv @end example Furthermore we can omit the output label and the single output from the filter graph will be added to the output file automatically, so we can simply write @example -avconv -i video.mkv -i image.png -filter_complex 'overlay' out.mkv +ffmpeg -i video.mkv -i image.png -filter_complex 'overlay' out.mkv @end example @end table + +@section Preset files +A preset file contains a sequence of @var{option}=@var{value} pairs, +one for each line, specifying a sequence of options which would be +awkward to specify on the command line. Lines starting with the hash +('#') character are ignored and are used to provide comments. Check +the @file{presets} directory in the FFmpeg source tree for examples. + +Preset files are specified with the @code{vpre}, @code{apre}, +@code{spre}, and @code{fpre} options. The @code{fpre} option takes the +filename of the preset instead of a preset name as input and can be +used for any kind of codec. For the @code{vpre}, @code{apre}, and +@code{spre} options, the options specified in a preset file are +applied to the currently selected codec of the same type as the preset +option. + +The argument passed to the @code{vpre}, @code{apre}, and @code{spre} +preset options identifies the preset file to use according to the +following rules: + +First ffmpeg searches for a file named @var{arg}.ffpreset in the +directories @file{$FFMPEG_DATADIR} (if set), and @file{$HOME/.ffmpeg}, and in +the datadir defined at configuration time (usually @file{PREFIX/share/ffmpeg}) +or in a @file{ffpresets} folder along the executable on win32, +in that order. For example, if the argument is @code{libx264-max}, it will +search for the file @file{libx264-max.ffpreset}. + +If no such file is found, then ffmpeg will search for a file named +@var{codec_name}-@var{arg}.ffpreset in the above-mentioned +directories, where @var{codec_name} is the name of the codec to which +the preset file options will be applied. For example, if you select +the video codec with @code{-vcodec libx264} and use @code{-vpre max}, +then it will search for the file @file{libx264-max.ffpreset}. @c man end OPTIONS @chapter Tips @@ -698,7 +924,7 @@ the Linux player does not seem to be very fast, so it can miss frames. An example is: @example -avconv -g 3 -r 3 -t 10 -b 50k -s qcif -f rv10 /tmp/b.rm +ffmpeg -g 3 -r 3 -t 10 -b:v 50k -s qcif -f rv10 /tmp/b.rm @end example @item @@ -737,43 +963,48 @@ A preset file contains a sequence of @var{option=value} pairs, one for each line, specifying a sequence of options which can be specified also on the command line. Lines starting with the hash ('#') character are ignored and are used to provide comments. Empty lines are also ignored. Check the -@file{presets} directory in the Libav source tree for examples. +@file{presets} directory in the FFmpeg source tree for examples. Preset files are specified with the @code{pre} option, this option takes a -preset name as input. Avconv searches for a file named @var{preset_name}.avpreset in -the directories @file{$AVCONV_DATADIR} (if set), and @file{$HOME/.avconv}, and in -the data directory defined at configuration time (usually @file{$PREFIX/share/avconv}) +preset name as input. FFmpeg searches for a file named @var{preset_name}.avpreset in +the directories @file{$AVCONV_DATADIR} (if set), and @file{$HOME/.ffmpeg}, and in +the data directory defined at configuration time (usually @file{$PREFIX/share/ffmpeg}) in that order. For example, if the argument is @code{libx264-max}, it will search for the file @file{libx264-max.avpreset}. @section Video and Audio grabbing -If you specify the input format and device then avconv can grab video +If you specify the input format and device then ffmpeg can grab video and audio directly. @example -avconv -f oss -i /dev/dsp -f video4linux2 -i /dev/video0 /tmp/out.mpg +ffmpeg -f oss -i /dev/dsp -f video4linux2 -i /dev/video0 /tmp/out.mpg +@end example + +Or with an ALSA audio source (mono input, card id 1) instead of OSS: +@example +ffmpeg -f alsa -ac 1 -i hw:1 -f video4linux2 -i /dev/video0 /tmp/out.mpg @end example Note that you must activate the right video source and channel before -launching avconv with any TV viewer such as +launching ffmpeg with any TV viewer such as @uref{http://linux.bytesex.org/xawtv/, xawtv} by Gerd Knorr. You also have to set the audio recording levels correctly with a standard mixer. @section X11 grabbing -Grab the X11 display with avconv via +Grab the X11 display with ffmpeg via @example -avconv -f x11grab -s cif -r 25 -i :0.0 /tmp/out.mpg +ffmpeg -f x11grab -s cif -r 25 -i :0.0 /tmp/out.mpg @end example 0.0 is display.screen number of your X11 server, same as the DISPLAY environment variable. @example -avconv -f x11grab -s cif -r 25 -i :0.0+10,20 /tmp/out.mpg +ffmpeg -f x11grab -s cif -r 25 -i :0.0+10,20 /tmp/out.mpg @end example 0.0 is display.screen number of your X11 server, same as the DISPLAY environment @@ -781,7 +1012,7 @@ variable. 10 is the x-offset and 20 the y-offset for the grabbing. @section Video and Audio file format conversion -Any supported file format and protocol can serve as input to avconv: +Any supported file format and protocol can serve as input to ffmpeg: Examples: @itemize @@ -789,7 +1020,7 @@ Examples: You can use YUV files as input: @example -avconv -i /tmp/test%d.Y /tmp/out.mpg +ffmpeg -i /tmp/test%d.Y /tmp/out.mpg @end example It will use the files: @@ -801,13 +1032,13 @@ It will use the files: The Y files use twice the resolution of the U and V files. They are raw files, without header. They can be generated by all decent video decoders. You must specify the size of the image with the @option{-s} option -if avconv cannot guess it. +if ffmpeg cannot guess it. @item You can input from a raw YUV420P file: @example -avconv -i /tmp/test.yuv /tmp/out.avi +ffmpeg -i /tmp/test.yuv /tmp/out.avi @end example test.yuv is a file containing raw YUV planar data. Each frame is composed @@ -818,14 +1049,14 @@ horizontal resolution. You can output to a raw YUV420P file: @example -avconv -i mydivx.avi hugefile.yuv +ffmpeg -i mydivx.avi hugefile.yuv @end example @item You can set several input files and output files: @example -avconv -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg +ffmpeg -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg @end example Converts the audio file a.wav and the raw YUV video file a.yuv @@ -835,7 +1066,7 @@ to MPEG file a.mpg. You can also do audio and video conversions at the same time: @example -avconv -i /tmp/a.wav -ar 22050 /tmp/a.mp2 +ffmpeg -i /tmp/a.wav -ar 22050 /tmp/a.mp2 @end example Converts a.wav to MPEG audio at 22050 Hz sample rate. @@ -845,7 +1076,7 @@ You can encode to several formats at the same time and define a mapping from input stream to output streams: @example -avconv -i /tmp/a.wav -map 0:a -b 64k /tmp/a.mp2 -map 0:a -b 128k /tmp/b.mp2 +ffmpeg -i /tmp/a.wav -map 0:a -b:a 64k /tmp/a.mp2 -map 0:a -b:a 128k /tmp/b.mp2 @end example Converts a.wav to a.mp2 at 64 kbits and to b.mp2 at 128 kbits. '-map @@ -856,7 +1087,7 @@ stream, in the order of the definition of output streams. You can transcode decrypted VOBs: @example -avconv -i snatch_1.vob -f avi -c:v mpeg4 -b:v 800k -g 300 -bf 2 -c:a libmp3lame -b:a 128k snatch.avi +ffmpeg -i snatch_1.vob -f avi -c:v mpeg4 -b:v 800k -g 300 -bf 2 -c:a libmp3lame -b:a 128k snatch.avi @end example This is a typical DVD ripping example; the input is a VOB file, the @@ -868,14 +1099,14 @@ to enable LAME support by passing @code{--enable-libmp3lame} to configure. The mapping is particularly useful for DVD transcoding to get the desired audio language. -NOTE: To see the supported input formats, use @code{avconv -formats}. +NOTE: To see the supported input formats, use @code{ffmpeg -formats}. @item You can extract images from a video, or create a video from many images: For extracting images from a video: @example -avconv -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg +ffmpeg -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg @end example This will extract one video frame per second from the video and will @@ -888,7 +1119,7 @@ combination with -ss to start extracting from a certain point in time. For creating a video from many images: @example -avconv -f image2 -i foo-%03d.jpeg -r 12 -s WxH foo.avi +ffmpeg -f image2 -i foo-%03d.jpeg -r 12 -s WxH foo.avi @end example The syntax @code{foo-%03d.jpeg} specifies to use a decimal number @@ -896,11 +1127,23 @@ composed of three digits padded with zeroes to express the sequence number. It is the same syntax supported by the C printf function, but only formats accepting a normal integer are suitable. +When importing an image sequence, -i also supports expanding shell-like +wildcard patterns (globbing) internally. To lower the chance of interfering +with your actual file names and the shell's glob expansion, you are required +to activate glob meta characters by prefixing them with a single @code{%} +character, like in @code{foo-%*.jpeg}, @code{foo-%?%?%?.jpeg} or +@code{foo-00%[234%]%*.jpeg}. +If your filename actually contains a character sequence of a @code{%} character +followed by a glob character, you must double the @code{%} character to escape +it. Imagine your files begin with @code{%?-foo-}, then you could use a glob +pattern like @code{%%?-foo-%*.jpeg}. For input patterns that could be both a +printf or a glob pattern, ffmpeg will assume it is a glob pattern. + @item You can put many streams of the same type in the output: @example -avconv -i test1.avi -i test2.avi -map 0.3 -map 0.2 -map 0.1 -map 0.0 -c copy test12.nut +ffmpeg -i test1.avi -i test2.avi -map 0.3 -map 0.2 -map 0.1 -map 0.0 -c copy test12.nut @end example The resulting output file @file{test12.avi} will contain first four streams from @@ -909,20 +1152,21 @@ the input file in reverse order. @item To force CBR video output: @example -avconv -i myfile.avi -b 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k out.m2v +ffmpeg -i myfile.avi -b 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k out.m2v @end example @item The four options lmin, lmax, mblmin and mblmax use 'lambda' units, but you may use the QP2LAMBDA constant to easily convert from 'q' units: @example -avconv -i src.ext -lmax 21*QP2LAMBDA dst.ext +ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext @end example @end itemize @c man end EXAMPLES @include eval.texi +@include decoders.texi @include encoders.texi @include demuxers.texi @include muxers.texi @@ -935,15 +1179,15 @@ avconv -i src.ext -lmax 21*QP2LAMBDA dst.ext @ignore -@setfilename avconv -@settitle avconv video converter +@setfilename ffmpeg +@settitle ffmpeg video converter @c man begin SEEALSO -avplay(1), avprobe(1) and the Libav HTML documentation +ffplay(1), ffprobe(1), ffserver(1) and the FFmpeg HTML documentation @c man end @c man begin AUTHORS -The Libav developers +See git history @c man end @end ignore diff --git a/doc/ffmpeg.txt b/doc/ffmpeg.txt new file mode 100644 index 00000000000..a028ca23d2d --- /dev/null +++ b/doc/ffmpeg.txt @@ -0,0 +1,47 @@ + : + ffmpeg.c : libav* + ======== : ====== + : + : + --------------------------------:---> AVStream... + InputStream input_streams[] / : + / : + InputFile input_files[] +==========================+ / ^ : + ------> 0 | : st ---:-----------:--/ : : + ^ +------+-----------+-----+ / +--------------------------+ : : + : | :ist_index--:-----:---------/ 1 | : st : | : : + : +------+-----------+-----+ +==========================+ : : + nb_input_files : | :ist_index--:-----:------------------> 2 | : st : | : : + : +------+-----------+-----+ +--------------------------+ : nb_input_streams : + : | :ist_index : | 3 | ... | : : + v +------+-----------+-----+ +--------------------------+ : : + --> 4 | | : : + | +--------------------------+ : : + | 5 | | : : + | +==========================+ v : + | : + | : + | : + | : + --------- --------------------------------:---> AVStream... + \ / : + OutputStream output_streams[] / : + \ / : + +======\======================/======+ ^ : + ------> 0 | : source_index : st-:--- | : : + OutputFile output_files[] / +------------------------------------+ : : + / 1 | : : : | : : + ^ +------+------------+-----+ / +------------------------------------+ : : + : | : ost_index -:-----:------/ 2 | : : : | : : + nb_output_files : +------+------------+-----+ +====================================+ : : + : | : ost_index -:-----|-----------------> 3 | : : : | : : + : +------+------------+-----+ +------------------------------------+ : nb_output_streams : + : | : : | 4 | | : : + : +------+------------+-----+ +------------------------------------+ : : + : | : : | 5 | | : : + v +------+------------+-----+ +------------------------------------+ : : + 6 | | : : + +------------------------------------+ : : + 7 | | : : + +====================================+ v : + : diff --git a/doc/avplay.texi b/doc/ffplay.texi similarity index 74% rename from doc/avplay.texi rename to doc/ffplay.texi index 8fc33081de4..06666f6e59e 100644 --- a/doc/avplay.texi +++ b/doc/ffplay.texi @@ -1,8 +1,8 @@ \input texinfo @c -*- texinfo -*- -@settitle avplay Documentation +@settitle ffplay Documentation @titlepage -@center @titlefont{avplay Documentation} +@center @titlefont{ffplay Documentation} @end titlepage @top @@ -13,16 +13,16 @@ @example @c man begin SYNOPSIS -avplay [options] @file{input_file} +ffplay [options] [@file{input_file}] @c man end @end example @chapter Description @c man begin DESCRIPTION -AVplay is a very simple and portable media player using the Libav +FFplay is a very simple and portable media player using the FFmpeg libraries and the SDL library. It is mostly used as a testbed for the -various Libav APIs. +various FFmpeg APIs. @c man end @chapter Options @@ -38,9 +38,9 @@ Force displayed width. @item -y @var{height} Force displayed height. @item -s @var{size} -This option has been removed. Use private format options for specifying the -input video size. For example with the rawvideo demuxer you need to specify the -option @var{video_size}. +Set frame size (WxH or abbreviation), needed for videos which do +not contain a header with the frame size like raw YUV. This option +has been deprecated in favor of private options, try -video_size. @item -an Disable audio. @item -vn @@ -59,29 +59,44 @@ Force format. Set window title (default is the input filename). @item -loop @var{number} Loops movie playback times. 0 means forever. +@item -showmode @var{mode} +Set the show mode to use. +Available values for @var{mode} are: +@table @samp +@item 0, video +show video +@item 1, waves +show audio waves +@item 2, rdft +show audio frequency band using RDFT ((Inverse) Real Discrete Fourier Transform) +@end table + +Default value is "video", if video is not present or cannot be played +"rdft" is automatically selected. + +You can interactively cycle through the available show modes by +pressing the key @key{w}. + @item -vf @var{filter_graph} @var{filter_graph} is a description of the filter graph to apply to the input video. Use the option "-filters" to show all the available filters (including also sources and sinks). +@item -i @var{input_file} +Read @var{input_file}. @end table @section Advanced options @table @option @item -pix_fmt @var{format} -This option has been removed. Use private options for specifying the -input pixel format. For example with the rawvideo demuxer you need to specify -the option @var{pixel_format}. +Set pixel format. +This option has been deprecated in favor of private options, try -pixel_format. @item -stats Show the stream duration, the codec parameters, the current position in the stream and the audio/video synchronisation drift. -@item -debug -Print specific debug info. @item -bug Work around bugs. -@item -vismv -Visualize motion vectors. @item -fast Non-spec-compliant optimizations. @item -genpts @@ -119,6 +134,8 @@ Exit when video is done playing. Exit if any key is pressed. @item -exitonmousedown Exit if any mouse button is pressed. +@item -codec:@var{stream_type} +Force a specific decoder implementation @end table @section While playing @@ -151,6 +168,9 @@ Seek backward/forward 10 seconds. @item down/up Seek backward/forward 1 minute. +@item page down/page up +Seek backward/forward 10 minutes. + @item mouse click Seek to percentage in file corresponding to fraction of width. @@ -159,6 +179,7 @@ Seek to percentage in file corresponding to fraction of width. @c man end @include eval.texi +@include decoders.texi @include demuxers.texi @include muxers.texi @include indevs.texi @@ -168,15 +189,15 @@ Seek to percentage in file corresponding to fraction of width. @ignore -@setfilename avplay -@settitle AVplay media player +@setfilename ffplay +@settitle FFplay media player @c man begin SEEALSO -avconv(1), avprobe(1) and the Libav HTML documentation +ffmpeg(1), ffprobe(1), ffserver(1) and the FFmpeg HTML documentation @c man end @c man begin AUTHORS -The Libav developers +The FFmpeg developers @c man end @end ignore diff --git a/doc/ffprobe.texi b/doc/ffprobe.texi new file mode 100644 index 00000000000..12fe29f01fb --- /dev/null +++ b/doc/ffprobe.texi @@ -0,0 +1,342 @@ +\input texinfo @c -*- texinfo -*- + +@settitle ffprobe Documentation +@titlepage +@center @titlefont{ffprobe Documentation} +@end titlepage + +@top + +@contents + +@chapter Synopsis + +The generic syntax is: + +@example +@c man begin SYNOPSIS +ffprobe [options] [@file{input_file}] +@c man end +@end example + +@chapter Description +@c man begin DESCRIPTION + +ffprobe gathers information from multimedia streams and prints it in +human- and machine-readable fashion. + +For example it can be used to check the format of the container used +by a multimedia stream and the format and type of each media stream +contained in it. + +If a filename is specified in input, ffprobe will try to open and +probe the file content. If the file cannot be opened or recognized as +a multimedia file, a positive exit code is returned. + +ffprobe may be employed both as a standalone application or in +combination with a textual filter, which may perform more +sophisticated processing, e.g. statistical processing or plotting. + +Options are used to list some of the formats supported by ffprobe or +for specifying which information to display, and for setting how +ffprobe will show it. + +ffprobe output is designed to be easily parsable by a textual filter, +and consists of one or more sections of a form defined by the selected +writer, which is specified by the @option{print_format} option. + +Metadata tags stored in the container or in the streams are recognized +and printed in the corresponding "FORMAT" or "STREAM" section. + +@c man end + +@chapter Options +@c man begin OPTIONS + +@include avtools-common-opts.texi + +@section Main options + +@table @option + +@item -f @var{format} +Force format to use. + +@item -unit +Show the unit of the displayed values. + +@item -prefix +Use SI prefixes for the displayed values. +Unless the "-byte_binary_prefix" option is used all the prefixes +are decimal. + +@item -byte_binary_prefix +Force the use of binary prefixes for byte values. + +@item -sexagesimal +Use sexagesimal format HH:MM:SS.MICROSECONDS for time values. + +@item -pretty +Prettify the format of the displayed values, it corresponds to the +options "-unit -prefix -byte_binary_prefix -sexagesimal". + +@item -print_format @var{writer_name}[=@var{writer_options}] +Set the output printing format. + +@var{writer_name} specifies the name of the writer, and +@var{writer_options} specifies the options to be passed to the writer. + +For example for printing the output in JSON format, specify: +@example +-print_format json +@end example + +For more details on the available output printing formats, see the +Writers section below. + +@item -show_error +Show information about the error found when trying to probe the input. + +The error information is printed within a section with name "ERROR". + +@item -show_format +Show information about the container format of the input multimedia +stream. + +All the container format information is printed within a section with +name "FORMAT". + +@item -show_packets +Show information about each packet contained in the input multimedia +stream. + +The information for each single packet is printed within a dedicated +section with name "PACKET". + +@item -show_frames +Show information about each frame contained in the input multimedia +stream. + +The information for each single frame is printed within a dedicated +section with name "FRAME". + +@item -show_streams +Show information about each media stream contained in the input +multimedia stream. + +Each media stream information is printed within a dedicated section +with name "STREAM". + +@item -count_frames +Count the number of frames per stream and report it in the +corresponding stream section. + +@item -count_packets +Count the number of packets per stream and report it in the +corresponding stream section. + +@item -show_private_data, -private +Show private data, that is data depending on the format of the +particular shown element. +This option is enabled by default, but you may need to disable it +for specific uses, for example when creating XSD-compliant XML output. + +@item -show_program_version +Show information related to program version. + +Version information is printed within a section with name +"PROGRAM_VERSION". + +@item -show_library_versions +Show information related to library versions. + +Version information for each library is printed within a section with +name "LIBRARY_VERSION". + +@item -show_versions +Show information related to program and library versions. This is the +equivalent of setting both @option{-show_program_version} and +@option{-show_library_versions} options. + +@item -i @var{input_file} +Read @var{input_file}. + +@end table +@c man end + +@chapter Writers +@c man begin WRITERS + +A writer defines the output format adopted by @command{ffprobe}, and will be +used for printing all the parts of the output. + +A writer may accept one or more arguments, which specify the options to +adopt. + +A description of the currently available writers follows. + +@section default +Default format. + +Print each section in the form: +@example +[SECTION] +key1=val1 +... +keyN=valN +[/SECTION] +@end example + +Metadata tags are printed as a line in the corresponding FORMAT or +STREAM section, and are prefixed by the string "TAG:". + +@section compact +Compact format. + +Each section is printed on a single line. +If no option is specifid, the output has the form: +@example +section|key1=val1| ... |keyN=valN +@end example + +Metadata tags are printed in the corresponding "format" or "stream" +section. A metadata tag key, if printed, is prefixed by the string +"tag:". + +This writer accepts options as a list of @var{key}=@var{value} pairs, +separated by ":". + +The description of the accepted options follows. + +@table @option + +@item item_sep, s +Specify the character to use for separating fields in the output line. +It must be a single printable character, it is "|" by default. + +@item nokey, nk +If set to 1 specify not to print the key of each field. Its default +value is 0. + +@item escape, e +Set the escape mode to use, default to "c". + +It can assume one of the following values: +@table @option +@item c +Perform C-like escaping. Strings containing a newline ('\n') or +carriage return ('\r'), the escaping character ('\') or the item +separator character @var{SEP} are escaped using C-like fashioned +escaping, so that a newline is converted to the sequence "\n", a +carriage return to "\r", '\' to "\\" and the separator @var{SEP} is +converted to "\@var{SEP}". + +@item csv +Perform CSV-like escaping, as described in RFC4180. Strings +containing a newline ('\n'), a carriage return ('\r'), a double quote +('"'), or @var{SEP} are enclosed in double-quotes. + +@item none +Perform no escaping. +@end table + +@end table + +@section csv +CSV format. + +This writer is equivalent to +@code{compact=item_sep=,:nokey=1:escape=csv}. + +@section json +JSON based format. + +Each section is printed using JSON notation. + +This writer accepts options as a list of @var{key}=@var{value} pairs, +separated by ":". + +The description of the accepted options follows. + +@table @option + +@item compact, c +If set to 1 enable compact output, that is each section will be +printed on a single line. Default value is 0. +@end table + +For more information about JSON, see @url{http://www.json.org/}. + +@section xml +XML based format. + +The XML output is described in the XML schema description file +@file{ffprobe.xsd} installed in the FFmpeg datadir. + +Note that the output issued will be compliant to the +@file{ffprobe.xsd} schema only when no special global output options +(@option{unit}, @option{prefix}, @option{byte_binary_prefix}, +@option{sexagesimal} etc.) are specified. + +This writer accepts options as a list of @var{key}=@var{value} pairs, +separated by ":". + +The description of the accepted options follows. + +@table @option + +@item fully_qualified, q +If set to 1 specify if the output should be fully qualified. Default +value is 0. +This is required for generating an XML file which can be validated +through an XSD file. + +@item xsd_compliant, x +If set to 1 perform more checks for ensuring that the output is XSD +compliant. Default value is 0. +This option automatically sets @option{fully_qualified} to 1. +@end table + +For more information about the XML format, see +@url{http://www.w3.org/XML/}. + +@chapter Timecode + +@command{ffprobe} supports Timecode extraction: + +@itemize + +@item MPEG1/2 timecode is extracted from the GOP, and is available in the video +stream details (@option{-show_streams}, see @var{timecode}). + +@item MOV timecode is extracted from tmcd track, so is available in the tmcd +stream metadata (@option{-show_streams}, see @var{TAG:timecode}). + +@item DV and GXF timecodes are available in format metadata +(@option{-show_format}, see @var{TAG:timecode}). + +@end itemize + +@c man end WRITERS + +@include decoders.texi +@include demuxers.texi +@include protocols.texi +@include indevs.texi + +@ignore + +@setfilename ffprobe +@settitle ffprobe media prober + +@c man begin SEEALSO +ffmpeg(1), ffplay(1), ffserver(1) and the FFmpeg HTML documentation +@c man end + +@c man begin AUTHORS +The FFmpeg developers +@c man end + +@end ignore + +@bye diff --git a/doc/ffprobe.xsd b/doc/ffprobe.xsd new file mode 100644 index 00000000000..3984b7dc2e7 --- /dev/null +++ b/doc/ffprobe.xsd @@ -0,0 +1,167 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/avserver.conf b/doc/ffserver.conf similarity index 92% rename from doc/avserver.conf rename to doc/ffserver.conf index e9724bbf99a..d10ac5bc09f 100644 --- a/doc/avserver.conf +++ b/doc/ffserver.conf @@ -12,7 +12,7 @@ BindAddress 0.0.0.0 # MaxClients maximum limit. MaxHTTPConnections 2000 -# Number of simultaneous requests that can be handled. Since AVServer +# Number of simultaneous requests that can be handled. Since FFServer # is very fast, it is more likely that you will want to leave this high # and use MaxBandwidth, below. MaxClients 1000 @@ -25,24 +25,24 @@ MaxBandwidth 1000 # '-' is the standard output. CustomLog - -# Suppress that if you want to launch avserver as a daemon. +# Suppress that if you want to launch ffserver as a daemon. NoDaemon ################################################################## # Definition of the live feeds. Each live feed contains one video -# and/or audio sequence coming from an avconv encoder or another -# avserver. This sequence may be encoded simultaneously with several +# and/or audio sequence coming from an ffmpeg encoder or another +# ffserver. This sequence may be encoded simultaneously with several # codecs at several resolutions. -# You must use 'avconv' to send a live feed to avserver. In this +# You must use 'ffmpeg' to send a live feed to ffserver. In this # example, you can type: # -# avconv http://localhost:8090/feed1.ffm +# ffmpeg http://localhost:8090/feed1.ffm -# avserver can also do time shifting. It means that it can stream any +# ffserver can also do time shifting. It means that it can stream any # previously recorded live stream. The request should contain: # "http://xxxx?date=[YYYY-MM-DDT][[HH:]MM:]SS[.m...]".You must specify # a path where the feed is stored on disk. You also specify the @@ -55,10 +55,10 @@ FileMaxSize 200K # ReadOnlyFile /saved/specialvideo.ffm # This marks the file as readonly and it will not be deleted or updated. -# Specify launch in order to start avconv automatically. -# First avconv must be defined with an appropriate path if needed, +# Specify launch in order to start ffmpeg automatically. +# First ffmpeg must be defined with an appropriate path if needed, # after that options can follow, but avoid adding the http:// field -#Launch avconv +#Launch ffmpeg # Only allow connections from localhost to the feed. ACL allow 127.0.0.1 @@ -69,7 +69,7 @@ ACL allow 127.0.0.1 ################################################################## # Now you can define each stream which will be generated from the # original audio and video stream. Each format has a filename (here -# 'test1.mpg'). AVServer will send this stream when answering a +# 'test1.mpg'). FFServer will send this stream when answering a # request containing this filename. @@ -334,7 +334,7 @@ StartSendOnKey # multicast address with MulticastAddress. The port and the TTL can # also be set. # -# An SDP file is automatically generated by avserver by adding the +# An SDP file is automatically generated by ffserver by adding the # 'sdp' extension to the stream name (here # http://localhost:8090/test1-sdp.sdp). You should usually give this # file to your player to play the stream. @@ -371,5 +371,5 @@ ACL allow 192.168.0.0 192.168.255.255 # Redirect index.html to the appropriate site -URL http://www.libav.org/ +URL http://www.ffmpeg.org/ diff --git a/doc/avserver.texi b/doc/ffserver.texi similarity index 76% rename from doc/avserver.texi rename to doc/ffserver.texi index c023814e084..074c075f0be 100644 --- a/doc/avserver.texi +++ b/doc/ffserver.texi @@ -1,8 +1,8 @@ \input texinfo @c -*- texinfo -*- -@settitle avserver Documentation +@settitle ffserver Documentation @titlepage -@center @titlefont{avserver Documentation} +@center @titlefont{ffserver Documentation} @end titlepage @top @@ -15,41 +15,38 @@ The generic syntax is: @example @c man begin SYNOPSIS -avserver [options] +ffserver [options] @c man end @end example @chapter Description @c man begin DESCRIPTION -WARNING: avserver is unmaintained, largely broken and in need of a -complete rewrite. It probably won't work for you. Use at your own -risk. +ffserver is a streaming server for both audio and video. It supports -avserver is a streaming server for both audio and video. It supports several live feeds, streaming from files and time shifting on live feeds (you can seek to positions in the past on each live feed, provided you -specify a big enough feed storage in avserver.conf). +specify a big enough feed storage in ffserver.conf). -avserver runs in daemon mode by default; that is, it puts itself in +ffserver runs in daemon mode by default; that is, it puts itself in the background and detaches from its TTY, unless it is launched in debug mode or a NoDaemon option is specified in the configuration file. -This documentation covers only the streaming aspects of avserver / -avconv. All questions about parameters for avconv, codec questions, -etc. are not covered here. Read @file{avconv.html} for more +This documentation covers only the streaming aspects of ffserver / +ffmpeg. All questions about parameters for ffmpeg, codec questions, +etc. are not covered here. Read @file{ffmpeg.html} for more information. @section How does it work? -avserver receives prerecorded files or FFM streams from some avconv +ffserver receives prerecorded files or FFM streams from some ffmpeg instance as input, then streams them over RTP/RTSP/HTTP. -An avserver instance will listen on some port as specified in the -configuration file. You can launch one or more instances of avconv and -send one or more FFM streams to the port where avserver is expecting -to receive them. Alternately, you can make avserver launch such avconv +An ffserver instance will listen on some port as specified in the +configuration file. You can launch one or more instances of ffmpeg and +send one or more FFM streams to the port where ffserver is expecting +to receive them. Alternately, you can make ffserver launch such ffmpeg instances at startup. Input streams are called feeds, and each one is specified by a @@ -61,7 +58,7 @@ file. @section Status stream -avserver supports an HTTP interface which exposes the current status +ffserver supports an HTTP interface which exposes the current status of the server. Simply point your browser to the address of the special status stream @@ -104,18 +101,18 @@ I understand that FreeBSD systems work just fine as well. @section How do I make it work? First, build the kit. It *really* helps to have installed LAME first. Then when -you run the avserver ./configure, make sure that you have the +you run the ffserver ./configure, make sure that you have the @code{--enable-libmp3lame} flag turned on. LAME is important as it allows for streaming audio to Windows Media Player. Don't ask why the other audio types do not work. As a simple test, just run the following two command lines where INPUTFILE -is some file which you can decode with avconv: +is some file which you can decode with ffmpeg: @example -./avserver -f doc/avserver.conf & -./avconv -i INPUTFILE http://localhost:8090/feed1.ffm +ffserver -f doc/ffserver.conf & +ffmpeg -i INPUTFILE http://localhost:8090/feed1.ffm @end example At this point you should be able to go to your Windows machine and fire up @@ -133,8 +130,8 @@ The same is true of AVI files. @section What happens next? -You should edit the avserver.conf file to suit your needs (in terms of -frame rates etc). Then install avserver and avconv, write a script to start +You should edit the ffserver.conf file to suit your needs (in terms of +frame rates etc). Then install ffserver and ffmpeg, write a script to start them up, and off you go. @section Troubleshooting @@ -142,13 +139,13 @@ them up, and off you go. @subsection I don't hear any audio, but video is fine. Maybe you didn't install LAME, or got your ./configure statement wrong. Check -the avconv output to see if a line referring to MP3 is present. If not, then +the ffmpeg output to see if a line referring to MP3 is present. If not, then your configuration was incorrect. If it is, then maybe your wiring is not set up correctly. Maybe the sound card is not getting data from the right input source. Maybe you have a really awful audio interface (like I do) that only captures in stereo and also requires that one channel be flipped. If you are one of these people, then export 'AUDIO_FLIP_LEFT=1' before -starting avconv. +starting ffmpeg. @subsection The audio and video lose sync after a while. @@ -170,14 +167,14 @@ I suspect that the new one is not available unless you have installed WMP 7]. You can replay video from .ffm files that was recorded earlier. However, there are a number of caveats, including the fact that the -avserver parameters must match the original parameters used to record the -file. If they do not, then avserver deletes the file before recording into it. +ffserver parameters must match the original parameters used to record the +file. If they do not, then ffserver deletes the file before recording into it. (Now that I write this, it seems broken). You can fiddle with many of the codec choices and encoding parameters, and there are a bunch more parameters that you cannot control. Post a message to the mailing list if there are some 'must have' parameters. Look in -avserver.conf for a list of the currently available controls. +ffserver.conf for a list of the currently available controls. It will automatically generate the ASX or RAM files that are often used in browsers. These files are actually redirections to the underlying ASF @@ -191,7 +188,7 @@ finishes.] * When you connect to a live stream, most players (WMP, RA, etc) want to buffer a certain number of seconds of material so that they can display the -signal continuously. However, avserver (by default) starts sending data +signal continuously. However, ffserver (by default) starts sending data in realtime. This means that there is a pause of a few seconds while the buffering is being done by the player. The good news is that this can be cured by adding a '?buffer=5' to the end of the URL. This means that the @@ -199,13 +196,13 @@ stream should start 5 seconds in the past -- and so the first 5 seconds of the stream are sent as fast as the network will allow. It will then slow down to real time. This noticeably improves the startup experience. -You can also add a 'Preroll 15' statement into the avserver.conf that will +You can also add a 'Preroll 15' statement into the ffserver.conf that will add the 15 second prebuffering on all requests that do not otherwise -specify a time. In addition, avserver will skip frames until a key_frame +specify a time. In addition, ffserver will skip frames until a key_frame is found. This further reduces the startup delay by not transferring data that will be discarded. -* You may want to adjust the MaxBandwidth in the avserver.conf to limit +* You may want to adjust the MaxBandwidth in the ffserver.conf to limit the amount of bandwidth consumed by live streams. @section Why does the ?buffer / Preroll stop working after a time? @@ -222,7 +219,7 @@ handled. @section Does the @code{?date=} stuff work. Yes (subject to the limitation outlined above). Also note that whenever you -start avserver, it deletes the ffm file (if any parameters have changed), +start ffserver, it deletes the ffm file (if any parameters have changed), thus wiping out what you had recorded before. The format of the @code{?date=xxxxxx} is fairly flexible. You should use one @@ -250,31 +247,31 @@ For example: @samp{http://localhost:8080/test.asf?date=2002-07-26T23:05:00}. @table @option @item -f @var{configfile} -Use @file{configfile} instead of @file{/etc/avserver.conf}. +Use @file{configfile} instead of @file{/etc/ffserver.conf}. @item -n Enable no-launch mode. This option disables all the Launch directives -within the various sections. Since avserver will not launch -any avconv instances, you will have to launch them manually. +within the various sections. Since ffserver will not launch +any ffmpeg instances, you will have to launch them manually. @item -d Enable debug mode. This option increases log verbosity, directs log -messages to stdout and causes avserver to run in the foreground +messages to stdout and causes ffserver to run in the foreground rather than as a daemon. @end table @c man end @ignore -@setfilename avserver -@settitle avserver video server +@setfilename ffserver +@settitle ffserver video server @c man begin SEEALSO -avconv(1), avplay(1), avprobe(1), the @file{avserver.conf} -example and the Libav HTML documentation +ffmpeg(1), ffplay(1), ffprobe(1), the @file{ffserver.conf} +example and the FFmpeg HTML documentation @c man end @c man begin AUTHORS -The Libav developers +The FFmpeg developers @c man end @end ignore diff --git a/doc/filters.texi b/doc/filters.texi index b012dc791f1..56299771a55 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -19,7 +19,7 @@ output pads is called a "sink". A filtergraph can be represented using a textual representation, which is recognized by the @option{-filter}/@option{-vf} and @option{-filter_complex} -options in @command{avconv} and @option{-vf} in @command{avplay}, and by the +options in @command{ffmpeg} and @option{-vf} in @command{ffplay}, and by the @code{avfilter_graph_parse()}/@code{avfilter_graph_parse2()} function defined in @file{libavfilter/avfiltergraph.h}. @@ -100,17 +100,408 @@ Follows a BNF description for the filtergraph syntax: @chapter Audio Filters @c man begin AUDIO FILTERS -When you configure your Libav build, you can disable any of the -existing filters using --disable-filters. +When you configure your FFmpeg build, you can disable any of the +existing filters using @code{--disable-filters}. The configure output will show the audio filters included in your build. Below is a description of the currently available audio filters. +@section aconvert + +Convert the input audio format to the specified formats. + +The filter accepts a string of the form: +"@var{sample_format}:@var{channel_layout}". + +@var{sample_format} specifies the sample format, and can be a string or the +corresponding numeric value defined in @file{libavutil/samplefmt.h}. Use 'p' +suffix for a planar sample format. + +@var{channel_layout} specifies the channel layout, and can be a string +or the corresponding number value defined in @file{libavutil/audioconvert.h}. + +The special parameter "auto", signifies that the filter will +automatically select the output format depending on the output filter. + +Some examples follow. + +@itemize +@item +Convert input to float, planar, stereo: +@example +aconvert=fltp:stereo +@end example + +@item +Convert input to unsigned 8-bit, automatically select out channel layout: +@example +aconvert=u8:auto +@end example +@end itemize + +@section aformat + +Convert the input audio to one of the specified formats. The framework will +negotiate the most appropriate format to minimize conversions. + +The filter accepts three lists of formats, separated by ":", in the form: +"@var{sample_formats}:@var{channel_layouts}:@var{packing_formats}". + +Elements in each list are separated by "," which has to be escaped in the +filtergraph specification. + +The special parameter "all", in place of a list of elements, signifies all +supported formats. + +Some examples follow: +@example +aformat=u8\\,s16:mono:packed + +aformat=s16:mono\\,stereo:all +@end example + +@section amerge + +Merge two audio streams into a single multi-channel stream. + +This filter does not need any argument. + +If the channel layouts of the inputs are disjoint, and therefore compatible, +the channel layout of the output will be set accordingly and the channels +will be reordered as necessary. If the channel layouts of the inputs are not +disjoint, the output will have all the channels of the first input then all +the channels of the second input, in that order, and the channel layout of +the output will be the default value corresponding to the total number of +channels. + +For example, if the first input is in 2.1 (FL+FR+LF) and the second input +is FC+BL+BR, then the output will be in 5.1, with the channels in the +following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the +first input, b1 is the first channel of the second input). + +On the other hand, if both input are in stereo, the output channels will be +in the default order: a1, a2, b1, b2, and the channel layout will be +arbitrarily set to 4.0, which may or may not be the expected value. + +Both inputs must have the same sample rate, format and packing. + +If inputs do not have the same duration, the output will stop with the +shortest. + +Example: merge two mono files into a stereo stream: +@example +amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge +@end example + +If you need to do multiple merges (for instance multiple mono audio streams in +a single video media), you can do: +@example +ffmpeg -f lavfi -i " +amovie=input.mkv:si=0 [a0]; +amovie=input.mkv:si=1 [a1]; +amovie=input.mkv:si=2 [a2]; +amovie=input.mkv:si=3 [a3]; +amovie=input.mkv:si=4 [a4]; +amovie=input.mkv:si=5 [a5]; +[a0][a1] amerge [x0]; +[x0][a2] amerge [x1]; +[x1][a3] amerge [x2]; +[x2][a4] amerge [x3]; +[x3][a5] amerge" -c:a pcm_s16le output.mkv +@end example + @section anull Pass the audio source unchanged to the output. +@section aresample + +Resample the input audio to the specified sample rate. + +The filter accepts exactly one parameter, the output sample rate. If not +specified then the filter will automatically convert between its input +and output sample rates. + +For example, to resample the input audio to 44100Hz: +@example +aresample=44100 +@end example + +@section ashowinfo + +Show a line containing various information for each input audio frame. +The input audio is not modified. + +The shown line contains a sequence of key/value pairs of the form +@var{key}:@var{value}. + +A description of each shown parameter follows: + +@table @option +@item n +sequential number of the input frame, starting from 0 + +@item pts +presentation TimeStamp of the input frame, expressed as a number of +time base units. The time base unit depends on the filter input pad, and +is usually 1/@var{sample_rate}. + +@item pts_time +presentation TimeStamp of the input frame, expressed as a number of +seconds + +@item pos +position of the frame in the input stream, -1 if this information in +unavailable and/or meaningless (for example in case of synthetic audio) + +@item fmt +sample format name + +@item chlayout +channel layout description + +@item nb_samples +number of samples (per each channel) contained in the filtered frame + +@item rate +sample rate for the audio frame + +@item planar +if the packing format is planar, 0 if packed + +@item checksum +Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame + +@item plane_checksum +Adler-32 checksum (printed in hexadecimal) for each input frame plane, +expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3} @var{c4} @var{c5} +@var{c6} @var{c7}]" +@end table + +@section asplit + +Pass on the input audio to two outputs. Both outputs are identical to +the input audio. + +For example: +@example +[in] asplit[out0], showaudio[out1] +@end example + +will create two separate outputs from the same input, one cropped and +one padded. + +@section astreamsync + +Forward two audio streams and control the order the buffers are forwarded. + +The argument to the filter is an expression deciding which stream should be +forwarded next: if the result is negative, the first stream is forwarded; if +the result is positive or zero, the second stream is forwarded. It can use +the following variables: + +@table @var +@item b1 b2 +number of buffers forwarded so far on each stream +@item s1 s2 +number of samples forwarded so far on each stream +@item t1 t2 +current timestamp of each stream +@end table + +The default value is @code{t1-t2}, which means to always forward the stream +that has a smaller timestamp. + +Example: stress-test @code{amerge} by randomly sending buffers on the wrong +input, while avoiding too much of a desynchronization: +@example +amovie=file.ogg [a] ; amovie=file.mp3 [b] ; +[a] [b] astreamsync=(2*random(1))-1+tanh(5*(t1-t2)) [a2] [b2] ; +[a2] [b2] amerge +@end example + +@section earwax + +Make audio easier to listen to on headphones. + +This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio +so that when listened to on headphones the stereo image is moved from +inside your head (standard for headphones) to outside and in front of +the listener (standard for speakers). + +Ported from SoX. + +@section pan + +Mix channels with specific gain levels. The filter accepts the output +channel layout followed by a set of channels definitions. + +This filter is also designed to remap efficiently the channels of an audio +stream. + +The filter accepts parameters of the form: +"@var{l}:@var{outdef}:@var{outdef}:..." + +@table @option +@item l +output channel layout or number of channels + +@item outdef +output channel specification, of the form: +"@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]" + +@item out_name +output channel to define, either a channel name (FL, FR, etc.) or a channel +number (c0, c1, etc.) + +@item gain +multiplicative coefficient for the channel, 1 leaving the volume unchanged + +@item in_name +input channel to use, see out_name for details; it is not possible to mix +named and numbered input channels +@end table + +If the `=' in a channel specification is replaced by `<', then the gains for +that specification will be renormalized so that the total is 1, thus +avoiding clipping noise. + +@subsection Mixing examples + +For example, if you want to down-mix from stereo to mono, but with a bigger +factor for the left channel: +@example +pan=1:c0=0.9*c0+0.1*c1 +@end example + +A customized down-mix to stereo that works automatically for 3-, 4-, 5- and +7-channels surround: +@example +pan=stereo: FL < FL + 0.5*FC + 0.6*BL + 0.6*SL : FR < FR + 0.5*FC + 0.6*BR + 0.6*SR +@end example + +Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system +that should be preferred (see "-ac" option) unless you have very specific +needs. + +@subsection Remapping examples + +The channel remapping will be effective if, and only if: + +@itemize +@item gain coefficients are zeroes or ones, +@item only one input per channel output, +@end itemize + +If all these conditions are satisfied, the filter will notify the user ("Pure +channel mapping detected"), and use an optimized and lossless method to do the +remapping. + +For example, if you have a 5.1 source and want a stereo audio stream by +dropping the extra channels: +@example +pan="stereo: c0=FL : c1=FR" +@end example + +Given the same source, you can also switch front left and front right channels +and keep the input channel layout: +@example +pan="5.1: c0=c1 : c1=c0 : c2=c2 : c3=c3 : c4=c4 : c5=c5" +@end example + +If the input is a stereo audio stream, you can mute the front left channel (and +still keep the stereo channel layout) with: +@example +pan="stereo:c1=c1" +@end example + +Still with a stereo audio stream input, you can copy the right channel in both +front left and right: +@example +pan="stereo: c0=FR : c1=FR" +@end example + +@section silencedetect + +Detect silence in an audio stream. + +This filter logs a message when it detects that the input audio volume is less +or equal to a noise tolerance value for a duration greater or equal to the +minimum detected noise duration. + +The printed times and duration are expressed in seconds. + +@table @option +@item duration, d +Set silence duration until notification (default is 2 seconds). + +@item noise, n +Set noise tolerance. Can be specified in dB (in case "dB" is appended to the +specified value) or amplitude ratio. Default is -60dB, or 0.001. +@end table + +Detect 5 seconds of silence with -50dB noise tolerance: +@example +silencedetect=n=-50dB:d=5 +@end example + +Complete example with @command{ffmpeg} to detect silence with 0.0001 noise +tolerance in @file{silence.mp3}: +@example +ffmpeg -f lavfi -i amovie=silence.mp3,silencedetect=noise=0.0001 -f null - +@end example + +@section volume + +Adjust the input audio volume. + +The filter accepts exactly one parameter @var{vol}, which expresses +how the audio volume will be increased or decreased. + +Output values are clipped to the maximum value. + +If @var{vol} is expressed as a decimal number, the output audio +volume is given by the relation: +@example +@var{output_volume} = @var{vol} * @var{input_volume} +@end example + +If @var{vol} is expressed as a decimal number followed by the string +"dB", the value represents the requested change in decibels of the +input audio power, and the output audio volume is given by the +relation: +@example +@var{output_volume} = 10^(@var{vol}/20) * @var{input_volume} +@end example + +Otherwise @var{vol} is considered an expression and its evaluated +value is used for computing the output audio volume according to the +first relation. + +Default value for @var{vol} is 1.0. + +@subsection Examples + +@itemize +@item +Half the input audio volume: +@example +volume=0.5 +@end example + +The above example is equivalent to: +@example +volume=1/2 +@end example + +@item +Decrease input audio power by 12 decibels: +@example +volume=-12dB +@end example +@end itemize + @c man end AUDIO FILTERS @chapter Audio Sources @@ -118,31 +509,212 @@ Pass the audio source unchanged to the output. Below is a description of the currently available audio sources. +@section abuffer + +Buffer audio frames, and make them available to the filter chain. + +This source is mainly intended for a programmatic use, in particular +through the interface defined in @file{libavfilter/asrc_abuffer.h}. + +It accepts the following mandatory parameters: +@var{sample_rate}:@var{sample_fmt}:@var{channel_layout}:@var{packing} + +@table @option + +@item sample_rate +The sample rate of the incoming audio buffers. + +@item sample_fmt +The sample format of the incoming audio buffers. +Either a sample format name or its corresponging integer representation from +the enum AVSampleFormat in @file{libavutil/samplefmt.h} + +@item channel_layout +The channel layout of the incoming audio buffers. +Either a channel layout name from channel_layout_map in +@file{libavutil/audioconvert.c} or its corresponding integer representation +from the AV_CH_LAYOUT_* macros in @file{libavutil/audioconvert.h} + +@item packing +Either "packed" or "planar", or their integer representation: 0 or 1 +respectively. + +@end table + +For example: +@example +abuffer=44100:s16:stereo:planar +@end example + +will instruct the source to accept planar 16bit signed stereo at 44100Hz. +Since the sample format with name "s16" corresponds to the number +1 and the "stereo" channel layout corresponds to the value 0x3, this is +equivalent to: +@example +abuffer=44100:1:0x3:1 +@end example + +@section aevalsrc + +Generate an audio signal specified by an expression. + +This source accepts in input one or more expressions (one for each +channel), which are evaluated and used to generate a corresponding +audio signal. + +It accepts the syntax: @var{exprs}[::@var{options}]. +@var{exprs} is a list of expressions separated by ":", one for each +separate channel. The output channel layout depends on the number of +provided expressions, up to 8 channels are supported. + +@var{options} is an optional sequence of @var{key}=@var{value} pairs, +separated by ":". + +The description of the accepted options follows. + +@table @option + +@item duration, d +Set the minimum duration of the sourced audio. See the function +@code{av_parse_time()} for the accepted format. +Note that the resulting duration may be greater than the specified +duration, as the generated audio is always cut at the end of a +complete frame. + +If not specified, or the expressed duration is negative, the audio is +supposed to be generated forever. + +@item nb_samples, n +Set the number of samples per channel per each output frame, +default to 1024. + +@item sample_rate, s +Specify the sample rate, default to 44100. +@end table + +Each expression in @var{exprs} can contain the following constants: + +@table @option +@item n +number of the evaluated sample, starting from 0 + +@item t +time of the evaluated sample expressed in seconds, starting from 0 + +@item s +sample rate + +@end table + +@subsection Examples + +@itemize + +@item +Generate silence: +@example +aevalsrc=0 +@end example + +@item + +Generate a sin signal with frequency of 440 Hz, set sample rate to +8000 Hz: +@example +aevalsrc="sin(440*2*PI*t)::s=8000" +@end example + +@item +Generate white noise: +@example +aevalsrc="-2+random(0)" +@end example + +@item +Generate an amplitude modulated signal: +@example +aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)" +@end example + +@item +Generate 2.5 Hz binaural beats on a 360 Hz carrier: +@example +aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) : 0.1*sin(2*PI*(360+2.5/2)*t)" +@end example + +@end itemize + +@section amovie + +Read an audio stream from a movie container. + +It accepts the syntax: @var{movie_name}[:@var{options}] where +@var{movie_name} is the name of the resource to read (not necessarily +a file but also a device or a stream accessed through some protocol), +and @var{options} is an optional sequence of @var{key}=@var{value} +pairs, separated by ":". + +The description of the accepted options follows. + +@table @option + +@item format_name, f +Specify the format assumed for the movie to read, and can be either +the name of a container or an input device. If not specified the +format is guessed from @var{movie_name} or by probing. + +@item seek_point, sp +Specify the seek point in seconds, the frames will be output +starting from this seek point, the parameter is evaluated with +@code{av_strtod} so the numerical value may be suffixed by an IS +postfix. Default value is "0". + +@item stream_index, si +Specify the index of the audio stream to read. If the value is -1, +the best suited audio stream will be automatically selected. Default +value is "-1". + +@end table + @section anullsrc -Null audio source, never return audio frames. It is mainly useful as a -template and to be employed in analysis / debugging tools. +Null audio source, return unprocessed audio frames. It is mainly useful +as a template and to be employed in analysis / debugging tools, or as +the source for filters which ignore the input data (for example the sox +synth filter). -It accepts as optional parameter a string of the form -@var{sample_rate}:@var{channel_layout}. +It accepts an optional sequence of @var{key}=@var{value} pairs, +separated by ":". -@var{sample_rate} specify the sample rate, and defaults to 44100. +The description of the accepted options follows. + +@table @option + +@item sample_rate, s +Specify the sample rate, and defaults to 44100. -@var{channel_layout} specify the channel layout, and can be either an -integer or a string representing a channel layout. The default value -of @var{channel_layout} is 3, which corresponds to CH_LAYOUT_STEREO. +@item channel_layout, cl + +Specify the channel layout, and can be either an integer or a string +representing a channel layout. The default value of @var{channel_layout} +is "stereo". Check the channel_layout_map definition in @file{libavcodec/audioconvert.c} for the mapping between strings and channel layout values. +@item nb_samples, n +Set the number of samples per requested frames. + +@end table + Follow some examples: @example -# set the sample rate to 48000 Hz and the channel layout to CH_LAYOUT_MONO. -anullsrc=48000:4 +# set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO. +anullsrc=r=48000:cl=4 # same as -anullsrc=48000:mono +anullsrc=r=48000:cl=mono @end example @c man end AUDIO SOURCES @@ -152,6 +724,17 @@ anullsrc=48000:mono Below is a description of the currently available audio sinks. +@section abuffersink + +Buffer audio frames, and make them available to the end of filter chain. + +This sink is mainly intended for programmatic use, in particular +through the interface defined in @file{libavfilter/buffersink.h}. + +It requires a pointer to an AVABufferSinkContext structure, which +defines the incoming buffers' formats, to be passed as the opaque +parameter to @code{avfilter_init_filter} for initialization. + @section anullsink Null audio sink, do absolutely nothing with the input audio. It is @@ -163,13 +746,105 @@ tools. @chapter Video Filters @c man begin VIDEO FILTERS -When you configure your Libav build, you can disable any of the -existing filters using --disable-filters. +When you configure your FFmpeg build, you can disable any of the +existing filters using @code{--disable-filters}. The configure output will show the video filters included in your build. Below is a description of the currently available video filters. +@section ass + +Draw ASS (Advanced Substation Alpha) subtitles on top of input video +using the libass library. + +To enable compilation of this filter you need to configure FFmpeg with +@code{--enable-libass}. + +This filter accepts the syntax: @var{ass_filename}[:@var{options}], +where @var{ass_filename} is the filename of the ASS file to read, and +@var{options} is an optional sequence of @var{key}=@var{value} pairs, +separated by ":". + +A description of the accepted options follows. + +@table @option +@item original_size +Specifies the size of the original video, the video for which the ASS file +was composed. Due to a misdesign in ASS aspect ratio arithmetic, this is +necessary to correctly scale the fonts if the aspect ratio has been changed. +@end table + +For example, to render the file @file{sub.ass} on top of the input +video, use the command: +@example +ass=sub.ass +@end example + +@section bbox + +Compute the bounding box for the non-black pixels in the input frame +luminance plane. + +This filter computes the bounding box containing all the pixels with a +luminance value greater than the minimum allowed value. +The parameters describing the bounding box are printed on the filter +log. + +@section blackdetect + +Detect video intervals that are (almost) completely black. Can be +useful to detect chapter transitions, commercials, or invalid +recordings. Output lines contains the time for the start, end and +duration of the detected black interval expressed in seconds. + +In order to display the output lines, you need to set the loglevel at +least to the AV_LOG_INFO value. + +This filter accepts a list of options in the form of +@var{key}=@var{value} pairs separated by ":". A description of the +accepted options follows. + +@table @option +@item black_min_duration, d +Set the minimum detected black duration expressed in seconds. It must +be a non-negative floating point number. + +Default value is 2.0. + +@item picture_black_ratio_th, pic_th +Set the threshold for considering a picture "black". +Express the minimum value for the ratio: +@example +@var{nb_black_pixels} / @var{nb_pixels} +@end example + +for which a picture is considered black. +Default value is 0.98. + +@item pixel_black_th, pix_th +Set the threshold for considering a pixel "black". + +The threshold expresses the maximum pixel luminance value for which a +pixel is considered "black". The provided value is scaled according to +the following equation: +@example +@var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size} +@end example + +@var{luminance_range_size} and @var{luminance_minimum_value} depend on +the input video format, the range is [0-255] for YUV full-range +formats and [16-235] for YUV non full-range formats. + +Default value is 0.10. +@end table + +The following example sets the maximum pixel threshold to the minimum +value, and detects only black intervals of 2 or more seconds: +@example +blackdetect=d=2:pix_th=0.00 +@end example + @section blackframe Detect frames that are (almost) completely black. Can be useful to @@ -196,7 +871,7 @@ considered black, and defaults to 32. Apply boxblur algorithm to the input video. This filter accepts the parameters: -@var{luma_power}:@var{luma_radius}:@var{chroma_radius}:@var{chroma_power}:@var{alpha_radius}:@var{alpha_power} +@var{luma_radius}:@var{luma_power}:@var{chroma_radius}:@var{chroma_power}:@var{alpha_radius}:@var{alpha_power} Chroma and alpha parameters are optional, if not specified they default to the corresponding values set for @var{luma_radius} and @@ -251,6 +926,18 @@ boxblur=min(h\,w)/10:1:min(cw\,ch)/10:1 @end itemize +@section colormatrix + +The colormatrix filter allows conversion between any of the following color +space: BT.709 (@var{bt709}), BT.601 (@var{bt601}), SMPTE-240M (@var{smpte240m}) +and FCC (@var{fcc}). + +The syntax of the parameters is @var{source}:@var{destination}: + +@example +colormatrix=bt601:smpte240m +@end example + @section copy Copy the input source unchanged to the output. Mainly useful for @@ -258,15 +945,16 @@ testing purposes. @section crop -Crop the input video to @var{out_w}:@var{out_h}:@var{x}:@var{y}. +Crop the input video to @var{out_w}:@var{out_h}:@var{x}:@var{y}:@var{keep_aspect} -The parameters are expressions containing the following constants: +The @var{keep_aspect} parameter is optional, if specified and set to a +non-zero value will force the output display aspect ratio to be the +same of the input, by changing the output sample aspect ratio. -@table @option -@item E, PI, PHI -the corresponding mathematical approximated values for e -(euler number), pi (greek PI), PHI (golden ratio) +The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are +expressions containing the following constants: +@table @option @item x, y the computed values for @var{x} and @var{y}. They are evaluated for each new frame. @@ -283,6 +971,19 @@ the output (cropped) width and height @item ow, oh same as @var{out_w} and @var{out_h} +@item a +same as @var{iw} / @var{ih} + +@item sar +input sample aspect ratio + +@item dar +input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar} + +@item hsub, vsub +horizontal and vertical chroma subsample values. For example for the +pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1. + @item n the number of input frame, starting from 0 @@ -441,6 +1142,76 @@ delogo=x=0:y=0:w=100:h=77:band=10 @end itemize +@section deshake + +Attempt to fix small changes in horizontal and/or vertical shift. This +filter helps remove camera shake from hand-holding a camera, bumping a +tripod, moving on a vehicle, etc. + +The filter accepts parameters as a string of the form +"@var{x}:@var{y}:@var{w}:@var{h}:@var{rx}:@var{ry}:@var{edge}:@var{blocksize}:@var{contrast}:@var{search}:@var{filename}" + +A description of the accepted parameters follows. + +@table @option + +@item x, y, w, h +Specify a rectangular area where to limit the search for motion +vectors. +If desired the search for motion vectors can be limited to a +rectangular area of the frame defined by its top left corner, width +and height. These parameters have the same meaning as the drawbox +filter which can be used to visualise the position of the bounding +box. + +This is useful when simultaneous movement of subjects within the frame +might be confused for camera motion by the motion vector search. + +If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1 +then the full frame is used. This allows later options to be set +without specifying the bounding box for the motion vector search. + +Default - search the whole frame. + +@item rx, ry +Specify the maximum extent of movement in x and y directions in the +range 0-64 pixels. Default 16. + +@item edge +Specify how to generate pixels to fill blanks at the edge of the +frame. An integer from 0 to 3 as follows: +@table @option +@item 0 +Fill zeroes at blank locations +@item 1 +Original image at blank locations +@item 2 +Extruded edge value at blank locations +@item 3 +Mirrored edge at blank locations +@end table + +The default setting is mirror edge at blank locations. + +@item blocksize +Specify the blocksize to use for motion search. Range 4-128 pixels, +default 8. + +@item contrast +Specify the contrast threshold for blocks. Only blocks with more than +the specified contrast (difference between darkest and lightest +pixels) will be considered. Range 1-255, default 125. + +@item search +Specify the search strategy 0 = exhaustive search, 1 = less exhaustive +search. Default - exhaustive search. + +@item filename +If set then a detailed log of the motion search is written to the +specified file. + +@end table + @section drawbox Draw a colored box on the input image. @@ -478,7 +1249,7 @@ drawbox=10:20:200:60:red@@0.5" Draw text string or text from specified file on top of video using the libfreetype library. -To enable compilation of this filter you need to configure Libav with +To enable compilation of this filter you need to configure FFmpeg with @code{--enable-libfreetype}. The filter also recognizes strftime() sequences in the provided text @@ -511,36 +1282,13 @@ parameter @var{text}. If both text and textfile are specified, an error is thrown. @item x, y -The offsets where text will be drawn within the video frame. -Relative to the top/left border of the output image. -They accept expressions similar to the @ref{overlay} filter: -@table @option - -@item x, y -the computed values for @var{x} and @var{y}. They are evaluated for -each new frame. +The expressions which specify the offsets where text will be drawn +within the video frame. They are relative to the top/left border of the +output image. -@item main_w, main_h -main input width and height +The default value of @var{x} and @var{y} is "0". -@item W, H -same as @var{main_w} and @var{main_h} - -@item text_w, text_h -rendered text width and height - -@item w, h -same as @var{text_w} and @var{text_h} - -@item n -the number of frames processed, starting from 0 - -@item t -timestamp expressed in seconds, NAN if the input timestamp is unknown - -@end table - -The default value of @var{x} and @var{y} is 0. +See below for the list of accepted constants. @item fontsize The font size to be used for drawing text. @@ -611,37 +1359,145 @@ Default value is 4. If true, check and fix text coords to avoid clipping. @end table -For example the command: +The parameters for @var{x} and @var{y} are expressions containing the +following constants: + +@table @option +@item W, H +the input width and height + +@item tw, text_w +the width of the rendered text + +@item th, text_h +the height of the rendered text + +@item lh, line_h +the height of each text line + +@item sar +input sample aspect ratio + +@item dar +input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar} + +@item hsub, vsub +horizontal and vertical chroma subsample values. For example for the +pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1. + +@item max_glyph_w +maximum glyph width, that is the maximum width for all the glyphs +contained in the rendered text + +@item max_glyph_h +maximum glyph height, that is the maximum height for all the glyphs +contained in the rendered text, it is equivalent to @var{ascent} - +@var{descent}. + +@item max_glyph_a, ascent + +the maximum distance from the baseline to the highest/upper grid +coordinate used to place a glyph outline point, for all the rendered +glyphs. +It is a positive value, due to the grid's orientation with the Y axis +upwards. + +@item max_glyph_d, descent +the maximum distance from the baseline to the lowest grid coordinate +used to place a glyph outline point, for all the rendered glyphs. +This is a negative value, due to the grid's orientation, with the Y axis +upwards. + +@item n +the number of input frame, starting from 0 + +@item t +timestamp expressed in seconds, NAN if the input timestamp is unknown + +@item timecode +initial timecode representation in "hh:mm:ss[:;.]ff" format. It can be used +with or without text parameter. @var{rate} option must be specified. + +@item r, rate +frame rate (timecode only) +@end table + +If libavfilter was built with @code{--enable-fontconfig}, then +@option{fontfile} can be a fontconfig pattern or omitted. + +Some examples follow. + +@itemize + +@item +Draw "Test Text" with font FreeSerif, using the default values for the +optional parameters. + @example drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'" @end example -will draw "Test Text" with font FreeSerif, using the default values -for the optional parameters. +@item +Draw 'Test Text' with font FreeSerif of size 24 at position x=100 +and y=50 (counting from the top-left corner of the screen), text is +yellow with a red box around it. Both the text and the box have an +opacity of 20%. -The command: @example drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\ x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2" @end example -will draw 'Test Text' with font FreeSerif of size 24 at position x=100 -and y=50 (counting from the top-left corner of the screen), text is -yellow with a red box around it. Both the text and the box have an -opacity of 20%. - Note that the double quotes are not necessary if spaces are not used within the parameter list. +@item +Show the text at the center of the video frame: +@example +drawtext=fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h-line_h)/2" +@end example + +@item +Show a text line sliding from right to left in the last row of the video +frame. The file @file{LONG_LINE} is assumed to contain a single line +with no newlines. +@example +drawtext=fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t +@end example + +@item +Show the content of file @file{CREDITS} off the bottom of the frame and scroll up. +@example +drawtext=fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t" +@end example + +@item +Draw a single green letter "g", at the center of the input video. +The glyph baseline is placed at half screen height. +@example +drawtext=fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent +@end example + +@item +Use fontconfig to set the font. Note that the colons need to be escaped. +@example +drawtext='fontfile=Linux Libertine O-40\\:style=Semibold:text=FFmpeg' +@end example + +@end itemize + For more information about libfreetype, check: @url{http://www.freetype.org/}. +For more information about fontconfig, check: +@url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}. + @section fade Apply fade-in/out effect to input video. It accepts the parameters: -@var{type}:@var{start_frame}:@var{nb_frames} +@var{type}:@var{start_frame}:@var{nb_frames}[:@var{options}] @var{type} specifies if the effect type, can be either "in" for fade-in, or "out" for a fade-out effect. @@ -654,6 +1510,25 @@ effect has to last. At the end of the fade-in effect the output video will have the same intensity as the input video, at the end of the fade-out transition the output video will be completely black. +@var{options} is an optional sequence of @var{key}=@var{value} pairs, +separated by ":". The description of the accepted options follows. + +@table @option + +@item type, t +See @var{type}. + +@item start_frame, s +See @var{start_frame}. + +@item nb_frames, n +See @var{nb_frames}. + +@item alpha +If set to 1, fade only alpha channel, if one exists on the input. +Default value is 0. +@end table + A few usage examples follow, usable too as test scenarios. @example # fade in first 30 frames of video @@ -667,6 +1542,9 @@ fade=in:0:25, fade=out:975:25 # make first 5 frames black, then fade in from frame 5-24 fade=in:5:20 + +# fade in alpha over first 25 frames of video +fade=in:0:25:alpha=1 @end example @section fieldorder @@ -699,7 +1577,7 @@ which is bottom field first. For example: @example -./avconv -i in.vob -vf "fieldorder=bff" out.dv +ffmpeg -i in.vob -vf "fieldorder=bff" out.dv @end example @section fifo @@ -735,7 +1613,7 @@ format=yuv420p:yuv444p:yuv410p Apply a frei0r effect to the input video. To enable compilation of this filter you need to install the frei0r -header and configure Libav with --enable-frei0r. +header and configure FFmpeg with @code{--enable-frei0r}. The filter supports the syntax: @example @@ -783,7 +1661,7 @@ For more information see: @section gradfun Fix the banding artifacts that are sometimes introduced into nearly flat -regions by truncation to 8bit colordepth. +regions by truncation to 8bit color depth. Interpolate the gradients that should go where the bands are, and dither them. @@ -817,9 +1695,9 @@ gradfun=1.2 Flip the input video horizontally. -For example to horizontally flip the input video with @command{avconv}: +For example to horizontally flip the input video with @command{ffmpeg}: @example -avconv -i in.avi -vf "hflip" out.avi +ffmpeg -i in.avi -vf "hflip" out.avi @end example @section hqdn3d @@ -849,6 +1727,11 @@ a float number which specifies chroma temporal strength, defaults to @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial} @end table +@section idet + +Interlaceing detect filter. This filter tries to detect if the input is +interlaced or progressive. Top or bottom field first. + @section lut, lutrgb, lutyuv Compute a look-up table for binding each pixel component input value @@ -864,10 +1747,14 @@ corresponding pixel component values. The @var{lut} filter requires either YUV or RGB pixel formats in input, and accepts the options: @table @option -@var{c0} (first pixel component) -@var{c1} (second pixel component) -@var{c2} (third pixel component) -@var{c3} (fourth pixel component, corresponds to the alpha component) +@item c0 +first pixel component +@item c1 +second pixel component +@item c2 +third pixel component +@item c3 +fourth pixel component, corresponds to the alpha component @end table The exact component associated to each option depends on the format in @@ -876,28 +1763,32 @@ input. The @var{lutrgb} filter requires RGB pixel formats in input, and accepts the options: @table @option -@var{r} (red component) -@var{g} (green component) -@var{b} (blue component) -@var{a} (alpha component) +@item r +red component +@item g +green component +@item b +blue component +@item a +alpha component @end table The @var{lutyuv} filter requires YUV pixel formats in input, and accepts the options: @table @option -@var{y} (Y/luminance component) -@var{u} (U/Cb component) -@var{v} (V/Cr component) -@var{a} (alpha component) +@item y +Y/luminance component +@item u +U/Cb component +@item v +V/Cr component +@item a +alpha component @end table The expressions can contain the following constants and functions: @table @option -@item E, PI, PHI -the corresponding mathematical approximated values for e -(euler number), pi (greek PI), PHI (golden ratio) - @item w, h the input width and height @@ -943,7 +1834,7 @@ lutrgb="r=negval:g=negval:b=negval" lutyuv="y=negval:u=negval:v=negval" # negate luminance -lutyuv=negval +lutyuv=y=negval # remove chroma components, turns the video into a graytone image lutyuv="u=128:v=128" @@ -961,6 +1852,90 @@ format=rgba,lutrgb=a="maxval-minval/2" lutyuv=y=gammaval(0.5) @end example +@section mp + +Apply an MPlayer filter to the input video. + +This filter provides a wrapper around most of the filters of +MPlayer/MEncoder. + +This wrapper is considered experimental. Some of the wrapped filters +may not work properly and we may drop support for them, as they will +be implemented natively into FFmpeg. Thus you should avoid +depending on them when writing portable scripts. + +The filters accepts the parameters: +@var{filter_name}[:=]@var{filter_params} + +@var{filter_name} is the name of a supported MPlayer filter, +@var{filter_params} is a string containing the parameters accepted by +the named filter. + +The list of the currently supported filters follows: +@table @var +@item decimate +@item denoise3d +@item detc +@item dint +@item divtc +@item down3dright +@item dsize +@item eq2 +@item eq +@item field +@item fil +@item fixpts +@item framestep +@item fspp +@item geq +@item harddup +@item hqdn3d +@item hue +@item il +@item ilpack +@item ivtc +@item kerndeint +@item mcdeint +@item noise +@item ow +@item palette +@item perspective +@item phase +@item pp7 +@item pullup +@item qp +@item rectangle +@item rotate +@item sab +@item screenshot +@item smartblur +@item softpulldown +@item softskip +@item spp +@item telecine +@item tile +@item tinterlace +@item unsharp +@item uspp +@item yuvcsp +@item yvu9 +@end table + +The parameter syntax and behavior for the listed filters are the same +of the corresponding MPlayer filters. For detailed instructions check +the "VIDEO FILTERS" section in the MPlayer manual. + +Some examples follow: +@example +# adjust gamma, brightness, contrast +mp=eq2=1.0:2:0.5 + +# tweak hue and saturation +mp=hue=100:-10 +@end example + +See also mplayer(1), @url{http://www.mplayerhq.hu/}. + @section negate Negate input video. @@ -968,6 +1943,8 @@ Negate input video. This filter accepts an integer in input, if non-zero it negates the alpha component (if available). The default value in input is 0. +@section noformat + Force libavfilter not to use any of the specified pixel formats for the input to the next filter. @@ -993,7 +1970,7 @@ Pass the video source unchanged to the output. Apply video transform using libopencv. To enable this filter install libopencv library and headers and -configure Libav with --enable-libopencv. +configure FFmpeg with @code{--enable-libopencv}. The filter takes the parameters: @var{filter_name}@{:=@}@var{filter_params}. @@ -1093,10 +2070,10 @@ Overlay one video on top of another. It takes two inputs and one output, the first input is the "main" video on which the second input is overlayed. -It accepts the parameters: @var{x}:@var{y}. +It accepts the parameters: @var{x}:@var{y}[:@var{options}]. @var{x} is the x coordinate of the overlayed video on the main video, -@var{y} is the y coordinate. The parameters are expressions containing +@var{y} is the y coordinate. @var{x} and @var{y} are expressions containing the following parameters: @table @option @@ -1113,6 +2090,17 @@ overlay input width and height same as @var{overlay_w} and @var{overlay_h} @end table +@var{options} is an optional list of @var{key}=@var{value} pairs, +separated by ":". + +The description of the accepted options follows. + +@table @option +@item rgb +If set to 1, force the filter to accept inputs in the RGB +color space. Default value is 0. +@end table + Be aware that frames are taken from each input video in timestamp order, hence, if their initial timestamps differ, it is a a good idea to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to @@ -1126,11 +2114,11 @@ Follow some examples: overlay=main_w-overlay_w-10:main_h-overlay_h-10 # insert a transparent PNG logo in the bottom left corner of the input -avconv -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output +ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output # insert 2 different transparent PNG logos (second logo on bottom # right corner): -avconv -i input -i logo1 -i logo2 -filter_complex +ffmpeg -i input -i logo1 -i logo2 -filter_complex 'overlay=10:H-h-10,overlay=W-w-10:H-h-10' output # add a transparent color layer on top of the main video, @@ -1153,10 +2141,6 @@ The parameters @var{width}, @var{height}, @var{x}, and @var{y} are expressions containing the following constants: @table @option -@item E, PI, PHI -the corresponding mathematical approximated values for e -(euler number), pi (greek PI), phi (golden ratio) - @item in_w, in_h the input video width and height @@ -1175,7 +2159,13 @@ x and y offsets as specified by the @var{x} and @var{y} expressions, or NAN if not yet specified @item a -input display aspect ratio, same as @var{iw} / @var{ih} +same as @var{iw} / @var{ih} + +@item sar +input sample aspect ratio + +@item dar +input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar} @item hsub, vsub horizontal and vertical chroma subsample values. For example for the @@ -1235,6 +2225,12 @@ pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2" # pad the input to get a final w/h ratio of 16:9 pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2" +# for anamorphic video, in order to set the output display aspect ratio, +# it is necessary to use sar in the expression, according to the relation: +# (ih * X / ih) * sar = output_dar +# X = output_dar / sar +pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2" + # double output size and put the input video in the bottom-right # corner of the output padded area pad="2*iw:2*ih:ow-iw:oh-ih" @@ -1252,18 +2248,43 @@ format=monow, pixdesctest can be used to test the monowhite pixel format descriptor definition. +@section removelogo + +Suppress a TV station logo, using an image file to determine which +pixels comprise the logo. It works by filling in the pixels that +comprise the logo with neighboring pixels. + +This filter requires one argument which specifies the filter bitmap +file, which can be any image format supported by libavformat. The +width and height of the image file must match those of the video +stream being processed. + +Pixels in the provided bitmap image with a value of zero are not +considered part of the logo, non-zero pixels are considered part of +the logo. If you use white (255) for the logo and black (0) for the +rest, you will be safe. For making the filter bitmap, it is +recommended to take a screen capture of a black frame with the logo +visible, and then using a threshold filter followed by the erode +filter once or twice. + +If needed, little splotches can be fixed manually. Remember that if +logo pixels are not covered, the filter quality will be much +reduced. Marking too many pixels as part of the logo does not hurt as +much, but it will increase the amount of blurring needed to cover over +the image and will destroy more information than necessary, and extra +pixels will slow things down on a large logo. + @section scale -Scale the input video to @var{width}:@var{height} and/or convert the image format. +Scale the input video to @var{width}:@var{height}[:@var{interl}=@{1|-1@}] and/or convert the image format. + +The scale filter forces the output display aspect ratio to be the same +of the input, by changing the output sample aspect ratio. The parameters @var{width} and @var{height} are expressions containing the following constants: @table @option -@item E, PI, PHI -the corresponding mathematical approximated values for e -(euler number), pi (greek PI), phi (golden ratio) - @item in_w, in_h the input width and height @@ -1276,12 +2297,15 @@ the output (cropped) width and height @item ow, oh same as @var{out_w} and @var{out_h} -@item dar, a -input display aspect ratio, same as @var{iw} / @var{ih} +@item a +same as @var{iw} / @var{ih} @item sar input sample aspect ratio +@item dar +input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar} + @item hsub, vsub horizontal and vertical chroma subsample values. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1. @@ -1300,6 +2324,19 @@ ratio of the input image. The default value of @var{width} and @var{height} is 0. +Valid values for the optional parameter @var{interl} are: + +@table @option +@item 1 +force interlaced aware scaling + +@item -1 +select interlaced aware scaling depending on whether the source frames +are flagged as interlaced or not +@end table + +Unless @var{interl} is set to one of the above options, interlaced scaling will not be used. + Some examples follow: @example # scale the input video to a size of 200x100. @@ -1310,6 +2347,9 @@ scale=2*iw:2*ih # the above is the same as scale=2*in_w:2*in_h +# scale the input to 2x with forced interlaced scaling +scale=2*iw:2*ih:interl=1 + # scale the input to half size scale=iw/2:ih/2 @@ -1340,15 +2380,6 @@ is selected and passed to the output, otherwise it is discarded. The expression can contain the following constants: @table @option -@item PI -Greek PI - -@item PHI -golden ratio - -@item E -Euler number - @item n the sequential number of the filtered frame, starting from 0 @@ -1446,35 +2477,79 @@ select='gte(t\,10)*lte(t\,20)*eq(pict_type\,I)' select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)' @end example -@anchor{setdar} -@section setdar +@section setdar, setsar -Set the Display Aspect Ratio for the filter output video. +The @code{setdar} filter sets the Display Aspect Ratio for the filter +output video. This is done by changing the specified Sample (aka Pixel) Aspect Ratio, according to the following equation: -@math{DAR = HORIZONTAL_RESOLUTION / VERTICAL_RESOLUTION * SAR} +@example +@var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR} +@end example + +Keep in mind that the @code{setdar} filter does not modify the pixel +dimensions of the video frame. Also the display aspect ratio set by +this filter may be changed by later filters in the filterchain, +e.g. in case of scaling or if another "setdar" or a "setsar" filter is +applied. + +The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for +the filter output video. -Keep in mind that this filter does not modify the pixel dimensions of -the video frame. Also the display aspect ratio set by this filter may -be changed by later filters in the filterchain, e.g. in case of -scaling or if another "setdar" or a "setsar" filter is applied. +Note that as a consequence of the application of this filter, the +output display aspect ratio will change according to the equation +above. + +Keep in mind that the sample aspect ratio set by the @code{setsar} +filter may be changed by later filters in the filterchain, e.g. if +another "setsar" or a "setdar" filter is applied. -The filter accepts a parameter string which represents the wanted -display aspect ratio. -The parameter can be a floating point number string, or an expression -of the form @var{num}:@var{den}, where @var{num} and @var{den} are the -numerator and denominator of the aspect ratio. -If the parameter is not specified, it is assumed the value "0:1". +The @code{setdar} and @code{setsar} filters accept a parameter string +which represents the wanted aspect ratio. The parameter can +be a floating point number string, an expression, or a string of the form +@var{num}:@var{den}, where @var{num} and @var{den} are the numerator +and denominator of the aspect ratio. If the parameter is not +specified, it is assumed the value "0:1". For example to change the display aspect ratio to 16:9, specify: @example setdar=16:9 -# the above is equivalent to +@end example + +The example above is equivalent to: +@example setdar=1.77777 @end example -See also the @ref{setsar} filter documentation. +To change the sample aspect ratio to 10:11, specify: +@example +setsar=10:11 +@end example + +@section setfield + +Force field for the output video frame. + +The @code{setfield} filter marks the interlace type field for the +output frames. It does not change the input frame, but only sets the +corresponding property, which affects how the frame is treated by +following filters (e.g. @code{fieldorder} or @code{yadif}). + +It accepts a string parameter, which can assume the following values: +@table @samp +@item auto +Keep the same field property. + +@item bff +Mark the frame as bottom-field-first. + +@item tff +Mark the frame as top-field-first. + +@item prog +Mark the frame as progressive. +@end table @section setpts @@ -1487,15 +2562,6 @@ can contain the following constants: @item PTS the presentation timestamp in input -@item PI -Greek PI - -@item PHI -golden ratio - -@item E -Euler number - @item N the count of the input frame, starting from 0. @@ -1536,39 +2602,13 @@ setpts=N/(25*TB) setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))' @end example -@anchor{setsar} -@section setsar - -Set the Sample (aka Pixel) Aspect Ratio for the filter output video. - -Note that as a consequence of the application of this filter, the -output display aspect ratio will change according to the following -equation: -@math{DAR = HORIZONTAL_RESOLUTION / VERTICAL_RESOLUTION * SAR} - -Keep in mind that the sample aspect ratio set by this filter may be -changed by later filters in the filterchain, e.g. if another "setsar" -or a "setdar" filter is applied. - -The filter accepts a parameter string which represents the wanted -sample aspect ratio. -The parameter can be a floating point number string, or an expression -of the form @var{num}:@var{den}, where @var{num} and @var{den} are the -numerator and denominator of the aspect ratio. -If the parameter is not specified, it is assumed the value "0:1". - -For example to change the sample aspect ratio to 10:11, specify: -@example -setsar=10:11 -@end example - @section settb Set the timebase to use for the output frames timestamps. It is mainly useful for testing timebase configuration. It accepts in input an arithmetic expression representing a rational. -The expression can contain the constants "PI", "E", "PHI", "AVTB" (the +The expression can contain the constants "AVTB" (the default timebase), and "intb" (the input timebase). The default value for the input is "intb". @@ -1644,11 +2684,11 @@ the @code{av_get_picture_type_char} function defined in @file{libavutil/avutil.h}. @item checksum -Adler-32 checksum of all the planes of the input frame +Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame @item plane_checksum -Adler-32 checksum of each plane of the input frame, expressed in the form -"[@var{c0} @var{c1} @var{c2} @var{c3}]" +Adler-32 checksum (printed in hexadecimal) of each plane of the input frame, +expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]" @end table @section slicify @@ -1657,7 +2697,7 @@ Pass the images of input video on to next video filter as multiple slices. @example -./avconv -i in.avi -vf "slicify=32" out.avi +ffmpeg -i in.avi -vf "slicify=32" out.avi @end example The filter accepts the slice height as parameter. If the parameter is @@ -1666,6 +2706,105 @@ not specified it will use the default value of 16. Adding this in the beginning of filter chains should make filtering faster due to better use of the memory cache. +@section split + +Pass on the input video to two outputs. Both outputs are identical to +the input video. + +For example: +@example +[in] split [splitout1][splitout2]; +[splitout1] crop=100:100:0:0 [cropout]; +[splitout2] pad=200:200:100:100 [padout]; +@end example + +will create two separate outputs from the same input, one cropped and +one padded. + +@section super2xsai + +Scale the input by 2x and smooth using the Super2xSaI (Scale and +Interpolate) pixel art scaling algorithm. + +Useful for enlarging pixel art images without reducing sharpness. + +@section swapuv +Swap U & V plane. + +@section thumbnail +Select the most representative frame in a given sequence of consecutive frames. + +It accepts as argument the frames batch size to analyze (default @var{N}=100); +in a set of @var{N} frames, the filter will pick one of them, and then handle +the next batch of @var{N} frames until the end. + +Since the filter keeps track of the whole frames sequence, a bigger @var{N} +value will result in a higher memory usage, so a high value is not recommended. + +The following example extract one picture each 50 frames: +@example +thumbnail=50 +@end example + +Complete example of a thumbnail creation with @command{ffmpeg}: +@example +ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png +@end example + +@section tile + +Tile several successive frames together. + +It accepts as argument the tile size (i.e. the number of lines and columns) +in the form "@var{w}x@var{h}". + +For example, produce 8×8 PNG tiles of all keyframes (@option{-skip_frame +nokey}) in a movie: +@example +ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png +@end example +The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from +duplicating each output frame to accomodate the originally detected frame +rate. + +@section tinterlace + +Perform various types of temporal field interlacing. + +Frames are counted starting from 1, so the first input frame is +considered odd. + +This filter accepts a single parameter specifying the mode. Available +modes are: + +@table @samp +@item 0 +Move odd frames into the upper field, even into the lower field, +generating a double height frame at half framerate. + +@item 1 +Only output even frames, odd frames are dropped, generating a frame with +unchanged height at half framerate. + +@item 2 +Only output odd frames, even frames are dropped, generating a frame with +unchanged height at half framerate. + +@item 3 +Expand each frame to full height, but pad alternate lines with black, +generating a frame with double height at the same input framerate. + +@item 4 +Interleave the upper field from odd frames with the lower field from +even frames, generating a frame with unchanged height at half framerate. + +@item 5 +Interleave the lower field from odd frames with the upper field from +even frames, generating a frame with unchanged height at half framerate. +@end table + +Default mode is 0. + @section transpose Transpose rows with columns in the input video and optionally flip it. @@ -1740,7 +2879,7 @@ and 13, default value is 5. Set the chroma matrix vertical size. It can be an integer between 3 and 13, default value is 5. -@item luma_amount +@item chroma_amount Set the chroma effect strength. It can be a float number between -2.0 and 5.0, default value is 0.0. @@ -1753,8 +2892,8 @@ unsharp=7:7:2.5 # Strong blur of both luma and chroma parameters unsharp=7:7:-2:7:7:-2 -# Use the default values with @command{avconv} -./avconv -i in.avi -vf "unsharp" out.mp4 +# Use the default values with @command{ffmpeg} +ffmpeg -i in.avi -vf "unsharp" out.mp4 @end example @section vflip @@ -1762,7 +2901,7 @@ unsharp=7:7:-2:7:7:-2 Flip the input video vertically. @example -./avconv -i in.avi -vf "vflip" out.avi +ffmpeg -i in.avi -vf "vflip" out.avi @end example @section yadif @@ -1831,9 +2970,10 @@ This source is mainly intended for a programmatic use, in particular through the interface defined in @file{libavfilter/vsrc_buffer.h}. It accepts the following parameters: -@var{width}:@var{height}:@var{pix_fmt_string}:@var{timebase_num}:@var{timebase_den}:@var{sample_aspect_ratio_num}:@var{sample_aspect_ratio.den} +@var{width}:@var{height}:@var{pix_fmt_string}:@var{timebase_num}:@var{timebase_den}:@var{sample_aspect_ratio_num}:@var{sample_aspect_ratio.den}:@var{scale_params} -All the parameters need to be explicitly defined. +All the parameters but @var{scale_params} need to be explicitly +defined. Follows the list of the accepted parameters. @@ -1854,6 +2994,11 @@ timestamps of the buffered frames. @item sample_aspect_ratio.num, sample_aspect_ratio.den Specify numerator and denominator of the sample aspect ratio assumed by the video frames. + +@item scale_params +Specify the optional parameters to be used for the scale filter which +is automatically inserted when an input change is detected in the +input size or format. @end table For example: @@ -1868,9 +3013,124 @@ Since the pixel format with name "yuv410p" corresponds to the number 6 (check the enum PixelFormat definition in @file{libavutil/pixfmt.h}), this example corresponds to: @example -buffer=320:240:6:1:24 +buffer=320:240:6:1:24:1:1 +@end example + +@section cellauto + +Create a pattern generated by an elementary cellular automaton. + +The initial state of the cellular automaton can be defined through the +@option{filename}, and @option{pattern} options. If such options are +not specified an initial state is created randomly. + +At each new frame a new row in the video is filled with the result of +the cellular automaton next generation. The behavior when the whole +frame is filled is defined by the @option{scroll} option. + +This source accepts a list of options in the form of +@var{key}=@var{value} pairs separated by ":". A description of the +accepted options follows. + +@table @option +@item filename, f +Read the initial cellular automaton state, i.e. the starting row, from +the specified file. +In the file, each non-whitespace character is considered an alive +cell, a newline will terminate the row, and further characters in the +file will be ignored. + +@item pattern, p +Read the initial cellular automaton state, i.e. the starting row, from +the specified string. + +Each non-whitespace character in the string is considered an alive +cell, a newline will terminate the row, and further characters in the +string will be ignored. + +@item rate, r +Set the video rate, that is the number of frames generated per second. +Default is 25. + +@item random_fill_ratio, ratio +Set the random fill ratio for the initial cellular automaton row. It +is a floating point number value ranging from 0 to 1, defaults to +1/PHI. + +This option is ignored when a file or a pattern is specified. + +@item random_seed, seed +Set the seed for filling randomly the initial row, must be an integer +included between 0 and UINT32_MAX. If not specified, or if explicitly +set to -1, the filter will try to use a good random seed on a best +effort basis. + +@item rule +Set the cellular automaton rule, it is a number ranging from 0 to 255. +Default value is 110. + +@item size, s +Set the size of the output video. + +If @option{filename} or @option{pattern} is specified, the size is set +by default to the width of the specified initial state row, and the +height is set to @var{width} * PHI. + +If @option{size} is set, it must contain the width of the specified +pattern string, and the specified pattern will be centered in the +larger row. + +If a filename or a pattern string is not specified, the size value +defaults to "320x518" (used for a randomly generated initial state). + +@item scroll +If set to 1, scroll the output upward when all the rows in the output +have been already filled. If set to 0, the new generated row will be +written over the top row just after the bottom row is filled. +Defaults to 1. + +@item start_full, full +If set to 1, completely fill the output with generated rows before +outputting the first frame. +This is the default behavior, for disabling set the value to 0. + +@item stitch +If set to 1, stitch the left and right row edges together. +This is the default behavior, for disabling set the value to 0. +@end table + +@subsection Examples + +@itemize +@item +Read the initial state from @file{pattern}, and specify an output of +size 200x400. +@example +cellauto=f=pattern:s=200x400 +@end example + +@item +Generate a random initial row with a width of 200 cells, with a fill +ratio of 2/3: +@example +cellauto=ratio=2/3:s=200x200 +@end example + +@item +Create a pattern generated by rule 18 starting by a single alive cell +centered on an initial row with width 100: +@example +cellauto=p=@@:s=100x400:full=0:rule=18 +@end example + +@item +Specify a more elaborated initial pattern: +@example +cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18 @end example +@end itemize + @section color Provide an uniformly colored input. @@ -1940,6 +3200,13 @@ Specifies the index of the video stream to read. If the value is -1, the best suited video stream will be automatically selected. Default value is "-1". +@item loop +Specifies how many times to read the video stream in sequence. +If the value is less than 1, the stream will be read again and again. +Default value is "1". + +Note that when the movie is looped the source timestamps are not +changed, so it will generate non monotonically increasing timestamps. @end table This filter allows to overlay a second video on top of main input of @@ -1965,28 +3232,69 @@ movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [movie]; @end example -@section nullsrc +@section mptestsrc + +Generate various test patterns, as generated by the MPlayer test filter. + +The size of the generated video is fixed, and is 256x256. +This source is useful in particular for testing encoding features. + +This source accepts an optional sequence of @var{key}=@var{value} pairs, +separated by ":". The description of the accepted options follows. + +@table @option + +@item rate, r +Specify the frame rate of the sourced video, as the number of frames +generated per second. It has to be a string in the format +@var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float +number or a valid video frame rate abbreviation. The default value is +"25". + +@item duration, d +Set the video duration of the sourced video. The accepted syntax is: +@example +[-]HH[:MM[:SS[.m...]]] +[-]S+[.m...] +@end example +See also the function @code{av_parse_time()}. + +If not specified, or the expressed duration is negative, the video is +supposed to be generated forever. + +@item test, t -Null video source, never return images. It is mainly useful as a -template and to be employed in analysis / debugging tools. +Set the number or the name of the test to perform. Supported tests are: +@table @option +@item dc_luma +@item dc_chroma +@item freq_luma +@item freq_chroma +@item amp_luma +@item amp_chroma +@item cbp +@item mv +@item ring1 +@item ring2 +@item all +@end table -It accepts as optional parameter a string of the form -@var{width}:@var{height}:@var{timebase}. +Default value is "all", which will cycle through the list of all tests. +@end table -@var{width} and @var{height} specify the size of the configured -source. The default values of @var{width} and @var{height} are -respectively 352 and 288 (corresponding to the CIF size format). +For example the following: +@example +testsrc=t=dc_luma +@end example -@var{timebase} specifies an arithmetic expression representing a -timebase. The expression can contain the constants "PI", "E", "PHI", -"AVTB" (the default timebase), and defaults to the value "AVTB". +will generate a "dc_luma" test pattern. @section frei0r_src Provide a frei0r source. To enable compilation of this filter you need to install the frei0r -header and configure Libav with --enable-frei0r. +header and configure FFmpeg with @code{--enable-frei0r}. The source supports the syntax: @example @@ -2003,12 +3311,143 @@ section @ref{frei0r} in the description of the video filters. Some examples follow: @example -# generate a frei0r partik0l source with size 200x200 and framerate 10 +# generate a frei0r partik0l source with size 200x200 and frame rate 10 # which is overlayed on the overlay filter main input frei0r_src=200x200:10:partik0l=1234 [overlay]; [in][overlay] overlay @end example -@section rgbtestsrc, testsrc +@section life + +Generate a life pattern. + +This source is based on a generalization of John Conway's life game. + +The sourced input represents a life grid, each pixel represents a cell +which can be in one of two possible states, alive or dead. Every cell +interacts with its eight neighbours, which are the cells that are +horizontally, vertically, or diagonally adjacent. + +At each interaction the grid evolves according to the adopted rule, +which specifies the number of neighbor alive cells which will make a +cell stay alive or born. The @option{rule} option allows to specify +the rule to adopt. + +This source accepts a list of options in the form of +@var{key}=@var{value} pairs separated by ":". A description of the +accepted options follows. + +@table @option +@item filename, f +Set the file from which to read the initial grid state. In the file, +each non-whitespace character is considered an alive cell, and newline +is used to delimit the end of each row. + +If this option is not specified, the initial grid is generated +randomly. + +@item rate, r +Set the video rate, that is the number of frames generated per second. +Default is 25. + +@item random_fill_ratio, ratio +Set the random fill ratio for the initial random grid. It is a +floating point number value ranging from 0 to 1, defaults to 1/PHI. +It is ignored when a file is specified. + +@item random_seed, seed +Set the seed for filling the initial random grid, must be an integer +included between 0 and UINT32_MAX. If not specified, or if explicitly +set to -1, the filter will try to use a good random seed on a best +effort basis. + +@item rule +Set the life rule. + +A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}", +where @var{NS} and @var{NB} are sequences of numbers in the range 0-8, +@var{NS} specifies the number of alive neighbor cells which make a +live cell stay alive, and @var{NB} the number of alive neighbor cells +which make a dead cell to become alive (i.e. to "born"). +"s" and "b" can be used in place of "S" and "B", respectively. + +Alternatively a rule can be specified by an 18-bits integer. The 9 +high order bits are used to encode the next cell state if it is alive +for each number of neighbor alive cells, the low order bits specify +the rule for "borning" new cells. Higher order bits encode for an +higher number of neighbor cells. +For example the number 6153 = @code{(12<<9)+9} specifies a stay alive +rule of 12 and a born rule of 9, which corresponds to "S23/B03". + +Default value is "S23/B3", which is the original Conway's game of life +rule, and will keep a cell alive if it has 2 or 3 neighbor alive +cells, and will born a new cell if there are three alive cells around +a dead cell. + +@item size, s +Set the size of the output video. + +If @option{filename} is specified, the size is set by default to the +same size of the input file. If @option{size} is set, it must contain +the size specified in the input file, and the initial grid defined in +that file is centered in the larger resulting area. + +If a filename is not specified, the size value defaults to "320x240" +(used for a randomly generated initial grid). + +@item stitch +If set to 1, stitch the left and right grid edges together, and the +top and bottom edges also. Defaults to 1. + +@item mold +Set cell mold speed. If set, a dead cell will go from @option{death_color} to +@option{mold_color} with a step of @option{mold}. @option{mold} can have a +value from 0 to 255. + +@item life_color +Set the color of living (or new born) cells. + +@item death_color +Set the color of dead cells. If @option{mold} is set, this is the first color +used to represent a dead cell. + +@item mold_color +Set mold color, for definitely dead and moldy cells. +@end table + +@subsection Examples + +@itemize +@item +Read a grid from @file{pattern}, and center it on a grid of size +300x300 pixels: +@example +life=f=pattern:s=300x300 +@end example + +@item +Generate a random grid of size 200x200, with a fill ratio of 2/3: +@example +life=ratio=2/3:s=200x200 +@end example + +@item +Specify a custom rule for evolving a randomly generated grid: +@example +life=rule=S14/B34 +@end example + +@item +Full example with slow death effect (mold) using @command{ffplay}: +@example +ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16 +@end example +@end itemize + +@section nullsrc, rgbtestsrc, testsrc + +The @code{nullsrc} source returns unprocessed video frames. It is +mainly useful to be employed in analysis / debugging tools, or as the +source for filters which ignore the input data. The @code{rgbtestsrc} source generates an RGB test pattern useful for detecting RGB vs BGR issues. You should see a red, green and blue @@ -2018,7 +3457,7 @@ The @code{testsrc} source generates a test video pattern, showing a color pattern, a scrolling gradient and a timestamp. This is mainly intended for testing purposes. -Both sources accept an optional sequence of @var{key}=@var{value} pairs, +These sources accept an optional sequence of @var{key}=@var{value} pairs, separated by ":". The description of the accepted options follows. @table @option @@ -2038,7 +3477,7 @@ number or a valid video frame rate abbreviation. The default value is @item sar Set the sample aspect ratio of the sourced video. -@item duration +@item duration, d Set the video duration of the sourced video. The accepted syntax is: @example [-]HH[:MM[:SS[.m...]]] @@ -2048,6 +3487,14 @@ See also the function @code{av_parse_time()}. If not specified, or the expressed duration is negative, the video is supposed to be generated forever. + +@item decimals, n +Set the number of decimals to show in the timestamp, only used in the +@code{testsrc} source. + +The displayed timestamp value will correspond to the original +timestamp value multiplied by the power of 10 of the specified +value. Default value is 0. @end table For example the following: @@ -2056,7 +3503,14 @@ testsrc=duration=5.3:size=qcif:rate=10 @end example will generate a video with a duration of 5.3 seconds, with size -176x144 and a framerate of 10 frames per second. +176x144 and a frame rate of 10 frames per second. + +If the input content is to be ignored, @code{nullsrc} can be used. The +following command generates noise in the luminance plane by employing +the @code{mp=geq} filter: +@example +nullsrc=s=256x256, mp=geq=random(1)*255:128:128 +@end example @c man end VIDEO SOURCES @@ -2065,6 +3519,19 @@ will generate a video with a duration of 5.3 seconds, with size Below is a description of the currently available video sinks. +@section buffersink + +Buffer video frames, and make them available to the end of the filter +graph. + +This sink is mainly intended for a programmatic use, in particular +through the interface defined in @file{libavfilter/buffersink.h}. + +It does not require a string parameter in input, but you need to +specify a pointer to a list of supported pixel formats terminated by +-1 in the opaque parameter provided to @code{avfilter_init_filter} +when initializing this sink. + @section nullsink Null video sink, do absolutely nothing with the input video. It is diff --git a/doc/general.texi b/doc/general.texi index 090e4c594b3..4ef1d6d80c7 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -11,10 +11,18 @@ @chapter External libraries -Libav can be hooked up with a number of external libraries to add support +FFmpeg can be hooked up with a number of external libraries to add support for more formats. None of them are used by default, their use has to be explicitly requested by passing the appropriate flags to @file{./configure}. +@section OpenJPEG + +FFmpeg can use the OpenJPEG libraries for encoding/decoding J2K videos. Go to +@url{http://www.openjpeg.org/} to get the libraries and follow the installation +instructions. To enable using OpenJPEG in FFmpeg, pass @code{--enable-libopenjpeg} to +@file{./configure}. + + @section OpenCORE and VisualOn libraries Spun off Google Android sources, OpenCore and VisualOn libraries provide @@ -24,13 +32,13 @@ encoders for a number of audio codecs. OpenCORE and VisualOn libraries are under the Apache License 2.0 (see @url{http://www.apache.org/licenses/LICENSE-2.0} for details), which is incompatible with the LGPL version 2.1 and GPL version 2. You have to -upgrade Libav's license to LGPL version 3 (or if you have enabled +upgrade FFmpeg's license to LGPL version 3 (or if you have enabled GPL components, GPL version 3) to use it. @end float @subsection OpenCORE AMR -Libav can make use of the OpenCORE libraries for AMR-NB +FFmpeg can make use of the OpenCORE libraries for AMR-NB decoding/encoding and AMR-WB decoding. Go to @url{http://sourceforge.net/projects/opencore-amr/} and follow the @@ -40,7 +48,7 @@ Then pass @code{--enable-libopencore-amrnb} and/or @subsection VisualOn AAC encoder library -Libav can make use of the VisualOn AACenc library for AAC encoding. +FFmpeg can make use of the VisualOn AACenc library for AAC encoding. Go to @url{http://sourceforge.net/projects/opencore-amr/} and follow the instructions for installing the library. @@ -48,7 +56,7 @@ Then pass @code{--enable-libvo-aacenc} to configure to enable it. @subsection VisualOn AMR-WB encoder library -Libav can make use of the VisualOn AMR-WBenc library for AMR-WB encoding. +FFmpeg can make use of the VisualOn AMR-WBenc library for AMR-WB encoding. Go to @url{http://sourceforge.net/projects/opencore-amr/} and follow the instructions for installing the library. @@ -56,7 +64,7 @@ Then pass @code{--enable-libvo-amrwbenc} to configure to enable it. @section LAME -Libav can make use of the LAME library for MP3 encoding. +FFmpeg can make use of the LAME library for MP3 encoding. Go to @url{http://lame.sourceforge.net/} and follow the instructions for installing the library. @@ -64,7 +72,7 @@ Then pass @code{--enable-libmp3lame} to configure to enable it. @section libvpx -Libav can make use of the libvpx library for VP8 encoding. +FFmpeg can make use of the libvpx library for VP8 encoding. Go to @url{http://www.webmproject.org/} and follow the instructions for installing the library. Then pass @code{--enable-libvpx} to configure to @@ -72,7 +80,7 @@ enable it. @section x264 -Libav can make use of the x264 library for H.264 encoding. +FFmpeg can make use of the x264 library for H.264 encoding. Go to @url{http://www.videolan.org/developers/x264.html} and follow the instructions for installing the library. Then pass @code{--enable-libx264} to @@ -81,18 +89,18 @@ configure to enable it. @float NOTE x264 is under the GNU Public License Version 2 or later (see @url{http://www.gnu.org/licenses/old-licenses/gpl-2.0.html} for -details), you must upgrade Libav's license to GPL in order to use it. +details), you must upgrade FFmpeg's license to GPL in order to use it. @end float -@chapter Supported File Formats and Codecs +@chapter Supported File Formats, Codecs or Features You can use the @code{-formats} and @code{-codecs} options to have an exhaustive list. @section File Formats -Libav supports the following file formats through the @code{libavformat} +FFmpeg supports the following file formats through the @code{libavformat} library: @multitable @columnfractions .4 .1 .1 .4 @@ -100,12 +108,15 @@ library: @item 4xm @tab @tab X @tab 4X Technologies format, used in some games. @item 8088flex TMV @tab @tab X +@item ACT Voice @tab @tab X + @tab contains G.729 audio @item Adobe Filmstrip @tab X @tab X @item Audio IFF (AIFF) @tab X @tab X @item American Laser Games MM @tab @tab X @tab Multimedia format used in games like Mad Dog McCree. @item 3GPP AMR @tab X @tab X @item Apple HTTP Live Streaming @tab @tab X +@item Artworx Data Format @tab @tab X @item ASF @tab X @tab X @item AVI @tab X @tab X @item AVISynth @tab @tab X @@ -115,6 +126,7 @@ library: @tab Audio and video format used in some games by Beam Software. @item Bethesda Softworks VID @tab @tab X @tab Used in some games from Bethesda Softworks. +@item Binary text @tab @tab X @item Bink @tab @tab X @tab Multimedia format used by many games. @item Bitmap Brothers JV @tab @tab X @@ -133,7 +145,7 @@ library: @tab Video format used by CD+G karaoke disks @item Commodore CDXL @tab @tab X @tab Amiga CD video format -@item Core Audio Format @tab @tab X +@item Core Audio Format @tab X @tab X @tab Apple Core Audio Format @item CRC testing format @tab X @tab @item Creative Voice @tab X @tab X @@ -151,7 +163,7 @@ library: @item Electronic Arts cdata @tab @tab X @item Electronic Arts Multimedia @tab @tab X @tab Used in various EA games; files have extensions like WVE and UV2. -@item FFM (AVserver live feed) @tab X @tab X +@item FFM (FFserver live feed) @tab X @tab X @item Flash (SWF) @tab X @tab X @item Flash 9 (AVM2) @tab X @tab X @tab Only embedded audio is decoded. @@ -162,13 +174,19 @@ library: @item framecrc testing format @tab X @tab @item FunCom ISS @tab @tab X @tab Audio format used in various games from FunCom like The Longest Journey. +@item G.723.1 @tab X @tab X +@item G.729 BIT @tab X @tab X +@item G.729 raw @tab @tab X @item GIF Animation @tab X @tab @item GXF @tab X @tab X @tab General eXchange Format SMPTE 360M, used by Thomson Grass Valley playout servers. +@item iCEDraw File @tab @tab X +@item ICO @tab @tab X + @tab Microsoft Windows ICO @item id Quake II CIN video @tab @tab X @item id RoQ @tab X @tab X - @tab Used in Quake III, Jedi Knight 2, other computer games. + @tab Used in Quake III, Jedi Knight 2 and other computer games. @item IEC61937 encapsulation @tab X @tab X @item IFF @tab @tab X @tab Interchange File Format @@ -181,6 +199,8 @@ library: @item LATM @tab X @tab X @item LMLM4 @tab @tab X @tab Used by Linux Media Labs MPEG-4 PCI boards +@item LOAS @tab @tab X + @tab contains LATM multiplexed AAC audio @item LXF @tab @tab X @tab VR native stream format, used by Leitch/Harris' video servers. @item Matroska @tab X @tab X @@ -190,6 +210,7 @@ library: @item MAXIS XA @tab @tab X @tab Used in Sim City 3000; file extension .xa. @item MD Studio @tab @tab X +@item Metal Gear Solid: The Twin Snakes @tab @tab X @item Mobotix .mxg @tab @tab X @item Monkey's Audio @tab @tab X @item Motion Pixels MVI @tab @tab X @@ -289,6 +310,7 @@ library: @item RTP @tab X @tab X @item RTSP @tab X @tab X @item SAP @tab X @tab X +@item SBG @tab @tab X @item SDP @tab @tab X @item Sega FILM/CPK @tab @tab X @tab Used in many Sega Saturn console games. @@ -316,7 +338,7 @@ library: @item WAV @tab X @tab X @item WavPack @tab @tab X @item WebM @tab X @tab X -@item Windows Televison (WTV) @tab @tab X +@item Windows Televison (WTV) @tab X @tab X @item Wing Commander III movie @tab @tab X @tab Multimedia format used in Origin's Wing Commander III computer game. @item Westwood Studios audio @tab @tab X @@ -327,6 +349,7 @@ library: @tab Microsoft video container used in Xbox games. @item xWMA @tab @tab X @tab Microsoft audio container used by XAudio 2. +@item eXtended BINary text (XBIN) @tab @tab X @item YUV4MPEG pipe @tab X @tab X @item Psygnosis YOP @tab @tab X @item ZeroCodec Lossless Video @tab @tab X @@ -336,7 +359,7 @@ library: @section Image Formats -Libav can read and write images for each frame of a video sequence. The +FFmpeg can read and write images for each frame of a video sequence. The following image formats are supported: @multitable @columnfractions .4 .1 .1 .4 @@ -349,10 +372,11 @@ following image formats are supported: @tab Microsoft BMP image @item DPX @tab X @tab X @tab Digital Picture Exchange +@item EXR @tab @tab X + @tab OpenEXR @item JPEG @tab X @tab X @tab Progressive JPEG is not supported. -@item JPEG 2000 @tab @tab E - @tab decoding supported through external library libopenjpeg +@item JPEG 2000 @tab X @tab X @item JPEG-LS @tab X @tab X @item LJPEG @tab X @tab @tab Lossless JPEG @@ -369,7 +393,6 @@ following image formats are supported: @item PIC @tab @tab X @tab Pictor/PC Paint @item PNG @tab X @tab X - @tab 2/4 bpp not supported yet @item PPM @tab X @tab X @tab Portable PixelMap image @item PTX @tab @tab X @@ -382,7 +405,7 @@ following image formats are supported: @tab YUV, JPEG and some extension is not supported yet. @item Truevision Targa @tab X @tab X @tab Targa (.TGA) image format -@item XBM @tab X @tab +@item XBM @tab X @tab X @tab X BitMap image format @item XWD @tab X @tab X @tab X Window Dump image format @@ -405,7 +428,7 @@ following image formats are supported: @tab Creates video suitable to be played on a commodore 64 (multicolor mode). @item American Laser Games MM @tab @tab X @tab Used in games like Mad Dog McCree. -@item AMV Video @tab @tab X +@item AMV Video @tab X @tab X @tab Used in Chinese MP3 players. @item ANSI/ASCII art @tab @tab X @item Apple MJPEG-B @tab @tab X @@ -425,13 +448,18 @@ following image formats are supported: @item Autodesk Animator Flic video @tab @tab X @item Autodesk RLE @tab @tab X @tab fourcc: AASC +@item Avid 1:1 10-bit RGB Packer @tab X @tab X + @tab fourcc: AVrp @item AVS (Audio Video Standard) video @tab @tab X @tab Video encoding used by the Creature Shock game. +@item AYUV @tab X @tab X + @tab Microsoft uncompressed packed 4:4:4:4 @item Beam Software VB @tab @tab X @item Bethesda VID video @tab @tab X @tab Used in some games from Bethesda Softworks. @item Bink Video @tab @tab X @item Bitmap Brothers JV video @tab @tab X +@item y41p Brooktree uncompressed 4:1:1 12-bit @tab X @tab X @item Brute Force & Ignorance @tab @tab X @tab Used in the game Flash Traffic: City of Angels. @item C93 video @tab @tab X @@ -453,7 +481,7 @@ following image formats are supported: @item Creative YUV (CYUV) @tab @tab X @item DFA @tab @tab X @tab Codec used in Chronomaster game. -@item Dirac @tab E @tab E +@item Dirac @tab E @tab X @tab supported through external library libschroedinger @item Deluxe Paint Animation @tab @tab X @item DNxHD @tab X @tab X @@ -473,11 +501,12 @@ following image formats are supported: @item Electronic Arts TGQ video @tab @tab X @item Electronic Arts TQI video @tab @tab X @item Escape 124 @tab @tab X +@item Escape 130 @tab @tab X @item FFmpeg video codec #1 @tab X @tab X - @tab experimental lossless codec (fourcc: FFV1) + @tab lossless codec (fourcc: FFV1) @item Flash Screen Video v1 @tab X @tab X @tab fourcc: FSV1 -@item Flash Screen Video v2 @tab @tab X +@item Flash Screen Video v2 @tab X @tab X @item Flash Video (FLV) @tab X @tab X @tab Sorenson H.263 used in Flash @item Forward Uncompressed @tab @tab X @@ -509,6 +538,7 @@ following image formats are supported: @tab Used in the game Cyberia from Interplay. @item Interplay MVE video @tab @tab X @tab Used in Interplay .MVE files. +@item J2K @tab X @tab X @item Karl Morton's video codec @tab @tab X @tab Codec used in Worms games. @item Kega Game Video (KGV1) @tab @tab X @@ -549,6 +579,8 @@ following image formats are supported: @tab fourcc: VP80, encoding supported through external library libvpx @item planar RGB @tab @tab X @tab fourcc: 8BPS +@item Prores @tab @tab X + @tab fourcc: apch,apcn,apcs,apco @item Q-team QPEG @tab @tab X @tab fourccs: QPEG, Q1.0, Q1.1 @item QuickTime 8BPS video @tab @tab X @@ -558,8 +590,8 @@ following image formats are supported: @tab fourcc: 'smc ' @item QuickTime video (RPZA) @tab @tab X @tab fourcc: rpza -@item R10K AJA Kona 10-bit RGB Codec @tab @tab X -@item R210 Quicktime Uncompressed RGB 10-bit @tab @tab X +@item R10K AJA Kona 10-bit RGB Codec @tab X @tab X +@item R210 Quicktime Uncompressed RGB 10-bit @tab X @tab X @item Raw Video @tab X @tab X @item RealVideo 1.0 @tab X @tab X @item RealVideo 2.0 @tab X @tab X @@ -592,6 +624,8 @@ following image formats are supported: @tab Codec used in DOS CD-ROM FlashBack game. @item Ut Video @tab @tab X @item v210 QuickTime uncompressed 4:2:2 10-bit @tab X @tab X +@item v308 QuickTime uncompressed 4:4:4 @tab X @tab X +@item v408 QuickTime uncompressed 4:4:4:4 @tab X @tab X @item v410 QuickTime uncompressed 4:4:4 10-bit @tab X @tab X @item VBLE Lossless Codec @tab @tab X @item VMware Screen Codec / VMware Video @tab @tab X @@ -610,6 +644,8 @@ following image formats are supported: @item WMV7 @tab X @tab X @item YAMAHA SMAF @tab X @tab X @item Psygnosis YOP Video @tab @tab X +@item yuv4 @tab X @tab X + @tab libquicktime uncompressed packed 4:2:0 @item ZLIB @tab X @tab X @tab part of LCL, encoder experimental @item Zip Motion Blocks Video @tab X @tab X @@ -625,6 +661,8 @@ following image formats are supported: @multitable @columnfractions .4 .1 .1 .4 @item Name @tab Encoding @tab Decoding @tab Comments @item 8SVX audio @tab @tab X +@item AAC+ @tab E @tab X + @tab encoding supported through external library libaacplus @item AAC @tab E @tab X @tab encoding supported through external library libfaac and libvo-aacenc @item AC-3 @tab IX @tab X @@ -682,14 +720,16 @@ following image formats are supported: @item Atrac 3 @tab @tab X @item Bink Audio @tab @tab X @tab Used in Bink and Smacker files in many games. +@item CELT @tab @tab E + @tab decoding supported through external library libcelt @item Delphine Software International CIN audio @tab @tab X @tab Codec used in Delphine Software International games. @item Discworld II BMV Audio @tab @tab X @item COOK @tab @tab X @tab All versions except 5.1 are supported. -@item DCA (DTS Coherent Acoustics) @tab @tab X +@item DCA (DTS Coherent Acoustics) @tab X @tab X @item DPCM id RoQ @tab X @tab X - @tab Used in Quake III, Jedi Knight 2, other computer games. + @tab Used in Quake III, Jedi Knight 2 and other computer games. @item DPCM Interplay @tab @tab X @tab Used in various Interplay computer games. @item DPCM Sierra Online @tab @tab X @@ -701,6 +741,8 @@ following image formats are supported: @item DV audio @tab @tab X @item Enhanced AC-3 @tab X @tab X @item FLAC (Free Lossless Audio Codec) @tab X @tab IX +@item G.723.1 @tab X @tab X +@item G.729 @tab @tab X @item GSM @tab E @tab X @tab encoding supported through external library libgsm @item GSM Microsoft variant @tab E @tab X @@ -760,6 +802,10 @@ following image formats are supported: @tab Used in Sierra VMD files. @item Smacker audio @tab @tab X @item SMPTE 302M AES3 audio @tab @tab X +@item Sonic @tab X @tab X + @tab experimental codec +@item Sonic lossless @tab X @tab X + @tab experimental codec @item Speex @tab E @tab E @tab supported through external library libspeex @item True Audio (TTA) @tab @tab X @@ -791,8 +837,9 @@ performance on systems without hardware floating point support). @item SSA/ASS @tab X @tab X @tab X @tab X @item DVB @tab X @tab X @tab X @tab X @item DVD @tab X @tab X @tab X @tab X +@item MicroDVD @tab X @tab X @tab @tab @item PGS @tab @tab @tab @tab X -@item SubRip (SRT) @tab X @tab X @tab @tab X +@item SubRip (SRT) @tab X @tab X @tab X @tab X @item XSUB @tab @tab @tab X @tab X @end multitable @@ -836,4 +883,15 @@ performance on systems without hardware floating point support). @code{X} means that input/output is supported. +@section Timecode + +@multitable @columnfractions .4 .1 .1 +@item Codec/format @tab Read @tab Write +@item DV @tab X @tab X +@item GXF @tab X @tab X +@item MOV @tab X @tab +@item MPEG1/2 @tab X @tab X +@item MXF @tab X @tab X +@end multitable + @bye diff --git a/doc/git-howto.texi b/doc/git-howto.texi index 4d3e2354fc5..44514537ecb 100644 --- a/doc/git-howto.texi +++ b/doc/git-howto.texi @@ -1,9 +1,9 @@ \input texinfo @c -*- texinfo -*- -@settitle Using git to develop Libav +@settitle Using git to develop FFmpeg @titlepage -@center @titlefont{Using git to develop Libav} +@center @titlefont{Using git to develop FFmpeg} @end titlepage @top @@ -39,7 +39,7 @@ For more information about the Git project, visit the Consult these resources whenever you have problems, they are quite exhaustive. -What follows now is a basic introduction to Git and some Libav-specific +What follows now is a basic introduction to Git and some FFmpeg-specific guidelines to ease the contribution to the project @chapter Basics Usage @@ -53,16 +53,16 @@ Most distribution and operating system provide a package for it. @section Cloning the source tree @example -git clone git://git.libav.org/libav.git +git clone git://source.ffmpeg.org/ffmpeg @end example -This will put the Libav sources into the directory @var{}. +This will put the FFmpeg sources into the directory @var{}. @example -git clone git@@git.libav.org:libav.git +git clone git@@source.ffmpeg.org:ffmpeg @end example -This will put the Libav sources into the directory @var{} and let +This will put the FFmpeg sources into the directory @var{} and let you push back your changes to the remote repository. Make sure that you do not have Windows line endings in your checkouts, @@ -85,7 +85,7 @@ can be remote. By default the master branch tracks the branch master in the remote origin. @float IMPORTANT -Since merge commits are forbidden @command{--rebase} (see below) is recommended. +@command{--rebase} (see below) is recommended. @end float @section Rebasing your local branches @@ -96,7 +96,7 @@ git pull --rebase fetches the changes from the main repository and replays your local commits over it. This is required to keep all your local changes at the top of -Libav's master tree. The master tree will reject pushes with merge commits. +FFmpeg's master tree. The master tree will reject pushes with merge commits. @section Adding/removing files/directories @@ -127,7 +127,7 @@ git log @end example You may also use the graphical tools like gitview or gitk or the web -interface available at http://git.libav.org/ +interface available at http://source.ffmpeg.org/ @section Checking source tree status @@ -258,7 +258,7 @@ git commit @end example -@chapter Libav specific +@chapter FFmpeg specific @section Reverting broken commits @@ -348,5 +348,5 @@ where @var{$SHA1} is the commit hash from the @command{git log} output. @chapter Server Issues -Contact the project admins @email{git@@libav.org} if you have technical +Contact the project admins @email{root@@ffmpeg.org} if you have technical problems with the GIT server. diff --git a/doc/git-howto.txt b/doc/git-howto.txt index 036b567084d..5ba72eeeb9e 100644 --- a/doc/git-howto.txt +++ b/doc/git-howto.txt @@ -28,9 +28,9 @@ Consult these resources whenever you have problems, they are quite exhaustive. You do not need a special username or password. All you need is to provide a ssh public key to the Git server admin. -What follows now is a basic introduction to Git and some Libav-specific +What follows now is a basic introduction to Git and some FFmpeg-specific guidelines. Read it at least once, if you are granted commit privileges to the -Libav project you are expected to be familiar with these rules. +FFmpeg project you are expected to be familiar with these rules. @@ -39,18 +39,19 @@ I. BASICS: 0. Get GIT: + Most distributions have a git package, if not You can get git from http://git-scm.com/ 1. Cloning the source tree: - git clone git://git.libav.org/libav.git + git clone git://source.ffmpeg.org/ffmpeg - This will put the Libav sources into the directory . + This will put the FFmpeg sources into the directory . - git clone git@git.libav.org:libav.git + git clone git@source.ffmpeg.org:ffmpeg - This will put the Libav sources into the directory and let + This will put the FFmpeg sources into the directory and let you push back your changes to the remote repository. @@ -72,7 +73,7 @@ I. BASICS: fetches the changes from the main repository and replays your local commits over it. This is required to keep all your local changes at the top of - Libav's master tree. The master tree will reject pushes with merge commits. + FFmpeg's master tree. The master tree will reject pushes with merge commits. 3. Adding/removing files/directories: @@ -97,7 +98,7 @@ I. BASICS: git log You may also use the graphical tools like gitview or gitk or the web - interface available at http://git.libav.org/ + interface available at http://source.ffmpeg.org 6. Checking source tree status: @@ -268,5 +269,5 @@ I. BASICS: where $SHA1 is the commit SHA1 from the 'git log' output. -Contact the project admins if you have technical +Contact the project admins if you have technical problems with the GIT server. diff --git a/doc/indevs.texi b/doc/indevs.texi index b0ba6ac9f36..e699e11f42a 100644 --- a/doc/indevs.texi +++ b/doc/indevs.texi @@ -1,10 +1,10 @@ @chapter Input Devices @c man begin INPUT DEVICES -Input devices are configured elements in Libav which allow to access +Input devices are configured elements in FFmpeg which allow to access the data coming from a multimedia device attached to your system. -When you configure your Libav build, all the supported input devices +When you configure your FFmpeg build, all the supported input devices are enabled by default. You can list all available ones using the configure option "--list-indevs". @@ -42,10 +42,10 @@ specify card number or identifier, device number and subdevice number To see the list of cards currently recognized by your system check the files @file{/proc/asound/cards} and @file{/proc/asound/devices}. -For example to capture with @command{avconv} from an ALSA device with +For example to capture with @command{ffmpeg} from an ALSA device with card id 0, you may run the command: @example -avconv -f alsa -i hw:0 alsaout.wav +ffmpeg -f alsa -i hw:0 alsaout.wav @end example For more information see: @@ -55,6 +55,101 @@ For more information see: BSD video input device. +@section dshow + +Windows DirectShow input device. + +DirectShow support is enabled when FFmpeg is built with the mingw-w64 project. +Currently only audio and video devices are supported. + +Multiple devices may be opened as separate inputs, but they may also be +opened on the same input, which should improve synchronism between them. + +The input name should be in the format: + +@example +@var{TYPE}=@var{NAME}[:@var{TYPE}=@var{NAME}] +@end example + +where @var{TYPE} can be either @var{audio} or @var{video}, +and @var{NAME} is the device's name. + +@subsection Options + +If no options are specified, the device's defaults are used. +If the device does not support the requested options, it will +fail to open. + +@table @option + +@item video_size +Set the video size in the captured video. + +@item framerate +Set the framerate in the captured video. + +@item sample_rate +Set the sample rate (in Hz) of the captured audio. + +@item sample_size +Set the sample size (in bits) of the captured audio. + +@item channels +Set the number of channels in the captured audio. + +@item list_devices +If set to @option{true}, print a list of devices and exit. + +@item list_options +If set to @option{true}, print a list of selected device's options +and exit. + +@item video_device_number +Set video device number for devices with same name (starts at 0, +defaults to 0). + +@item audio_device_number +Set audio device number for devices with same name (starts at 0, +defaults to 0). + +@end table + +@subsection Examples + +@itemize + +@item +Print the list of DirectShow supported devices and exit: +@example +$ ffmpeg -list_devices true -f dshow -i dummy +@end example + +@item +Open video device @var{Camera}: +@example +$ ffmpeg -f dshow -i video="Camera" +@end example + +@item +Open second video device with name @var{Camera}: +@example +$ ffmpeg -f dshow -video_device_number 1 -i video="Camera" +@end example + +@item +Open video device @var{Camera} and audio device @var{Microphone}: +@example +$ ffmpeg -f dshow -i video="Camera":audio="Microphone" +@end example + +@item +Print the list of supported options in selected device and exit: +@example +$ ffmpeg -list_options true -f dshow -i video="Camera" +@end example + +@end itemize + @section dv1394 Linux DV 1394 input device. @@ -72,14 +167,14 @@ For more detailed information read the file Documentation/fb/framebuffer.txt included in the Linux source tree. To record from the framebuffer device @file{/dev/fb0} with -@command{avconv}: +@command{ffmpeg}: @example -avconv -f fbdev -r 10 -i /dev/fb0 out.avi +ffmpeg -f fbdev -r 10 -i /dev/fb0 out.avi @end example You can take a single screenshot image with the command: @example -avconv -f fbdev -frames:v 1 -r 1 -i /dev/fb0 screenshot.jpeg +ffmpeg -f fbdev -frames:v 1 -r 1 -i /dev/fb0 screenshot.jpeg @end example See also @url{http://linux-fbdev.sourceforge.net/}, and fbset(1). @@ -95,24 +190,24 @@ A JACK input device creates one or more JACK writable clients, one for each audio channel, with name @var{client_name}:input_@var{N}, where @var{client_name} is the name provided by the application, and @var{N} is a number which identifies the channel. -Each writable client will send the acquired data to the Libav input +Each writable client will send the acquired data to the FFmpeg input device. Once you have created one or more JACK readable clients, you need to connect them to one or more JACK writable clients. -To connect or disconnect JACK clients you can use the -@file{jack_connect} and @file{jack_disconnect} programs, or do it -through a graphical interface, for example with @file{qjackctl}. +To connect or disconnect JACK clients you can use the @command{jack_connect} +and @command{jack_disconnect} programs, or do it through a graphical interface, +for example with @command{qjackctl}. To list the JACK clients and their properties you can invoke the command -@file{jack_lsp}. +@command{jack_lsp}. Follows an example which shows how to capture a JACK readable client -with @command{avconv}. +with @command{ffmpeg}. @example -# Create a JACK writable client with name "libav". -$ avconv -f jack -i libav -y out.wav +# Create a JACK writable client with name "ffmpeg". +$ ffmpeg -f jack -i ffmpeg -y out.wav # Start the sample jack_metro readable client. $ jack_metro -b 120 -d 0.2 -f 4000 @@ -123,20 +218,175 @@ system:capture_1 system:capture_2 system:playback_1 system:playback_2 -libav:input_1 +ffmpeg:input_1 metro:120_bpm -# Connect metro to the avconv writable client. -$ jack_connect metro:120_bpm libav:input_1 +# Connect metro to the ffmpeg writable client. +$ jack_connect metro:120_bpm ffmpeg:input_1 @end example For more information read: @url{http://jackaudio.org/} +@section lavfi + +Libavfilter input virtual device. + +This input device reads data from the open output pads of a libavfilter +filtergraph. + +For each filtergraph open output, the input device will create a +corresponding stream which is mapped to the generated output. Currently +only video data is supported. The filtergraph is specified through the +option @option{graph}. + +@subsection Options + +@table @option + +@item graph +Specify the filtergraph to use as input. Each video open output must be +labelled by a unique string of the form "out@var{N}", where @var{N} is a +number starting from 0 corresponding to the mapped input stream +generated by the device. +The first unlabelled output is automatically assigned to the "out0" +label, but all the others need to be specified explicitly. + +If not specified defaults to the filename specified for the input +device. +@end table + +@subsection Examples + +@itemize +@item +Create a color video stream and play it back with @command{ffplay}: +@example +ffplay -f lavfi -graph "color=pink [out0]" dummy +@end example + +@item +As the previous example, but use filename for specifying the graph +description, and omit the "out0" label: +@example +ffplay -f lavfi color=pink +@end example + +@item +Create three different video test filtered sources and play them: +@example +ffplay -f lavfi -graph "testsrc [out0]; testsrc,hflip [out1]; testsrc,negate [out2]" test3 +@end example + +@item +Read an audio stream from a file using the amovie source and play it +back with @command{ffplay}: +@example +ffplay -f lavfi "amovie=test.wav" +@end example + +@item +Read an audio stream and a video stream and play it back with +@command{ffplay}: +@example +ffplay -f lavfi "movie=test.avi[out0];amovie=test.wav[out1]" +@end example + +@end itemize + @section libdc1394 IIDC1394 input device, based on libdc1394 and libraw1394. +@section openal + +The OpenAL input device provides audio capture on all systems with a +working OpenAL 1.1 implementation. + +To enable this input device during configuration, you need OpenAL +headers and libraries installed on your system, and need to configure +FFmpeg with @code{--enable-openal}. + +OpenAL headers and libraries should be provided as part of your OpenAL +implementation, or as an additional download (an SDK). Depending on your +installation you may need to specify additional flags via the +@code{--extra-cflags} and @code{--extra-ldflags} for allowing the build +system to locate the OpenAL headers and libraries. + +An incomplete list of OpenAL implementations follows: + +@table @strong +@item Creative +The official Windows implementation, providing hardware acceleration +with supported devices and software fallback. +See @url{http://openal.org/}. +@item OpenAL Soft +Portable, open source (LGPL) software implementation. Includes +backends for the most common sound APIs on the Windows, Linux, +Solaris, and BSD operating systems. +See @url{http://kcat.strangesoft.net/openal.html}. +@item Apple +OpenAL is part of Core Audio, the official Mac OS X Audio interface. +See @url{http://developer.apple.com/technologies/mac/audio-and-video.html} +@end table + +This device allows to capture from an audio input device handled +through OpenAL. + +You need to specify the name of the device to capture in the provided +filename. If the empty string is provided, the device will +automatically select the default device. You can get the list of the +supported devices by using the option @var{list_devices}. + +@subsection Options + +@table @option + +@item channels +Set the number of channels in the captured audio. Only the values +@option{1} (monaural) and @option{2} (stereo) are currently supported. +Defaults to @option{2}. + +@item sample_size +Set the sample size (in bits) of the captured audio. Only the values +@option{8} and @option{16} are currently supported. Defaults to +@option{16}. + +@item sample_rate +Set the sample rate (in Hz) of the captured audio. +Defaults to @option{44.1k}. + +@item list_devices +If set to @option{true}, print a list of devices and exit. +Defaults to @option{false}. + +@end table + +@subsection Examples + +Print the list of OpenAL supported devices and exit: +@example +$ ffmpeg -list_devices true -f openal -i dummy out.ogg +@end example + +Capture from the OpenAL device @file{DR-BT101 via PulseAudio}: +@example +$ ffmpeg -f openal -i 'DR-BT101 via PulseAudio' out.ogg +@end example + +Capture from the default device (note the empty string '' as filename): +@example +$ ffmpeg -f openal -i '' out.ogg +@end example + +Capture from two devices simultaneously, writing to two different files, +within the same @command{ffmpeg} command: +@example +$ ffmpeg -f openal -i 'DR-BT101 via PulseAudio' out1.ogg -f openal -i 'ALSA Default' out2.ogg +@end example +Note: not all OpenAL implementations support multiple simultaneous capture - +try the latest OpenAL Soft if the above does not work. + @section oss Open Sound System input device. @@ -145,10 +395,10 @@ The filename to provide to the input device is the device node representing the OSS input device, and is usually set to @file{/dev/dsp}. -For example to grab from @file{/dev/dsp} using @command{avconv} use the +For example to grab from @file{/dev/dsp} using @command{ffmpeg} use the command: @example -avconv -f oss -i /dev/dsp /tmp/oss.wav +ffmpeg -f oss -i /dev/dsp /tmp/oss.wav @end example For more information about OSS see: @@ -165,10 +415,10 @@ The filename to provide to the input device is a source device or the string "default" To list the pulse source devices and their properties you can invoke -the command @file{pactl list sources}. +the command @command{pactl list sources}. @example -avconv -f pulse -i default /tmp/pulse.wav +ffmpeg -f pulse -i default /tmp/pulse.wav @end example @subsection @var{server} AVOption @@ -188,7 +438,7 @@ The syntax is: @end example Specify the application name pulse will use when showing active clients, -by default it is "libav" +by default it is the LIBAVFORMAT_IDENT string @subsection @var{stream_name} AVOption @@ -248,10 +498,10 @@ The filename to provide to the input device is the device node representing the sndio input device, and is usually set to @file{/dev/audio0}. -For example to grab from @file{/dev/audio0} using @command{avconv} use the +For example to grab from @file{/dev/audio0} using @command{ffmpeg} use the command: @example -avconv -f sndio -i /dev/audio0 /tmp/oss.wav +ffmpeg -f sndio -i /dev/audio0 /tmp/oss.wav @end example @section video4linux2 @@ -268,17 +518,29 @@ Video4Linux2 devices usually support a limited set of @var{width}x@var{height} sizes and framerates. You can check which are supported using @command{-list_formats all} for Video4Linux2 devices. -Some usage examples of the video4linux2 devices with avconv and avplay: +Some usage examples of the video4linux2 devices with ffmpeg and ffplay: + +The time base for the timestamps is 1 microsecond. Depending on the kernel +version and configuration, the timestamps may be derived from the real time +clock (origin at the Unix Epoch) or the monotonic clock (origin usually at +boot time, unaffected by NTP or manual changes to the clock). The +@option{-timestamps abs} or @option{-ts abs} option can be used to force +conversion into the real time clock. +Note that if FFmpeg is build with v4l-utils support ("--enable-libv4l2" +option), it will always be used. @example # Grab and show the input of a video4linux2 device. -avplay -f video4linux2 -framerate 30 -video_size hd720 /dev/video0 +ffplay -f video4linux2 -framerate 30 -video_size hd720 /dev/video0 # Grab and record the input of a video4linux2 device, leave the framerate and size as previously set. -avconv -f video4linux2 -input_format mjpeg -i /dev/video0 out.mpeg +ffmpeg -f video4linux2 -input_format mjpeg -i /dev/video0 out.mpeg @end example +"v4l" and "v4l2" can be used as aliases for the respective "video4linux" and +"video4linux2". + @section vfwcap VfW (Video for Windows) capture input device. @@ -300,7 +562,7 @@ The filename passed as input has the syntax: @var{hostname}:@var{display_number}.@var{screen_number} specifies the X11 display name of the screen to grab from. @var{hostname} can be -ommitted, and defaults to "localhost". The environment variable +omitted, and defaults to "localhost". The environment variable @env{DISPLAY} contains the default display name. @var{x_offset} and @var{y_offset} specify the offsets of the grabbed @@ -309,15 +571,15 @@ default to 0. Check the X11 documentation (e.g. man X) for more detailed information. -Use the @file{dpyinfo} program for getting basic information about the +Use the @command{dpyinfo} program for getting basic information about the properties of your X11 display (e.g. grep for "name" or "dimensions"). -For example to grab from @file{:0.0} using @command{avconv}: +For example to grab from @file{:0.0} using @command{ffmpeg}: @example -avconv -f x11grab -r 25 -s cif -i :0.0 out.mpg +ffmpeg -f x11grab -r 25 -s cif -i :0.0 out.mpg # Grab at position 10,20. -avconv -f x11grab -r 25 -s cif -i :0.0+10,20 out.mpg +ffmpeg -f x11grab -r 25 -s cif -i :0.0+10,20 out.mpg @end example @subsection @var{follow_mouse} AVOption @@ -334,10 +596,10 @@ zero) to the edge of region. For example: @example -avconv -f x11grab -follow_mouse centered -r 25 -s cif -i :0.0 out.mpg +ffmpeg -f x11grab -follow_mouse centered -r 25 -s cif -i :0.0 out.mpg # Follows only when the mouse pointer reaches within 100 pixels to edge -avconv -f x11grab -follow_mouse 100 -r 25 -s cif -i :0.0 out.mpg +ffmpeg -f x11grab -follow_mouse 100 -r 25 -s cif -i :0.0 out.mpg @end example @subsection @var{show_region} AVOption @@ -353,10 +615,10 @@ being grabbed if only a portion of the screen is grabbed. For example: @example -avconv -f x11grab -show_region 1 -r 25 -s cif -i :0.0+10,20 out.mpg +ffmpeg -f x11grab -show_region 1 -r 25 -s cif -i :0.0+10,20 out.mpg # With follow_mouse -avconv -f x11grab -follow_mouse centered -show_region 1 -r 25 -s cif -i :0.0 out.mpg +ffmpeg -f x11grab -follow_mouse centered -show_region 1 -r 25 -s cif -i :0.0 out.mpg @end example @c man end INPUT DEVICES diff --git a/doc/issue_tracker.txt b/doc/issue_tracker.txt new file mode 100644 index 00000000000..d487f66830a --- /dev/null +++ b/doc/issue_tracker.txt @@ -0,0 +1,213 @@ +FFmpeg's bug/patch/feature request tracker manual +================================================= + +NOTE: This is a draft. + +Overview: +--------- + +FFmpeg uses Trac for tracking issues, new issues and changes to +existing issues can be done through a web interface. + +Issues can be different kinds of things we want to keep track of +but that do not belong into the source tree itself. This includes +bug reports, patches, feature requests and license violations. We +might add more items to this list in the future, so feel free to +propose a new `type of issue' on the ffmpeg-devel mailing list if +you feel it is worth tracking. + +It is possible to subscribe to individual issues by adding yourself to the +Cc list or to subscribe to the ffmpeg-trac mailing list which receives +a mail for every change to every issue. +(the above does all work already after light testing) + +The subscription URL for the ffmpeg-trac list is: +http(s)://ffmpeg.org/mailman/listinfo/ffmpeg-trac +The URL of the webinterface of the tracker is: +http(s)://ffmpeg.org/trac/ffmpeg + +Type: +----- +bug / defect + An error, flaw, mistake, failure, or fault in FFmpeg or libav* that + prevents it from behaving as intended. + +feature request / enhancement + Request of support for encoding or decoding of a new codec, container + or variant. + Request of support for more, less or plain different output or behavior + where the current implementation cannot be considered wrong. + +license violation + ticket to keep track of (L)GPL violations of ffmpeg by others + +patch + A patch as generated by diff which conforms to the patch submission and + development policy. + + +Priority: +--------- +critical + Bugs and patches which deal with data loss and security issues. + No feature request can be critical. + +important + Bugs which make FFmpeg unusable for a significant number of users, and + patches fixing them. + Examples here might be completely broken MPEG-4 decoding or a build issue + on Linux. + While broken 4xm decoding or a broken OS/2 build would not be important, + the separation to normal is somewhat fuzzy. + For feature requests this priority would be used for things many people + want. + Regressions also should be marked as important, regressions are bugs that + don't exist in a past revision or another branch. + +normal + + +minor + Bugs and patches about things like spelling errors, "mp2" instead of + "mp3" being shown and such. + Feature requests about things few people want or which do not make a big + difference. + +wish + Something that is desirable to have but that there is no urgency at + all to implement, e.g. something completely cosmetic like a website + restyle or a personalized doxy template or the FFmpeg logo. + This priority is not valid for bugs. + + +Status: +------- +new + initial state + +open + intermediate states + +closed + final state + + +Analyzed flag: +-------------- +Bugs which have been analyzed and where it is understood what causes them +and which exact chain of events triggers them. This analysis should be +available as a message in the bug report. +Note, do not change the status to analyzed without also providing a clear +and understandable analysis. +This state implicates that the bug either has been reproduced or that +reproduction is not needed as the bug is already understood. + + +Type/Status/Substatus: +---------- +*/new/new + Initial state of new bugs, patches and feature requests submitted by + users. + +*/open/open + Issues which have been briefly looked at and which did not look outright + invalid. + This implicates that no real more detailed state applies yet. Conversely, + the more detailed states below implicate that the issue has been briefly + looked at. + +*/closed/duplicate + Bugs, patches or feature requests which are duplicates. + Note that patches dealing with the same thing in a different way are not + duplicates. + Note, if you mark something as duplicate, do not forget setting the + superseder so bug reports are properly linked. + +*/closed/invalid + Bugs caused by user errors, random ineligible or otherwise nonsense stuff. + +*/closed/needs_more_info + Issues for which some information has been requested by the developers, + but which has not been provided by anyone within reasonable time. + + +bug/closed/fixed + Bugs which have to the best of our knowledge been fixed. + +bug/closed/wont_fix + Bugs which we will not fix. Possible reasons include legality, high + complexity for the sake of supporting obscure corner cases, speed loss + for similarly esoteric purposes, et cetera. + This also means that we would reject a patch. + If we are just too lazy to fix a bug then the correct state is open + and unassigned. Closed means that the case is closed which is not + the case if we are just waiting for a patch. + +bug/closed/works_for_me + Bugs for which sufficient information was provided to reproduce but + reproduction failed - that is the code seems to work correctly to the + best of our knowledge. + +patch/open/approved + Patches which have been reviewed and approved by a developer. + Such patches can be applied anytime by any other developer after some + reasonable testing (compile + regression tests + does the patch do + what the author claimed). + +patch/open/needs_changes + Patches which have been reviewed and need changes to be accepted. + +patch/closed/applied + Patches which have been applied. + +patch/closed/rejected + Patches which have been rejected. + +feature_request/closed/implemented + Feature requests which have been implemented. + +feature_request/closed/wont_implement + Feature requests which will not be implemented. The reasons here could + be legal, philosophical or others. + +Note, please do not use type-status-substatus combinations other than the +above without asking on ffmpeg-dev first! + +Note2, if you provide the requested info do not forget to remove the +needs_more_info substatus. + +Component: +---------- + +avcodec + issues in libavcodec/* + +avformat + issues in libavformat/* + +avutil + issues in libavutil/* + +regression test + issues in tests/* + +ffmpeg + issues in or related to ffmpeg.c + +ffplay + issues in or related to ffplay.c + +ffprobe + issues in or related to ffprobe.c + +ffserver + issues in or related to ffserver.c + +build system + issues in or related to configure/Makefile + +regression + bugs which were not present in a past revision + +trac + issues related to our issue tracker diff --git a/doc/libavfilter.texi b/doc/libavfilter.texi index b452294a5ff..06d9f133242 100644 --- a/doc/libavfilter.texi +++ b/doc/libavfilter.texi @@ -11,11 +11,11 @@ @chapter Introduction -Libavfilter is the filtering API of Libav. It is the substitute of the +Libavfilter is the filtering API of FFmpeg. It is the substitute of the now deprecated 'vhooks' and started as a Google Summer of Code project. -But note that there may still be serious bugs in the code and its API -and ABI should not be considered stable yet! +Audio filtering integration into the main FFmpeg repository is a work in +progress, so audio API and ABI should not be considered stable yet. @chapter Tutorial @@ -36,20 +36,20 @@ and the vflip filter before merging it back with the other stream by overlaying it on top. You can use the following command to achieve this: @example -./avconv -i input -vf "[in] split [T1], fifo, [T2] overlay=0:H/2 [out]; [T1] fifo, crop=iw:ih/2:0:ih/2, vflip [T2]" output +ffmpeg -i input -vf "[in] split [T1], fifo, [T2] overlay=0:H/2 [out]; [T1] fifo, crop=iw:ih/2:0:ih/2, vflip [T2]" output @end example The result will be that in output the top half of the video is mirrored onto the bottom half. Video filters are loaded using the @var{-vf} option passed to -avconv or to avplay. Filters in the same linear chain are separated by -commas. In our example, @var{split, fifo, overlay} are in one linear -chain, and @var{fifo, crop, vflip} are in another. The points where -the linear chains join are labeled by names enclosed in square -brackets. In our example, that is @var{[T1]} and @var{[T2]}. The magic -labels @var{[in]} and @var{[out]} are the points where video is input -and output. +@command{ffmpeg} or to @command{ffplay}. Filters in the same linear +chain are separated by commas. In our example, @var{split, fifo, +overlay} are in one linear chain, and @var{fifo, crop, vflip} are in +another. The points where the linear chains join are labeled by names +enclosed in square brackets. In our example, that is @var{[T1]} and +@var{[T2]}. The magic labels @var{[in]} and @var{[out]} are the points +where video is input and output. Some filters take in input a list of parameters: they are specified after the filter name and an equal sign, and are separated each other @@ -61,7 +61,7 @@ not have video output. @chapter graph2dot -The @file{graph2dot} program included in the Libav @file{tools} +The @file{graph2dot} program included in the FFmpeg @file{tools} directory can be used to parse a filter graph description and issue a corresponding textual representation in the dot language. diff --git a/doc/metadata.texi b/doc/metadata.texi index cfaf491c2d7..2a285757cc4 100644 --- a/doc/metadata.texi +++ b/doc/metadata.texi @@ -1,7 +1,7 @@ @chapter Metadata @c man begin METADATA -Libav is able to dump metadata from media files into a simple UTF-8-encoded +FFmpeg is able to dump metadata from media files into a simple UTF-8-encoded INI-like text file and then load it back using the metadata muxer/demuxer. The file format is as follows: @@ -53,7 +53,7 @@ A ffmetadata file might look like this: ;FFMETADATA1 title=bike\\shed ;this is a comment -artist=Libav troll team +artist=FFmpeg troll team [CHAPTER] TIMEBASE=1/1000 diff --git a/doc/multithreading.txt b/doc/multithreading.txt index b72bc160794..a1068425cd8 100644 --- a/doc/multithreading.txt +++ b/doc/multithreading.txt @@ -1,7 +1,7 @@ -Libav multithreading methods +FFmpeg multithreading methods ============================================== -Libav provides two methods for multithreading codecs. +FFmpeg provides two methods for multithreading codecs. Slice threading decodes multiple parts of a frame at the same time, using AVCodecContext execute() and execute2(). diff --git a/doc/muxers.texi b/doc/muxers.texi index 4bb6d56a001..9b4743f12ef 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -1,10 +1,10 @@ @chapter Muxers @c man begin MUXERS -Muxers are configured elements in Libav which allow writing +Muxers are configured elements in FFmpeg which allow writing multimedia streams to a particular type of file. -When you configure your Libav build, all the supported muxers +When you configure your FFmpeg build, all the supported muxers are enabled by default. You can list all available muxers using the configure option @code{--list-muxers}. @@ -35,20 +35,20 @@ CRC=0x@var{CRC}, where @var{CRC} is a hexadecimal number 0-padded to For example to compute the CRC of the input, and store it in the file @file{out.crc}: @example -avconv -i INPUT -f crc out.crc +ffmpeg -i INPUT -f crc out.crc @end example You can print the CRC to stdout with the command: @example -avconv -i INPUT -f crc - +ffmpeg -i INPUT -f crc - @end example -You can select the output format of each frame with @command{avconv} by +You can select the output format of each frame with @command{ffmpeg} by specifying the audio and video codec and format. For example to compute the CRC of the input audio converted to PCM unsigned 8-bit and the input video converted to MPEG-2 video, use the command: @example -avconv -i INPUT -c:a pcm_u8 -c:v mpeg2video -f crc - +ffmpeg -i INPUT -c:a pcm_u8 -c:v mpeg2video -f crc - @end example See also the @ref{framecrc} muxer. @@ -56,40 +56,79 @@ See also the @ref{framecrc} muxer. @anchor{framecrc} @section framecrc -Per-frame CRC (Cyclic Redundancy Check) testing format. +Per-packet CRC (Cyclic Redundancy Check) testing format. -This muxer computes and prints the Adler-32 CRC for each decoded audio -and video frame. By default audio frames are converted to signed +This muxer computes and prints the Adler-32 CRC for each audio +and video packet. By default audio frames are converted to signed 16-bit raw audio and video frames to raw video before computing the CRC. The output of the muxer consists of a line for each audio and video -frame of the form: @var{stream_index}, @var{frame_dts}, -@var{frame_size}, 0x@var{CRC}, where @var{CRC} is a hexadecimal -number 0-padded to 8 digits containing the CRC of the decoded frame. +packet of the form: +@example +@var{stream_index}, @var{packet_dts}, @var{packet_pts}, @var{packet_duration}, @var{packet_size}, 0x@var{CRC} +@end example + +@var{CRC} is a hexadecimal number 0-padded to 8 digits containing the +CRC of the packet. -For example to compute the CRC of each decoded frame in the input, and -store it in the file @file{out.crc}: +For example to compute the CRC of the audio and video frames in +@file{INPUT}, converted to raw audio and video packets, and store it +in the file @file{out.crc}: @example -avconv -i INPUT -f framecrc out.crc +ffmpeg -i INPUT -f framecrc out.crc @end example -You can print the CRC of each decoded frame to stdout with the command: +To print the information to stdout, use the command: @example -avconv -i INPUT -f framecrc - +ffmpeg -i INPUT -f framecrc - @end example -You can select the output format of each frame with @command{avconv} by -specifying the audio and video codec and format. For example, to +With @command{ffmpeg}, you can select the output format to which the +audio and video frames are encoded before computing the CRC for each +packet by specifying the audio and video codec. For example, to compute the CRC of each decoded input audio frame converted to PCM unsigned 8-bit and of each decoded input video frame converted to MPEG-2 video, use the command: @example -avconv -i INPUT -c:a pcm_u8 -c:v mpeg2video -f framecrc - +ffmpeg -i INPUT -c:a pcm_u8 -c:v mpeg2video -f framecrc - @end example See also the @ref{crc} muxer. +@anchor{framemd5} +@section framemd5 + +Per-packet MD5 testing format. + +This muxer computes and prints the MD5 hash for each audio +and video packet. By default audio frames are converted to signed +16-bit raw audio and video frames to raw video before computing the +hash. + +The output of the muxer consists of a line for each audio and video +packet of the form: +@example +@var{stream_index}, @var{packet_dts}, @var{packet_pts}, @var{packet_duration}, @var{packet_size}, @var{MD5} +@end example + +@var{MD5} is a hexadecimal number representing the computed MD5 hash +for the packet. + +For example to compute the MD5 of the audio and video frames in +@file{INPUT}, converted to raw audio and video packets, and store it +in the file @file{out.md5}: +@example +ffmpeg -i INPUT -f framemd5 out.md5 +@end example + +To print the information to stdout, use the command: +@example +ffmpeg -i INPUT -f framemd5 - +@end example + +See also the @ref{md5} muxer. + @anchor{image2} @section image2 @@ -120,28 +159,61 @@ The pattern "img%%-%d.jpg" will specify a sequence of filenames of the form @file{img%-1.jpg}, @file{img%-2.jpg}, ..., @file{img%-10.jpg}, etc. -The following example shows how to use @command{avconv} for creating a +The following example shows how to use @command{ffmpeg} for creating a sequence of files @file{img-001.jpeg}, @file{img-002.jpeg}, ..., taking one image every second from the input video: @example -avconv -i in.avi -vsync 1 -r 1 -f image2 'img-%03d.jpeg' +ffmpeg -i in.avi -vsync 1 -r 1 -f image2 'img-%03d.jpeg' @end example -Note that with @command{avconv}, if the format is not specified with the +Note that with @command{ffmpeg}, if the format is not specified with the @code{-f} option and the output filename specifies an image file format, the image2 muxer is automatically selected, so the previous command can be written as: @example -avconv -i in.avi -vsync 1 -r 1 'img-%03d.jpeg' +ffmpeg -i in.avi -vsync 1 -r 1 'img-%03d.jpeg' @end example Note also that the pattern must not necessarily contain "%d" or "%0@var{N}d", for example to create a single image file @file{img.jpeg} from the input video you can employ the command: @example -avconv -i in.avi -f image2 -frames:v 1 img.jpeg +ffmpeg -i in.avi -f image2 -frames:v 1 img.jpeg @end example +The image muxer supports the .Y.U.V image file format. This format is +special in that that each image frame consists of three files, for +each of the YUV420P components. To read or write this image file format, +specify the name of the '.Y' file. The muxer will automatically open the +'.U' and '.V' files as required. + +@anchor{md5} +@section md5 + +MD5 testing format. + +This muxer computes and prints the MD5 hash of all the input audio +and video frames. By default audio frames are converted to signed +16-bit raw audio and video frames to raw video before computing the +hash. + +The output of the muxer consists of a single line of the form: +MD5=@var{MD5}, where @var{MD5} is a hexadecimal number representing +the computed MD5 hash. + +For example to compute the MD5 hash of the input converted to raw +audio and video, and store it in the file @file{out.md5}: +@example +ffmpeg -i INPUT -f md5 out.md5 +@end example + +You can print the MD5 to stdout with the command: +@example +ffmpeg -i INPUT -f md5 - +@end example + +See also the @ref{framemd5} muxer. + @section MOV/MP4/ISMV The mov/mp4/ismv muxer supports fragmentation. Normally, a MOV/MP4 @@ -161,6 +233,9 @@ Fragmentation is enabled by setting one of the AVOptions that define how to cut the file into fragments: @table @option +@item -moov_size @var{bytes} +Reserves space for the moov atom at the beginning of the file instead of placing the +moov atom at the end. If the space reserved is insufficient, muxing will fail. @item -movflags frag_keyframe Start a new fragment at each video keyframe. @item -frag_duration @var{duration} @@ -171,7 +246,7 @@ Create fragments that contain up to @var{size} bytes of payload data. Allow the caller to manually choose when to cut fragments, by calling @code{av_write_frame(ctx, NULL)} to write a fragment with the packets written so far. (This is only useful with other -applications integrating libavformat, not from @command{avconv}.) +applications integrating libavformat, not from @command{ffmpeg}.) @item -min_frag_duration @var{duration} Don't create fragments that are shorter than @var{duration} microseconds long. @end table @@ -207,7 +282,7 @@ This option is implicitly set when writing ismv (Smooth Streaming) files. Smooth Streaming content can be pushed in real time to a publishing point on IIS with this muxer. Example: @example -avconv -re @var{} -movflags isml+frag_keyframe -f ismv http://server/publishingpoint.isml/Streams(Encoder1) +ffmpeg -re @var{} -movflags isml+frag_keyframe -f ismv http://server/publishingpoint.isml/Streams(Encoder1) @end example @section mpegts @@ -236,11 +311,11 @@ Set the first PID for data packets (default 0x0100, max 0x0f00). The recognized metadata settings in mpegts muxer are @code{service_provider} and @code{service_name}. If they are not set the default for -@code{service_provider} is "Libav" and the default for +@code{service_provider} is "FFmpeg" and the default for @code{service_name} is "Service01". @example -avconv -i file.mpg -c copy \ +ffmpeg -i file.mpg -c copy \ -mpegts_original_network_id 0x1122 \ -mpegts_transport_stream_id 0x3344 \ -mpegts_service_id 0x5566 \ @@ -258,19 +333,19 @@ Null muxer. This muxer does not generate any output file, it is mainly useful for testing or benchmarking purposes. -For example to benchmark decoding with @command{avconv} you can use the +For example to benchmark decoding with @command{ffmpeg} you can use the command: @example -avconv -benchmark -i INPUT -f null out.null +ffmpeg -benchmark -i INPUT -f null out.null @end example Note that the above command does not read or write the @file{out.null} -file, but specifying the output file is required by the @command{avconv} +file, but specifying the output file is required by the @command{ffmpeg} syntax. Alternatively you can write the command as: @example -avconv -benchmark -i INPUT -f null - +ffmpeg -benchmark -i INPUT -f null - @end example @section matroska @@ -295,7 +370,7 @@ Specifies the language of the track in the Matroska languages form @table @option -@item STEREO_MODE=@var{mode} +@item stereo_mode=@var{mode} Stereo 3D video layout of two views in a single video track @table @option @item mono @@ -333,7 +408,7 @@ Both eyes laced in one Block, Right-eye view is first For example a 3D WebM clip can be created using the following command line: @example -avconv -i sample_left_right_clip.mpg -an -c:v libvpx -metadata STEREO_MODE=left_right -y stereo_clip.webm +ffmpeg -i sample_left_right_clip.mpg -an -c:v libvpx -metadata stereo_mode=left_right -y stereo_clip.webm @end example @section segment @@ -365,7 +440,7 @@ Wrap around segment index once it reaches @var{limit}. @end table @example -avconv -i in.mkv -c copy -map 0 -f segment -list out.list out%03d.nut +ffmpeg -i in.mkv -c copy -map 0 -f segment -list out.list out%03d.nut @end example @section mp3 @@ -394,12 +469,12 @@ Examples: Write an mp3 with an ID3v2.3 header and an ID3v1 footer: @example -avconv -i INPUT -id3v2_version 3 -write_id3v1 1 out.mp3 +ffmpeg -i INPUT -id3v2_version 3 -write_id3v1 1 out.mp3 @end example Attach a picture to an mp3: @example -avconv -i input.mp3 -i cover.png -c copy -metadata:s:v title="Album cover" +ffmpeg -i input.mp3 -i cover.png -c copy -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (Front)" out.mp3 @end example diff --git a/doc/optimization.txt b/doc/optimization.txt index 78e0077e305..b027efef2f3 100644 --- a/doc/optimization.txt +++ b/doc/optimization.txt @@ -17,15 +17,15 @@ Understanding these overoptimized functions: As many functions tend to be a bit difficult to understand because of optimizations, it can be hard to optimize them further, or write architecture-specific versions. It is recommended to look at older -revisions of the interesting files (web frontends for the various Libav -branches are listed at http://libav.org/download.html). +revisions of the interesting files (web frontends for the various FFmpeg +branches are listed at http://ffmpeg.org/download.html). Alternatively, look into the other architecture-specific versions in the x86/, ppc/, alpha/ subdirectories. Even if you don't exactly comprehend the instructions, it could help understanding the functions and how they can be optimized. NOTE: If you still don't understand some function, ask at our mailing list!!! -(https://lists.libav.org/mailman/listinfo/libav-devel) +(http://lists.ffmpeg.org/mailman/listinfo/ffmpeg-devel) When is an optimization justified? @@ -201,7 +201,7 @@ Inline asm vs. external asm --------------------------- Both inline asm (__asm__("..") in a .c file, handled by a compiler such as gcc) and external asm (.s or .asm files, handled by an assembler such as yasm/nasm) -are accepted in Libav. Which one to use differs per specific case. +are accepted in FFmpeg. Which one to use differs per specific case. - if your code is intended to be inlined in a C function, inline asm is always better, because external asm cannot be inlined diff --git a/doc/outdevs.texi b/doc/outdevs.texi index 938909c7847..8de4fe6ec45 100644 --- a/doc/outdevs.texi +++ b/doc/outdevs.texi @@ -1,10 +1,10 @@ @chapter Output Devices @c man begin OUTPUT DEVICES -Output devices are configured elements in Libav which allow to write +Output devices are configured elements in FFmpeg which allow to write multimedia data to an output device attached to your system. -When you configure your Libav build, all the supported output devices +When you configure your FFmpeg build, all the supported output devices are enabled by default. You can list all available ones using the configure option "--list-outdevs". @@ -26,6 +26,46 @@ ALSA (Advanced Linux Sound Architecture) output device. OSS (Open Sound System) output device. +@section sdl + +SDL (Simple DirectMedia Layer) output device. + +This output devices allows to show a video stream in an SDL +window. Only one SDL window is allowed per application, so you can +have only one instance of this output device in an application. + +To enable this output device you need libsdl installed on your system +when configuring your build. + +For more information about SDL, check: +@url{http://www.libsdl.org/} + +@subsection Options + +@table @option + +@item window_title +Set the SDL window title, if not specified default to the filename +specified for the output device. + +@item icon_title +Set the name of the iconified SDL window, if not specified it is set +to the same value of @var{window_title}. + +@item window_size +Set the SDL window size, can be a string of the form +@var{width}x@var{height} or a video size abbreviation. +If not specified it defaults to the size of the input video. +@end table + +@subsection Examples + +The following command shows the @command{ffmpeg} output is an +SDL window, forcing its size to the qcif format: +@example +ffmpeg -i INPUT -vcodec rawvideo -pix_fmt yuv420p -window_size qcif -f sdl "SDL output" +@end example + @section sndio sndio audio output device. diff --git a/doc/platform.texi b/doc/platform.texi index 97e97c218c3..d1a1f944810 100644 --- a/doc/platform.texi +++ b/doc/platform.texi @@ -11,7 +11,7 @@ @chapter Unix-like -Some parts of Libav cannot be built with version 2.15 of the GNU +Some parts of FFmpeg cannot be built with version 2.15 of the GNU assembler which is still provided by a few AMD64 distributions. To make sure your compiler really uses the required version of gas after a binutils upgrade, run: @@ -26,12 +26,12 @@ to configure. @section BSD -BSD make will not build Libav, you need to install and use GNU Make +BSD make will not build FFmpeg, you need to install and use GNU Make (@file{gmake}). @section (Open)Solaris -GNU Make is required to build Libav, so you have to invoke (@file{gmake}), +GNU Make is required to build FFmpeg, so you have to invoke (@file{gmake}), standard Solaris Make will not work. When building with a non-c99 front-end (gcc, generic suncc) add either @code{--extra-libs=/usr/lib/values-xpg6.o} or @code{--extra-libs=/usr/lib/64/values-xpg6.o} to the configure options @@ -45,20 +45,21 @@ bash ./configure @end example @anchor{Darwin} -@section Darwin (OS X, iPhone) +@section Darwin (Mac OS X, iPhone) The toolchain provided with Xcode is sufficient to build the basic unacelerated code. -OS X on PowerPC or ARM (iPhone) requires a preprocessor from +Mac OS X on PowerPC or ARM (iPhone) requires a preprocessor from @url{http://github.com/yuvi/gas-preprocessor} to build the optimized assembler functions. Just download the Perl script and put it somewhere -in your PATH, Libav's configure will pick it up automatically. +in your PATH, FFmpeg's configure will pick it up automatically. -OS X on AMD64 and x86 requires @command{yasm} to build most of the -optimized assembler functions @url{http://mxcl.github.com/homebrew/, Homebrew}, -@url{http://www.gentoo.org/proj/en/gentoo-alt/prefix/bootstrap-macos.xml, Gentoo Prefix} -or @url{http://www.macports.org, MacPorts} can easily provide it. +Mac OS X on amd64 and x86 requires @command{yasm} to build most of the +optimized assembler functions. @uref{http://www.finkproject.org/, Fink}, +@uref{http://www.gentoo.org/proj/en/gentoo-alt/prefix/bootstrap-macos.xml, Gentoo Prefix}, +@uref{http://mxcl.github.com/homebrew/, Homebrew} +or @uref{http://www.macports.org, MacPorts} can easily provide it. @chapter DOS @@ -69,20 +70,24 @@ Using a cross-compiler is preferred for various reasons. @chapter OS/2 -For information about compiling Libav on OS/2 see +For information about compiling FFmpeg on OS/2 see @url{http://www.edm2.com/index.php/FFmpeg}. @chapter Windows +To get help and instructions for building FFmpeg under Windows, check out +the FFmpeg Windows Help Forum at +@url{http://ffmpeg.arrozcru.org/}. + @section Native Windows compilation -Libav can be built to run natively on Windows using the MinGW tools. Install +FFmpeg can be built to run natively on Windows using the MinGW tools. Install the latest versions of MSYS and MinGW from @url{http://www.mingw.org/}. -You can find detailed installation -instructions in the download section and the FAQ. +You can find detailed installation instructions in the download +section and the FAQ. -Libav does not build out-of-the-box with the packages the automated MinGW +FFmpeg does not build out-of-the-box with the packages the automated MinGW installer provides. It also requires coreutils to be installed and many other packages updated to the latest version. The minimum version for some packages are listed below: @@ -94,7 +99,7 @@ are listed below: @item mingw-runtime 3.15 @end itemize -Libav automatically passes @code{-fno-common} to the compiler to work around +FFmpeg automatically passes @code{-fno-common} to the compiler to work around a GCC bug (see @url{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37216}). Notes: @@ -107,20 +112,21 @@ speed up is close to non-existent for normal one-off builds and is only noticeable when running make for a second time (for example in @code{make install}). -@item In order to compile AVplay, you must have the MinGW development library +@item In order to compile FFplay, you must have the MinGW development library of @uref{http://www.libsdl.org/, SDL}. Edit the @file{bin/sdl-config} script so that it points to the correct prefix where SDL was installed. Verify that @file{sdl-config} can be launched from the MSYS command line. -@item By using @code{./configure --enable-shared} when configuring Libav, -you can build libavutil, libavcodec and libavformat as DLLs. +@item By using @code{./configure --enable-shared} when configuring FFmpeg, +you can build the FFmpeg libraries (e.g. libavutil, libavcodec, +libavformat) as DLLs. @end itemize @section Microsoft Visual C++ compatibility -As stated in the FAQ, Libav will not compile under MSVC++. However, if you +As stated in the FAQ, FFmpeg will not compile under MSVC++. However, if you want to use the libav* libraries in your own applications, you can still compile those applications using MSVC++. But the libav* libraries you link to @emph{must} be built with MinGW. However, you will not be able to debug @@ -128,13 +134,13 @@ inside the libav* libraries, since MSVC++ does not recognize the debug symbols generated by GCC. We strongly recommend you to move over from MSVC++ to MinGW tools. -This description of how to use the Libav libraries with MSVC++ is based on +This description of how to use the FFmpeg libraries with MSVC++ is based on Microsoft Visual C++ 2005 Express Edition. If you have a different version, you might have to modify the procedures slightly. @subsection Using static libraries -Assuming you have just built and installed Libav in @file{/usr/local}. +Assuming you have just built and installed FFmpeg in @file{/usr/local}. @enumerate @@ -145,13 +151,13 @@ Application Wizard, uncheck the "Precompiled headers" option. @item Write the source code for your application, or, for testing, just copy the code from an existing sample application into the source file that MSVC++ has already created for you. For example, you can copy -@file{libavformat/output-example.c} from the Libav distribution. +@file{libavformat/output-example.c} from the FFmpeg distribution. @item Open the "Project / Properties" dialog box. In the "Configuration" combo box, select "All Configurations" so that the changes you make will affect both debug and release builds. In the tree view on the left hand side, select "C/C++ / General", then edit the "Additional Include -Directories" setting to contain the path where the Libav includes were +Directories" setting to contain the path where the FFmpeg includes were installed (i.e. @file{c:\msys\1.0\local\include}). Do not add MinGW's include directory here, or the include files will conflict with MSVC's. @@ -159,7 +165,7 @@ conflict with MSVC's. @item Still in the "Project / Properties" dialog box, select "Linker / General" from the tree view and edit the "Additional Library Directories" setting to contain the @file{lib} -directory where Libav was installed (i.e. @file{c:\msys\1.0\local\lib}), +directory where FFmpeg was installed (i.e. @file{c:\msys\1.0\local\lib}), the directory where MinGW libs are installed (i.e. @file{c:\mingw\lib}), and the directory where MinGW's GCC libs are installed (i.e. @file{C:\mingw\lib\gcc\mingw32\4.2.1-sjlj}). Then select @@ -176,13 +182,13 @@ set to "Multi-threaded DLL". @item Click "OK" to close the "Project / Properties" dialog box. -@item MSVC++ lacks some C99 header files that are fundamental for Libav. +@item MSVC++ lacks some C99 header files that are fundamental for FFmpeg. Get msinttypes from @url{http://code.google.com/p/msinttypes/downloads/list} and install it in MSVC++'s include directory (i.e. @file{C:\Program Files\Microsoft Visual Studio 8\VC\include}). @item MSVC++ also does not understand the @code{inline} keyword used by -Libav, so you must add this line before @code{#include}ing libav*: +FFmpeg, so you must add this line before @code{#include}ing libav*: @example #define inline _inline @end example @@ -195,7 +201,30 @@ Libav, so you must add this line before @code{#include}ing libav*: This is how to create DLL and LIB files that are compatible with MSVC++: -Within the MSYS shell, build Libav with +@enumerate + +@item Add a call to @file{vcvars32.bat} (which sets up the environment +variables for the Visual C++ tools) as the first line of @file{msys.bat}. +The standard location for @file{vcvars32.bat} is +@file{C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat}, +and the standard location for @file{msys.bat} is @file{C:\msys\1.0\msys.bat}. +If this corresponds to your setup, add the following line as the first line +of @file{msys.bat}: + +@example +call "C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat" +@end example + +Alternatively, you may start the @file{Visual Studio 2005 Command Prompt}, +and run @file{c:\msys\1.0\msys.bat} from there. + +@item Within the MSYS shell, run @code{lib.exe}. If you get a help message +from @file{Microsoft (R) Library Manager}, this means your environment +variables are set up correctly, the @file{Microsoft (R) Library Manager} +is on the path and will be used by FFmpeg to create +MSVC++-compatible import libraries. + +@item Build FFmpeg with @example ./configure --enable-shared @@ -206,6 +235,8 @@ make install Your install path (@file{/usr/local/} by default) should now have the necessary DLL and LIB files under the @file{bin} directory. +@end enumerate + Alternatively, build the libraries with a cross compiler, according to the instructions below in @ref{Cross compilation for Windows with Linux}. @@ -222,7 +253,7 @@ reference errors. There should be no need for @file{libmingwex.a}, @file{libgcc.a}, and @file{wsock32.lib}, nor any other external library statically linked into the DLLs. -Libav headers do not declare global data for Windows DLLs through the usual +FFmpeg headers do not declare global data for Windows DLLs through the usual dllexport/dllimport interface. Such data will be exported properly while building, but to use them in your MSVC++ code you will have to edit the appropriate headers and mark the data as dllimport. For example, in @@ -273,14 +304,14 @@ lib /machine:i386 /def:..\lib\swscale-2.def /out:swscale.lib You must use the MinGW cross compilation tools available at @url{http://www.mingw.org/}. -Then configure Libav with the following options: +Then configure FFmpeg with the following options: @example ./configure --target-os=mingw32 --cross-prefix=i386-mingw32msvc- @end example (you can change the cross-prefix according to the prefix chosen for the MinGW tools). -Then you can easily test Libav with @uref{http://www.winehq.com/, Wine}. +Then you can easily test FFmpeg with @uref{http://www.winehq.com/, Wine}. @section Compilation under Cygwin @@ -313,7 +344,7 @@ shared libraries: ./configure --enable-shared --disable-static --extra-cflags=-fno-reorder-functions @end example -If you want to build Libav with additional libraries, download Cygwin +If you want to build FFmpeg with additional libraries, download Cygwin "Devel" packages for Ogg and Vorbis from any Cygwin packages repository: @example libogg-devel, libvorbis-devel @@ -323,7 +354,7 @@ These library packages are only available from @uref{http://sourceware.org/cygwinports/, Cygwin Ports}: @example -yasm, libSDL-devel, libfaac-devel, libgsm-devel, libmp3lame-devel, +yasm, libSDL-devel, libfaac-devel, libaacplus-devel, libgsm-devel, libmp3lame-devel, libschroedinger1.0-devel, speex-devel, libtheora-devel, libxvidcore-devel @end example diff --git a/doc/print_options.c b/doc/print_options.c index 4283e6a86d0..339b942fb82 100644 --- a/doc/print_options.c +++ b/doc/print_options.c @@ -112,6 +112,8 @@ int main(int argc, char **argv) if (argc < 2) print_usage(); + printf("@c DO NOT EDIT THIS FILE!\n" + "@c It was generated by print_options.\n\n"); if (!strcmp(argv[1], "format")) show_format_opts(); else if (!strcmp(argv[1], "codec")) diff --git a/doc/protocols.texi b/doc/protocols.texi index b08233ec805..ae1c9b84e63 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -1,10 +1,10 @@ @chapter Protocols @c man begin PROTOCOLS -Protocols are configured elements in Libav which allow to access +Protocols are configured elements in FFmpeg which allow to access resources which require the use of a particular protocol. -When you configure your Libav build, all the supported protocols are +When you configure your FFmpeg build, all the supported protocols are enabled by default. You can list all available ones using the configure option "--list-protocols". @@ -19,6 +19,36 @@ supported protocols. A description of the currently available protocols follows. +@section bluray + +Read BluRay playlist. + +The accepted options are: +@table @option + +@item angle +BluRay angle + +@item chapter +Start chapter (1...N) + +@item playlist +Playlist to read (BDMV/PLAYLIST/?????.mpls) + +@end table + +Examples: + +Read longest playlist from BluRay mounted to /mnt/bluray: +@example +bluray:/mnt/bluray +@end example + +Read angle 2 of playlist 4 from BluRay mounted to /mnt/bluray, start from chapter 2: +@example +-playlist 4 -angle 2 -chapter 2 bluray:/mnt/bluray +@end example + @section concat Physical concatenation protocol. @@ -36,10 +66,10 @@ resource to be concatenated, each one possibly specifying a distinct protocol. For example to read a sequence of files @file{split1.mpeg}, -@file{split2.mpeg}, @file{split3.mpeg} with @file{avplay} use the +@file{split2.mpeg}, @file{split3.mpeg} with @command{ffplay} use the command: @example -avplay concat:split1.mpeg\|split2.mpeg\|split3.mpeg +ffplay concat:split1.mpeg\|split2.mpeg\|split3.mpeg @end example Note that you may need to escape the character "|" which is special for @@ -51,10 +81,10 @@ File access protocol. Allow to read from or read to a file. -For example to read from a file @file{input.mpeg} with @command{avconv} +For example to read from a file @file{input.mpeg} with @command{ffmpeg} use the command: @example -avconv -i file:input.mpeg output.mpeg +ffmpeg -i file:input.mpeg output.mpeg @end example The ff* tools default to the file protocol, that is a resource @@ -113,10 +143,10 @@ be used to test muxers without writing an actual file. Some examples follow. @example # Write the MD5 hash of the encoded AVI file to the file output.avi.md5. -avconv -i input.flv -f avi -y md5:output.avi.md5 +ffmpeg -i input.flv -f avi -y md5:output.avi.md5 # Write the MD5 hash of the encoded AVI file to stdout. -avconv -i input.flv -f avi -y md5: +ffmpeg -i input.flv -f avi -y md5: @end example Note that some formats (typically MOV) require the output protocol to @@ -138,18 +168,18 @@ pipe (e.g. 0 for stdin, 1 for stdout, 2 for stderr). If @var{number} is not specified, by default the stdout file descriptor will be used for writing, stdin for reading. -For example to read from stdin with @command{avconv}: +For example to read from stdin with @command{ffmpeg}: @example -cat test.wav | avconv -i pipe:0 +cat test.wav | ffmpeg -i pipe:0 # ...this is the same as... -cat test.wav | avconv -i pipe: +cat test.wav | ffmpeg -i pipe: @end example -For writing to stdout with @command{avconv}: +For writing to stdout with @command{ffmpeg}: @example -avconv -i test.wav -f avi pipe:1 | cat > test.avi +ffmpeg -i test.wav -f avi pipe:1 | cat > test.avi # ...this is the same as... -avconv -i test.wav -f avi pipe: | cat > test.avi +ffmpeg -i test.wav -f avi pipe: | cat > test.avi @end example Note that some formats (typically MOV), require the output protocol to @@ -187,10 +217,10 @@ application specified in @var{app}, may be prefixed by "mp4:". @end table -For example to read with @file{avplay} a multimedia resource named +For example to read with @command{ffplay} a multimedia resource named "sample" from the application "vod" from an RTMP server "myserver": @example -avplay rtmp://myserver/vod/sample +ffplay rtmp://myserver/vod/sample @end example @section rtmp, rtmpe, rtmps, rtmpt, rtmpte @@ -223,14 +253,14 @@ meaning as specified for the RTMP native protocol. See the librtmp manual page (man 3 librtmp) for more information. For example, to stream a file in real-time to an RTMP server using -@command{avconv}: +@command{ffmpeg}: @example -avconv -re -i myfile -f flv rtmp://myserver/live/mystream +ffmpeg -re -i myfile -f flv rtmp://myserver/live/mystream @end example -To play the same stream using @file{avplay}: +To play the same stream using @command{ffplay}: @example -avplay "rtmp://myserver/live/mystream live=1" +ffplay "rtmp://myserver/live/mystream live=1" @end example @section rtp @@ -253,7 +283,7 @@ The required syntax for a RTSP url is: rtsp://@var{hostname}[:@var{port}]/@var{path} @end example -The following options (set on the @command{avconv}/@file{avplay} command +The following options (set on the @command{ffmpeg}/@command{ffplay} command line, or set in code via @code{AVOption}s or in @code{avformat_open_input}), are supported: @@ -292,7 +322,7 @@ When receiving data over UDP, the demuxer tries to reorder received packets can be disabled by setting the maximum demuxing delay to zero (via the @code{max_delay} field of AVFormatContext). -When watching multi-bitrate Real-RTSP streams with @file{avplay}, the +When watching multi-bitrate Real-RTSP streams with @command{ffplay}, the streams to display can be chosen with @code{-vst} @var{n} and @code{-ast} @var{n} for video and audio respectively, and can be switched on the fly by pressing @code{v} and @code{a}. @@ -302,19 +332,19 @@ Example command lines: To watch a stream over UDP, with a max reordering delay of 0.5 seconds: @example -avplay -max_delay 500000 -rtsp_transport udp rtsp://server/video.mp4 +ffplay -max_delay 500000 -rtsp_transport udp rtsp://server/video.mp4 @end example To watch a stream tunneled over HTTP: @example -avplay -rtsp_transport http rtsp://server/video.mp4 +ffplay -rtsp_transport http rtsp://server/video.mp4 @end example To send a stream in realtime to a RTSP server, for others to watch: @example -avconv -re -i @var{input} -f rtsp -muxdelay 0.1 rtsp://server/live.sdp +ffmpeg -re -i @var{input} -f rtsp -muxdelay 0.1 rtsp://server/live.sdp @end example @section sap @@ -366,19 +396,19 @@ Example command lines follow. To broadcast a stream on the local subnet, for watching in VLC: @example -avconv -re -i @var{input} -f sap sap://224.0.0.255?same_port=1 +ffmpeg -re -i @var{input} -f sap sap://224.0.0.255?same_port=1 @end example -Similarly, for watching in avplay: +Similarly, for watching in @command{ffplay}: @example -avconv -re -i @var{input} -f sap sap://224.0.0.255 +ffmpeg -re -i @var{input} -f sap sap://224.0.0.255 @end example -And for watching in avplay, over IPv6: +And for watching in @command{ffplay}, over IPv6: @example -avconv -re -i @var{input} -f sap sap://[ff0e::1:2:3:4] +ffmpeg -re -i @var{input} -f sap sap://[ff0e::1:2:3:4] @end example @subsection Demuxer @@ -400,13 +430,13 @@ Example command lines follow. To play back the first stream announced on the normal SAP multicast address: @example -avplay sap:// +ffplay sap:// @end example To play back the first stream announced on one the default IPv6 SAP multicast address: @example -avplay sap://[ff0e::2:7ffe] +ffplay sap://[ff0e::2:7ffe] @end example @section tcp @@ -424,8 +454,8 @@ tcp://@var{hostname}:@var{port}[?@var{options}] Listen for an incoming connection @example -avconv -i @var{input} -f @var{format} tcp://@var{hostname}:@var{port}?listen -avplay tcp://@var{hostname}:@var{port} +ffmpeg -i @var{input} -f @var{format} tcp://@var{hostname}:@var{port}?listen +ffplay tcp://@var{hostname}:@var{port} @end example @end table @@ -476,21 +506,21 @@ For receiving, this gives the benefit of only receiving packets from the specified peer address/port. @end table -Some usage examples of the udp protocol with @command{avconv} follow. +Some usage examples of the udp protocol with @command{ffmpeg} follow. To stream over UDP to a remote endpoint: @example -avconv -i @var{input} -f @var{format} udp://@var{hostname}:@var{port} +ffmpeg -i @var{input} -f @var{format} udp://@var{hostname}:@var{port} @end example To stream in mpegts format over UDP using 188 sized UDP packets, using a large input buffer: @example -avconv -i @var{input} -f mpegts udp://@var{hostname}:@var{port}?pkt_size=188&buffer_size=65535 +ffmpeg -i @var{input} -f mpegts udp://@var{hostname}:@var{port}?pkt_size=188&buffer_size=65535 @end example To receive over UDP from a remote endpoint: @example -avconv -i udp://[@var{multicast-address}]:@var{port} +ffmpeg -i udp://[@var{multicast-address}]:@var{port} @end example @c man end PROTOCOLS diff --git a/doc/soc.txt b/doc/soc.txt index 89728b5201f..2504dba5533 100644 --- a/doc/soc.txt +++ b/doc/soc.txt @@ -8,9 +8,9 @@ it's a little late for this year's soc (2006). The Goal: Our goal in respect to soc is and must be of course exactly one thing and -that is to improve Libav, to reach this goal, code must +that is to improve FFmpeg, to reach this goal, code must * conform to the development policy and patch submission guidelines -* must improve Libav somehow (faster, smaller, "better", +* must improve FFmpeg somehow (faster, smaller, "better", more codecs supported, fewer bugs, cleaner, ...) for mentors and other developers to help students to reach that goal it is @@ -20,5 +20,5 @@ easy reviewable that again leads us to: * separation of cosmetic from non-cosmetic changes (this is almost entirely ignored by mentors and students in soc 2006 which might lead to a surprise when the code will be reviewed at the end before a possible inclusion in - Libav, individual changes were generally not reviewable due to cosmetics). + FFmpeg, individual changes were generally not reviewable due to cosmetics). * frequent commits, so that comments can be provided early diff --git a/doc/swresample.txt b/doc/swresample.txt new file mode 100644 index 00000000000..c0f86a2be15 --- /dev/null +++ b/doc/swresample.txt @@ -0,0 +1,46 @@ + The official guide to swresample for confused developers. + ========================================================= + +Current (simplified) Architecture: +--------------------------------- + Input + v + __________________/|\___________ + / | \ + / input sample format convert v + / | ___________/ + | |/ + | v + | ___________/|\___________ _____________ + | / | \ | | + | Rematrix | resample <---->| Buffers | + | \___________ | ___________/ |_____________| + v \|/ +Special Converter v + v ___________/|\___________ _____________ + | / | \ | | + | Rematrix | resample <---->| Buffers | + | \___________ | ___________/ |_____________| + | \|/ + | v + | |\___________ + \ | \ + \ output sample format convert v + \_________________ | ___________/ + \|/ + v + Output + +Planar/Packed convertion is done when needed during sample format convertion +Every step can be skipped without memcpy when its not needed. +Either Resampling and Rematrixing can be performed first depending on which +way its faster. +The Buffers are needed for resampling due to resamplng being a process that +requires future and past data, it thus also introduces inevitably a delay when +used. +Internally 32bit float and 16bit int is supported currently, other formats can +easily be added +Externally all sample formats in packed and planar configuration are supported +Its also trivial to add special converters for common cases +If only sample format and or packed/planar convertion is needed it +is performed from input to output directly in a single pass with no intermediates. diff --git a/doc/t2h.init b/doc/t2h.init index d91d7b6bff0..db5536bd88b 100644 --- a/doc/t2h.init +++ b/doc/t2h.init @@ -1,6 +1,6 @@ # no horiz rules between sections -$end_section = \&Libav_end_section; -sub Libav_end_section($$) +$end_section = \&FFmpeg_end_section; +sub FFmpeg_end_section($$) { } @@ -67,11 +67,11 @@ h3 { EOT -my $LIBAV_NAVBAR = $ENV{"LIBAV_NAVBAR"} || ''; +my $FFMPEG_NAVBAR = $ENV{"FFMPEG_NAVBAR"} || ''; $AFTER_BODY_OPEN = '
' . -"\n$LIBAV_NAVBAR\n" . +"\n$FFMPEG_NAVBAR\n" . '
'; $PRE_BODY_CLOSE = '
'; @@ -79,8 +79,8 @@ $PRE_BODY_CLOSE = ''; $SMALL_RULE = ''; $BODYTEXT = ''; -$print_page_foot = \&Libav_print_page_foot; -sub Libav_print_page_foot($$) +$print_page_foot = \&FFmpeg_print_page_foot; +sub FFmpeg_print_page_foot($$) { my $fh = shift; print $fh '\n"; } -$float = \&Libav_float; +$float = \&FFmpeg_float; -sub Libav_float($$$$) +sub FFmpeg_float($$$$) { my $text = shift; my $float = shift; @@ -117,8 +117,8 @@ sub Libav_float($$$$) return '
' . "$label\n" . $text . '
'; } -$print_page_head = \&Libav_print_page_head; -sub Libav_print_page_head($$) +$print_page_head = \&FFmpeg_print_page_head; +sub FFmpeg_print_page_head($$) { my $fh = shift; my $longtitle = "$Texi2HTML::THISDOC{'title_no_texi'}"; @@ -131,7 +131,7 @@ sub Libav_print_page_head($$) my $encoding = ''; $encoding = "" if (defined($ENCODING) and ($ENCODING ne '')); $longtitle =~ s/Documentation.*//g; - $longtitle = "Libav documentation : " . $longtitle; + $longtitle = "FFmpeg documentation : " . $longtitle; print $fh < #include @@ -45,10 +49,16 @@ #include "libavutil/avstring.h" #include "libavutil/libm.h" #include "libavutil/imgutils.h" +#include "libavutil/timestamp.h" #include "libavformat/os_support.h" +#include "libswresample/swresample.h" + +#include "libavformat/ffm.h" // not public API +# include "libavfilter/avcodec.h" # include "libavfilter/avfilter.h" # include "libavfilter/avfiltergraph.h" +# include "libavfilter/buffersink.h" # include "libavfilter/buffersrc.h" # include "libavfilter/vsrc_buffer.h" @@ -68,6 +78,14 @@ #include #endif +#if HAVE_TERMIOS_H +#include +#include +#include +#include +#elif HAVE_KBHIT +#include +#endif #include #include "cmdutils.h" @@ -78,8 +96,9 @@ #define VSYNC_PASSTHROUGH 0 #define VSYNC_CFR 1 #define VSYNC_VFR 2 +#define VSYNC_DROP 0xff -const char program_name[] = "avconv"; +const char program_name[] = "ffmpeg"; const int program_birth_year = 2000; /* select an input stream for an output stream */ @@ -92,34 +111,40 @@ typedef struct StreamMap { char *linklabel; /** name of an output link, for mapping lavfi outputs */ } StreamMap; -/** - * select an input file for an output file - */ -typedef struct MetadataMap { - int file; ///< file index - char type; ///< type of metadata to copy -- (g)lobal, (s)tream, (c)hapter or (p)rogram - int index; ///< stream/chapter/program number -} MetadataMap; +typedef struct { + int file_idx, stream_idx, channel_idx; // input + int ofile_idx, ostream_idx; // output +} AudioChannelMap; static const OptionDef options[]; +#define MAX_STREAMS 1024 /* arbitrary sanity check value */ + +static int frame_bits_per_raw_sample = 0; static int video_discard = 0; static int same_quant = 0; static int do_deinterlace = 0; static int intra_dc_precision = 8; static int qp_hist = 0; +static int intra_only = 0; +static const char *video_codec_name = NULL; +static const char *audio_codec_name = NULL; +static const char *subtitle_codec_name = NULL; static int file_overwrite = 0; +static int no_file_overwrite = 0; static int do_benchmark = 0; +static int do_benchmark_all = 0; static int do_hex_dump = 0; static int do_pkt_dump = 0; +static int do_psnr = 0; static int do_pass = 0; -static char *pass_logfilename_prefix = NULL; +static const char *pass_logfilename_prefix; static int video_sync_method = VSYNC_AUTO; static int audio_sync_method = 0; static float audio_drift_threshold = 0.1; static int copy_ts = 0; -static int copy_tb = 1; +static int copy_tb = -1; static int opt_shortest = 0; static char *vstats_filename; static FILE *vstats_file; @@ -128,6 +153,8 @@ static int audio_volume = 256; static int exit_on_error = 0; static int using_stdin = 0; +static int run_as_daemon = 0; +static volatile int received_nb_signals = 0; static int64_t video_size = 0; static int64_t audio_size = 0; static int64_t extra_size = 0; @@ -136,15 +163,18 @@ static int nb_frames_drop = 0; static int input_sync; static float dts_delta_threshold = 10; +static float dts_error_threshold = 3600*30; static int print_stats = 1; +static int debug_ts = 0; +static int current_time; static uint8_t *audio_buf; static unsigned int allocated_audio_buf_size; static uint8_t *async_buf; static unsigned int allocated_async_buf_size; -#define DEFAULT_PASS_LOGFILENAME_PREFIX "av2pass" +#define DEFAULT_PASS_LOGFILENAME_PREFIX "ffmpeg2pass" typedef struct InputFilter { AVFilterContext *filter; @@ -199,10 +229,13 @@ typedef struct InputStream { * several frames in a packet) of the next frame in current packet */ int64_t next_dts; /* dts of the last packet read for this stream */ - int64_t last_dts; - PtsCorrectionContext pts_ctx; + int64_t dts; + + int64_t next_pts; ///< synthetic pts for the next decode frame + int64_t pts; ///< current pts of the decoded frame double ts_scale; int is_start; /* is 1 at the start and after a discontinuity */ + int saw_first_ts; int showed_multi_packet_warning; AVDictionary *opts; @@ -212,6 +245,7 @@ typedef struct InputStream { /* a pool of free buffers for decoded data */ FrameBuffer *buffer_pool; + int dr1; /* decoded data from this stream goes into all those filters * currently video only */ @@ -222,10 +256,10 @@ typedef struct InputStream { typedef struct InputFile { AVFormatContext *ctx; int eof_reached; /* true if eof reached */ - int ist_index; /* index of first stream in ist_table */ + int ist_index; /* index of first stream in input_streams */ int buffer_size; /* current total buffer size */ int64_t ts_offset; - int nb_streams; /* number of stream that avconv is aware of; may be different + int nb_streams; /* number of stream that ffmpeg is aware of; may be different from ctx.nb_streams if new streams appear during av_read_frame() */ int rate_emu; } InputFile; @@ -239,12 +273,8 @@ typedef struct OutputStream { int frame_number; /* input pts and corresponding output pts for A/V sync */ - // double sync_ipts; /* dts from the AVPacket of the demuxer in second units */ struct InputStream *sync_ist; /* input stream to sync against */ int64_t sync_opts; /* output frame counter, could be changed to some true timestamp */ // FIXME look at frame_number - /* pts of the first frame encoded for this stream, used for limiting - * recording time */ - int64_t first_pts; AVBitStreamFilterContext *bitstream_filters; AVCodec *enc; int64_t max_frames; @@ -266,19 +296,23 @@ typedef struct OutputStream { /* audio only */ int audio_resample; - ReSampleContext *resample; /* for audio resampling */ + int audio_channels_map[SWR_CH_MAX]; ///< list of the channels id to pick from the source stream + int audio_channels_mapped; ///< number of channels in audio_channels_map int resample_sample_fmt; int resample_channels; int resample_sample_rate; - int reformat_pair; - AVAudioConvert *reformat_ctx; + float rematrix_volume; AVFifoBuffer *fifo; /* for compression: one audio fifo per codec */ FILE *logfile; + SwrContext *swr; + OutputFilter *filter; char *avfilter; int64_t sws_flags; + int64_t swr_dither_method; + double swr_dither_scale; AVDictionary *opts; int is_past_recording_time; int stream_copy; @@ -289,13 +323,20 @@ typedef struct OutputStream { } OutputStream; +#if HAVE_TERMIOS_H + +/* init terminal so that we can grab keys */ +static struct termios oldtty; +static int restore_tty; +#endif + typedef struct OutputFile { AVFormatContext *ctx; AVDictionary *opts; int ost_index; /* index of the first stream in output_streams */ int64_t recording_time; /* desired length of the resulting file in microseconds */ int64_t start_time; /* start time in microseconds */ - uint64_t limit_filesize; + uint64_t limit_filesize; /* filesize limit expressed in bytes */ } OutputFile; static InputStream **input_streams = NULL; @@ -322,6 +363,8 @@ typedef struct OptionsContext { int nb_audio_channels; SpecifierOpt *audio_sample_rate; int nb_audio_sample_rate; + SpecifierOpt *rematrix_volume; + int nb_rematrix_volume; SpecifierOpt *frame_rates; int nb_frame_rates; SpecifierOpt *frame_sizes; @@ -341,9 +384,8 @@ typedef struct OptionsContext { /* output options */ StreamMap *stream_maps; int nb_stream_maps; - /* first item specifies output metadata, second is input */ - MetadataMap (*meta_data_maps)[2]; - int nb_meta_data_maps; + AudioChannelMap *audio_channel_maps; ///< one info entry per -map_channel + int nb_audio_channel_maps; ///< number of (valid) -map_channel settings int metadata_global_manual; int metadata_streams_manual; int metadata_chapters_manual; @@ -414,9 +456,45 @@ typedef struct OptionsContext { }\ } -static void reset_options(OptionsContext *o) +static int64_t getutime(void) +{ +#if HAVE_GETRUSAGE + struct rusage rusage; + + getrusage(RUSAGE_SELF, &rusage); + return (rusage.ru_utime.tv_sec * 1000000LL) + rusage.ru_utime.tv_usec; +#elif HAVE_GETPROCESSTIMES + HANDLE proc; + FILETIME c, e, k, u; + proc = GetCurrentProcess(); + GetProcessTimes(proc, &c, &e, &k, &u); + return ((int64_t) u.dwHighDateTime << 32 | u.dwLowDateTime) / 10; +#else + return av_gettime(); +#endif +} + +static void update_benchmark(const char *fmt, ...) +{ + if (do_benchmark_all) { + int64_t t = getutime(); + va_list va; + char buf[1024]; + + if (fmt) { + va_start(va, fmt); + vsnprintf(buf, sizeof(buf), fmt, va); + va_end(va); + printf("bench: %8"PRIu64" %s \n", t - current_time, buf); + } + current_time = t; + } +} + +static void reset_options(OptionsContext *o, int is_input) { const OptionDef *po = options; + OptionsContext bak= *o; int i; /* all OPT_SPEC and OPT_STRING can be freed in generic way */ @@ -441,13 +519,14 @@ static void reset_options(OptionsContext *o) for (i = 0; i < o->nb_stream_maps; i++) av_freep(&o->stream_maps[i].linklabel); av_freep(&o->stream_maps); - av_freep(&o->meta_data_maps); + av_freep(&o->audio_channel_maps); av_freep(&o->streamid_map); memset(o, 0, sizeof(*o)); + if(is_input) o->recording_time = bak.recording_time; + else o->recording_time = INT64_MAX; o->mux_max_delay = 0.7; - o->recording_time = INT64_MAX; o->limit_filesize = UINT64_MAX; o->chapters_input_file = INT_MAX; @@ -489,7 +568,7 @@ static int alloc_buffer(InputStream *ist, AVCodecContext *s, FrameBuffer **pbuf) for (i = 0; i < FF_ARRAY_ELEMS(buf->data); i++) { const int h_shift = i==0 ? 0 : h_chroma_shift; const int v_shift = i==0 ? 0 : v_chroma_shift; - if (s->flags & CODEC_FLAG_EMU_EDGE) + if ((s->flags & CODEC_FLAG_EMU_EDGE) || !buf->linesize[1]) buf->data[i] = buf->base[i]; else buf->data[i] = buf->base[i] + @@ -518,9 +597,12 @@ static void free_buffer_pool(InputStream *ist) static void unref_buffer(InputStream *ist, FrameBuffer *buf) { - av_assert0(buf->refcount); + av_assert0(buf->refcount > 0); buf->refcount--; if (!buf->refcount) { + FrameBuffer *tmp; + for(tmp= ist->buffer_pool; tmp; tmp= tmp->next) + av_assert1(tmp != buf); buf->next = ist->buffer_pool; ist->buffer_pool = buf; } @@ -532,6 +614,9 @@ static int codec_get_buffer(AVCodecContext *s, AVFrame *frame) FrameBuffer *buf; int ret, i; + if(av_image_check_size(s->width, s->height, 0, s) || s->pix_fmt<0) + return -1; + if (!ist->buffer_pool && (ret = alloc_buffer(ist, s, &ist->buffer_pool)) < 0) return ret; @@ -544,6 +629,7 @@ static int codec_get_buffer(AVCodecContext *s, AVFrame *frame) if ((ret = alloc_buffer(ist, s, &buf)) < 0) return ret; } + av_assert0(!buf->refcount); buf->refcount++; frame->opaque = buf; @@ -570,6 +656,9 @@ static void codec_release_buffer(AVCodecContext *s, AVFrame *frame) FrameBuffer *buf = frame->opaque; int i; + if(frame->type!=FF_BUFFER_TYPE_USER) + return avcodec_default_release_buffer(s, frame); + for (i = 0; i < FF_ARRAY_ELEMS(frame->data); i++) frame->data[i] = NULL; @@ -583,14 +672,54 @@ static void filter_release_buffer(AVFilterBuffer *fb) unref_buffer(buf->ist, buf); } +static enum PixelFormat choose_pixel_fmt(AVStream *st, AVCodec *codec, enum PixelFormat target) +{ + if (codec && codec->pix_fmts) { + const enum PixelFormat *p = codec->pix_fmts; + int has_alpha= av_pix_fmt_descriptors[target].nb_components % 2 == 0; + enum PixelFormat best= PIX_FMT_NONE; + if (st->codec->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL) { + if (st->codec->codec_id == CODEC_ID_MJPEG) { + p = (const enum PixelFormat[]) { PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_NONE }; + } else if (st->codec->codec_id == CODEC_ID_LJPEG) { + p = (const enum PixelFormat[]) { PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ444P, PIX_FMT_YUV420P, + PIX_FMT_YUV422P, PIX_FMT_YUV444P, PIX_FMT_BGRA, PIX_FMT_NONE }; + } + } + for (; *p != PIX_FMT_NONE; p++) { + best= avcodec_find_best_pix_fmt2(best, *p, target, has_alpha, NULL); + if (*p == target) + break; + } + if (*p == PIX_FMT_NONE) { + if (target != PIX_FMT_NONE) + av_log(NULL, AV_LOG_WARNING, + "Incompatible pixel format '%s' for codec '%s', auto-selecting format '%s'\n", + av_pix_fmt_descriptors[target].name, + codec->name, + av_pix_fmt_descriptors[best].name); + return best; + } + } + return target; +} + static const enum PixelFormat *choose_pixel_fmts(OutputStream *ost) { if (ost->st->codec->pix_fmt != PIX_FMT_NONE) { - ost->pix_fmts[0] = ost->st->codec->pix_fmt; + ost->pix_fmts[0] = choose_pixel_fmt(ost->st, ost->enc, ost->st->codec->pix_fmt); return ost->pix_fmts; - } else if (ost->enc->pix_fmts) + } else if (ost->enc->pix_fmts) { + if (ost->st->codec->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL) { + if (ost->st->codec->codec_id == CODEC_ID_MJPEG) { + return (const enum PixelFormat[]) { PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_NONE }; + } else if (ost->st->codec->codec_id == CODEC_ID_LJPEG) { + return (const enum PixelFormat[]) { PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ444P, PIX_FMT_YUV420P, + PIX_FMT_YUV422P, PIX_FMT_YUV444P, PIX_FMT_BGRA, PIX_FMT_NONE }; + } + } return ost->enc->pix_fmts; - else + } else return NULL; } @@ -601,30 +730,42 @@ static int configure_video_filters(FilterGraph *fg) AVFilterContext *last_filter, *filter; /** filter graph containing all filters including input & output */ AVCodecContext *codec = ost->st->codec; - SinkContext sink_ctx = { .pix_fmts = choose_pixel_fmts(ost) }; + enum PixelFormat *pix_fmts = choose_pixel_fmts(ost); + AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc(); AVRational sample_aspect_ratio; char args[255]; int ret; avfilter_graph_free(&fg->graph); fg->graph = avfilter_graph_alloc(); + if (!fg->graph) + return AVERROR(ENOMEM); if (ist->st->sample_aspect_ratio.num) { sample_aspect_ratio = ist->st->sample_aspect_ratio; } else sample_aspect_ratio = ist->st->codec->sample_aspect_ratio; - snprintf(args, 255, "%d:%d:%d:%d:%d:%d:%d", ist->st->codec->width, + snprintf(args, 255, "%d:%d:%d:%d:%d:%d:%d:flags=%d", ist->st->codec->width, ist->st->codec->height, ist->st->codec->pix_fmt, 1, AV_TIME_BASE, - sample_aspect_ratio.num, sample_aspect_ratio.den); + sample_aspect_ratio.num, sample_aspect_ratio.den, SWS_BILINEAR + ((ist->st->codec->flags&CODEC_FLAG_BITEXACT) ? SWS_BITEXACT:0)); ret = avfilter_graph_create_filter(&fg->inputs[0]->filter, avfilter_get_by_name("buffer"), "src", args, NULL, fg->graph); if (ret < 0) return ret; - ret = avfilter_graph_create_filter(&fg->outputs[0]->filter, &sink, - "out", NULL, &sink_ctx, fg->graph); + +#if FF_API_OLD_VSINK_API + ret = avfilter_graph_create_filter(&fg->outputs[0]->filter, avfilter_get_by_name("buffersink"), + "out", NULL, pix_fmts, fg->graph); +#else + buffersink_params->pixel_fmts = pix_fmts; + ret = avfilter_graph_create_filter(&fg->outputs[0]->filter, avfilter_get_by_name("buffersink"), + "out", NULL, buffersink_params, fg->graph); +#endif + av_freep(&buffersink_params); + if (ret < 0) return ret; last_filter = fg->inputs[0]->filter; @@ -659,8 +800,9 @@ static int configure_video_filters(FilterGraph *fg) inputs->pad_idx = 0; inputs->next = NULL; - if ((ret = avfilter_graph_parse(fg->graph, ost->avfilter, inputs, outputs, NULL)) < 0) + if ((ret = avfilter_graph_parse(fg->graph, ost->avfilter, &inputs, &outputs, NULL)) < 0) return ret; + av_freep(&ost->avfilter); } else { if ((ret = avfilter_link(last_filter, 0, fg->outputs[0]->filter, 0)) < 0) return ret; @@ -726,7 +868,7 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in) int file_idx = strtol(in->name, &p, 0); if (file_idx < 0 || file_idx >= nb_input_files) { - av_log(NULL, AV_LOG_FATAL, "Invalid file index %d in filtegraph description %s.\n", + av_log(NULL, AV_LOG_FATAL, "Invalid file index %d in filtergraph description %s.\n", file_idx, fg->graph_desc); exit_program(1); } @@ -778,16 +920,23 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in) static int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out) { - SinkContext sink_ctx; AVCodecContext *codec = ofilter->ost->st->codec; AVFilterContext *last_filter = out->filter_ctx; int pad_idx = out->pad_idx; int ret; + enum PixelFormat *pix_fmts = choose_pixel_fmts(ofilter->ost); + AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc(); - sink_ctx.pix_fmts = choose_pixel_fmts(ofilter->ost); +#if FF_API_OLD_VSINK_API + ret = avfilter_graph_create_filter(&ofilter->filter, avfilter_get_by_name("buffersink"), + "out", NULL, pix_fmts, fg->graph); +#else + buffersink_params->pixel_fmts = pix_fmts; + ret = avfilter_graph_create_filter(&ofilter->filter, avfilter_get_by_name("buffersink"), + "out", NULL, buffersink_params, fg->graph); +#endif + av_freep(&buffersink_params); - ret = avfilter_graph_create_filter(&ofilter->filter, &sink, - "out", NULL, &sink_ctx, fg->graph); if (ret < 0) return ret; @@ -901,22 +1050,51 @@ static int ist_in_filtergraph(FilterGraph *fg, InputStream *ist) static void term_exit(void) { - av_log(NULL, AV_LOG_QUIET, ""); + av_log(NULL, AV_LOG_QUIET, "%s", ""); +#if HAVE_TERMIOS_H + if(restore_tty) + tcsetattr (0, TCSANOW, &oldtty); +#endif } static volatile int received_sigterm = 0; -static volatile int received_nb_signals = 0; -static void -sigterm_handler(int sig) +static void sigterm_handler(int sig) { received_sigterm = sig; received_nb_signals++; term_exit(); + if(received_nb_signals > 3) + exit(123); } static void term_init(void) { +#if HAVE_TERMIOS_H + if(!run_as_daemon){ + struct termios tty; + + if (tcgetattr (0, &tty) == 0) { + oldtty = tty; + restore_tty = 1; + atexit(term_exit); + + tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP + |INLCR|IGNCR|ICRNL|IXON); + tty.c_oflag |= OPOST; + tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN); + tty.c_cflag &= ~(CSIZE|PARENB); + tty.c_cflag |= CS8; + tty.c_cc[VMIN] = 1; + tty.c_cc[VTIME] = 0; + + tcsetattr (0, TCSANOW, &tty); + } + signal(SIGQUIT, sigterm_handler); /* Quit (POSIX). */ + } +#endif + avformat_network_deinit(); + signal(SIGINT , sigterm_handler); /* Interrupt (ANSI). */ signal(SIGTERM, sigterm_handler); /* Termination (ANSI). */ #ifdef SIGXCPU @@ -924,6 +1102,60 @@ static void term_init(void) #endif } +/* read a key without blocking */ +static int read_key(void) +{ + unsigned char ch; +#if HAVE_TERMIOS_H + int n = 1; + struct timeval tv; + fd_set rfds; + + FD_ZERO(&rfds); + FD_SET(0, &rfds); + tv.tv_sec = 0; + tv.tv_usec = 0; + n = select(1, &rfds, NULL, NULL, &tv); + if (n > 0) { + n = read(0, &ch, 1); + if (n == 1) + return ch; + + return n; + } +#elif HAVE_KBHIT +# if HAVE_PEEKNAMEDPIPE + static int is_pipe; + static HANDLE input_handle; + DWORD dw, nchars; + if(!input_handle){ + input_handle = GetStdHandle(STD_INPUT_HANDLE); + is_pipe = !GetConsoleMode(input_handle, &dw); + } + + if (stdin->_cnt > 0) { + read(0, &ch, 1); + return ch; + } + if (is_pipe) { + /* When running under a GUI, you will end here. */ + if (!PeekNamedPipe(input_handle, NULL, 0, NULL, &nchars, NULL)) + return -1; + //Read it + if(nchars != 0) { + read(0, &ch, 1); + return ch; + }else{ + return -1; + } + } +# endif + if(kbhit()) + return(getch()); +#endif + return -1; +} + static int decode_interrupt_cb(void *ctx) { return received_nb_signals > 1; @@ -931,7 +1163,7 @@ static int decode_interrupt_cb(void *ctx) static const AVIOInterruptCB int_cb = { decode_interrupt_cb, NULL }; -void exit_program(int ret) +void av_noreturn exit_program(int ret) { int i, j; @@ -971,8 +1203,6 @@ void exit_program(int ret) av_freep(&frame->extended_data); av_freep(&frame); } - - av_freep(&output_streams[i]->avfilter); av_freep(&output_streams[i]->filtered_frame); av_freep(&output_streams[i]); } @@ -998,9 +1228,9 @@ void exit_program(int ret) av_freep(&output_files); uninit_opts(); - av_free(audio_buf); + av_freep(&audio_buf); allocated_audio_buf_size = 0; - av_free(async_buf); + av_freep(&async_buf); allocated_async_buf_size = 0; avfilter_uninit(); @@ -1012,7 +1242,7 @@ void exit_program(int ret) exit (255); } - exit(ret); + exit(ret); /* not all OS-es handle main() return value */ } static void assert_avoptions(AVDictionary *m) @@ -1050,6 +1280,9 @@ static void choose_sample_fmt(AVStream *st, AVCodec *codec) break; } if (*p == -1) { + if((codec->capabilities & CODEC_CAP_LOSSLESS) && av_get_sample_fmt_name(st->codec->sample_fmt) > av_get_sample_fmt_name(codec->sample_fmts[0])) + av_log(NULL, AV_LOG_ERROR, "Conversion will not be lossless.\n"); + if(av_get_sample_fmt_name(st->codec->sample_fmt)) av_log(NULL, AV_LOG_WARNING, "Incompatible sample format '%s' for codec '%s', auto-selecting format '%s'\n", av_get_sample_fmt_name(st->codec->sample_fmt), @@ -1060,46 +1293,6 @@ static void choose_sample_fmt(AVStream *st, AVCodec *codec) } } -/** - * Update the requested input sample format based on the output sample format. - * This is currently only used to request float output from decoders which - * support multiple sample formats, one of which is AV_SAMPLE_FMT_FLT. - * Ideally this will be removed in the future when decoders do not do format - * conversion and only output in their native format. - */ -static void update_sample_fmt(AVCodecContext *dec, AVCodec *dec_codec, - AVCodecContext *enc) -{ - /* if sample formats match or a decoder sample format has already been - requested, just return */ - if (enc->sample_fmt == dec->sample_fmt || - dec->request_sample_fmt > AV_SAMPLE_FMT_NONE) - return; - - /* if decoder supports more than one output format */ - if (dec_codec && dec_codec->sample_fmts && - dec_codec->sample_fmts[0] != AV_SAMPLE_FMT_NONE && - dec_codec->sample_fmts[1] != AV_SAMPLE_FMT_NONE) { - const enum AVSampleFormat *p; - int min_dec = -1, min_inc = -1; - - /* find a matching sample format in the encoder */ - for (p = dec_codec->sample_fmts; *p != AV_SAMPLE_FMT_NONE; p++) { - if (*p == enc->sample_fmt) { - dec->request_sample_fmt = *p; - return; - } else if (*p > enc->sample_fmt) { - min_inc = FFMIN(min_inc, *p - enc->sample_fmt); - } else - min_dec = FFMIN(min_dec, enc->sample_fmt - *p); - } - - /* if none match, provide the one that matches quality closest */ - dec->request_sample_fmt = min_inc > 0 ? enc->sample_fmt + min_inc : - enc->sample_fmt - min_dec; - } -} - static void choose_sample_rate(AVStream *st, AVCodec *codec) { if (codec && codec->supported_samplerates) { @@ -1114,7 +1307,18 @@ static void choose_sample_rate(AVStream *st, AVCodec *codec) } } if (best_dist) { - av_log(st->codec, AV_LOG_WARNING, "Requested sampling rate unsupported using closest supported (%d)\n", best); + int i; + const int *sample_rates = codec->supported_samplerates; + av_log(st->codec, AV_LOG_WARNING, + "Requested sampling rate (%dHz) unsupported, using %dHz instead\n" + "Available sampling rates for %s:", + st->codec->sample_rate, best, codec->name); + for (i = 0; sample_rates[i]; i++) { + if (!sample_rates[i + 1]) av_log(st->codec, AV_LOG_WARNING, " and"); + else if (i) av_log(st->codec, AV_LOG_WARNING, ","); + av_log(st->codec, AV_LOG_WARNING, " %d", sample_rates[i]); + } + av_log(st->codec, AV_LOG_WARNING, ".\n"); } st->codec->sample_rate = best; } @@ -1133,6 +1337,10 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost) AVCodecContext *avctx = ost->st->codec; int ret; + if ((avctx->codec_type == AVMEDIA_TYPE_VIDEO && video_sync_method == VSYNC_DROP) || + (avctx->codec_type == AVMEDIA_TYPE_AUDIO && audio_sync_method < 0)) + pkt->pts = pkt->dts = AV_NOPTS_VALUE; + /* * Audio encoders may split the packets -- #frames in != #packets out. * But there is no reordering, so we can limit the number of output packets @@ -1158,7 +1366,7 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost) av_free_packet(pkt); new_pkt.destruct = av_destruct_packet; } else if (a < 0) { - av_log(NULL, AV_LOG_ERROR, "%s failed for stream %d, codec %s", + av_log(NULL, AV_LOG_ERROR, "Failed to open bitstream filter %s for stream %d with codec %s", bsfc->filter->name, pkt->stream_index, avctx->codec ? avctx->codec->name : "copy"); print_error("", a); @@ -1178,19 +1386,6 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost) } } -static int check_recording_time(OutputStream *ost) -{ - OutputFile *of = output_files[ost->file_index]; - - if (of->recording_time != INT64_MAX && - av_compare_ts(ost->sync_opts - ost->first_pts, ost->st->codec->time_base, of->recording_time, - AV_TIME_BASE_Q) >= 0) { - ost->is_past_recording_time = 1; - return 0; - } - return 1; -} - static void get_default_channel_layouts(OutputStream *ost, InputStream *ist) { char layout_name[256]; @@ -1263,7 +1458,7 @@ static int encode_audio_frame(AVFormatContext *s, OutputStream *ost, pkt.data = NULL; pkt.size = 0; - if (buf) { + if (buf && buf_size) { if (!ost->output_frame) { ost->output_frame = avcodec_alloc_frame(); if (!ost->output_frame) { @@ -1280,37 +1475,53 @@ static int encode_audio_frame(AVFormatContext *s, OutputStream *ost, (enc->channels * av_get_bytes_per_sample(enc->sample_fmt)); if ((ret = avcodec_fill_audio_frame(frame, enc->channels, enc->sample_fmt, buf, buf_size, 1)) < 0) { - av_log(NULL, AV_LOG_FATAL, "Audio encoding failed\n"); + av_log(NULL, AV_LOG_FATAL, "Audio encoding failed (avcodec_fill_audio_frame)\n"); exit_program(1); } - if (!check_recording_time(ost)) - return 0; - frame->pts = ost->sync_opts; ost->sync_opts += frame->nb_samples; } got_packet = 0; + update_benchmark(NULL); if (avcodec_encode_audio2(enc, &pkt, frame, &got_packet) < 0) { - av_log(NULL, AV_LOG_FATAL, "Audio encoding failed\n"); + av_log(NULL, AV_LOG_FATAL, "Audio encoding failed (avcodec_encode_audio2)\n"); exit_program(1); } + update_benchmark("encode_audio %d.%d", ost->file_index, ost->index); + + ret = pkt.size; if (got_packet) { if (pkt.pts != AV_NOPTS_VALUE) pkt.pts = av_rescale_q(pkt.pts, enc->time_base, ost->st->time_base); - if (pkt.dts != AV_NOPTS_VALUE) + if (pkt.dts != AV_NOPTS_VALUE) { + int64_t max = ost->st->cur_dts + !(s->oformat->flags & AVFMT_TS_NONSTRICT); pkt.dts = av_rescale_q(pkt.dts, enc->time_base, ost->st->time_base); + if (ost->st->cur_dts && ost->st->cur_dts != AV_NOPTS_VALUE && max > pkt.dts) { + av_log(s, max - pkt.dts > 2 ? AV_LOG_WARNING : AV_LOG_DEBUG, "Audio timestamp %"PRId64" < %"PRId64" invalid, cliping\n", pkt.dts, max); + pkt.pts = pkt.dts = max; + } + } if (pkt.duration > 0) pkt.duration = av_rescale_q(pkt.duration, enc->time_base, ost->st->time_base); write_frame(s, &pkt, ost); audio_size += pkt.size; + + av_free_packet(&pkt); + } + + if (debug_ts) { + av_log(NULL, AV_LOG_INFO, "encoder -> type:audio " + "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s\n", + av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &ost->st->time_base), + av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ost->st->time_base)); } - return pkt.size; + return ret; } static int alloc_audio_output_buf(AVCodecContext *dec, AVCodecContext *enc, @@ -1322,7 +1533,7 @@ static int alloc_audio_output_buf(AVCodecContext *dec, AVCodecContext *enc, /* calculate required number of samples to allocate */ audio_buf_samples = ((int64_t)nb_samples * enc->sample_rate + dec->sample_rate) / dec->sample_rate; - audio_buf_samples = 4 * audio_buf_samples + 16; // safety factors for resampling + audio_buf_samples = 4 * audio_buf_samples + 10000; // safety factors for resampling audio_buf_samples = FFMAX(audio_buf_samples, enc->frame_size); if (audio_buf_samples > INT_MAX) return AVERROR(EINVAL); @@ -1344,14 +1555,22 @@ static void do_audio_out(AVFormatContext *s, OutputStream *ost, InputStream *ist, AVFrame *decoded_frame) { uint8_t *buftmp; + int64_t size_out; - int size_out, frame_bytes, resample_changed; + int frame_bytes, resample_changed; AVCodecContext *enc = ost->st->codec; AVCodecContext *dec = ist->st->codec; int osize = av_get_bytes_per_sample(enc->sample_fmt); int isize = av_get_bytes_per_sample(dec->sample_fmt); - uint8_t *buf = decoded_frame->data[0]; + uint8_t *buf[AV_NUM_DATA_POINTERS]; int size = decoded_frame->nb_samples * dec->channels * isize; + int planes = av_sample_fmt_is_planar(dec->sample_fmt) ? dec->channels : 1; + int i; + + av_assert0(planes <= AV_NUM_DATA_POINTERS); + + for(i=0; idata[i]; get_default_channel_layouts(ost, ist); @@ -1360,14 +1579,17 @@ static void do_audio_out(AVFormatContext *s, OutputStream *ost, exit_program(1); } - if (enc->channels != dec->channels || enc->sample_rate != dec->sample_rate) + if (enc->channels != dec->channels + || enc->sample_fmt != dec->sample_fmt + || enc->sample_rate!= dec->sample_rate + ) ost->audio_resample = 1; resample_changed = ost->resample_sample_fmt != dec->sample_fmt || ost->resample_channels != dec->channels || ost->resample_sample_rate != dec->sample_rate; - if ((ost->audio_resample && !ost->resample) || resample_changed) { + if ((ost->audio_resample && !ost->swr) || resample_changed || ost->audio_channels_mapped) { if (resample_changed) { av_log(NULL, AV_LOG_INFO, "Input stream #%d:%d frame changed from rate:%d fmt:%s ch:%d to rate:%d fmt:%s ch:%d\n", ist->file_index, ist->st->index, @@ -1376,50 +1598,56 @@ static void do_audio_out(AVFormatContext *s, OutputStream *ost, ost->resample_sample_fmt = dec->sample_fmt; ost->resample_channels = dec->channels; ost->resample_sample_rate = dec->sample_rate; - if (ost->resample) - audio_resample_close(ost->resample); + swr_free(&ost->swr); } /* if audio_sync_method is >1 the resampler is needed for audio drift compensation */ - if (audio_sync_method <= 1 && + if (audio_sync_method <= 1 && !ost->audio_channels_mapped && ost->resample_sample_fmt == enc->sample_fmt && ost->resample_channels == enc->channels && ost->resample_sample_rate == enc->sample_rate) { - ost->resample = NULL; + //ost->swr = NULL; ost->audio_resample = 0; - } else if (ost->audio_resample) { - if (dec->sample_fmt != AV_SAMPLE_FMT_S16) - av_log(NULL, AV_LOG_WARNING, "Using s16 intermediate sample format for resampling\n"); - ost->resample = av_audio_resample_init(enc->channels, dec->channels, - enc->sample_rate, dec->sample_rate, - enc->sample_fmt, dec->sample_fmt, - 16, 10, 0, 0.8); - if (!ost->resample) { + } else { + ost->swr = swr_alloc_set_opts(ost->swr, + enc->channel_layout, enc->sample_fmt, enc->sample_rate, + dec->channel_layout, dec->sample_fmt, dec->sample_rate, + 0, NULL); + av_opt_set_int(ost->swr, "dither_method", ost->swr_dither_method,0); + av_opt_set_int(ost->swr, "dither_scale", ost->swr_dither_scale,0); + if (ost->audio_channels_mapped) + swr_set_channel_mapping(ost->swr, ost->audio_channels_map); + av_opt_set_double(ost->swr, "rmvol", ost->rematrix_volume, 0); + if (ost->audio_channels_mapped) { + av_opt_set_int(ost->swr, "icl", av_get_default_channel_layout(ost->audio_channels_mapped), 0); + av_opt_set_int(ost->swr, "uch", ost->audio_channels_mapped, 0); + } + if (av_opt_set_int(ost->swr, "ich", dec->channels, 0) < 0) { + av_log(NULL, AV_LOG_FATAL, "Unsupported number of input channels\n"); + exit_program(1); + } + if (av_opt_set_int(ost->swr, "och", enc->channels, 0) < 0) { + av_log(NULL, AV_LOG_FATAL, "Unsupported number of output channels\n"); + exit_program(1); + } + if(audio_sync_method>1) av_opt_set_int(ost->swr, "flags", SWR_FLAG_RESAMPLE, 0); + if(ost->swr && swr_init(ost->swr) < 0){ + av_log(NULL, AV_LOG_FATAL, "swr_init() failed\n"); + swr_free(&ost->swr); + } + + if (!ost->swr) { av_log(NULL, AV_LOG_FATAL, "Can not resample %d channels @ %d Hz to %d channels @ %d Hz\n", - dec->channels, dec->sample_rate, - enc->channels, enc->sample_rate); + dec->channels, dec->sample_rate, + enc->channels, enc->sample_rate); exit_program(1); } } } -#define MAKE_SFMT_PAIR(a,b) ((a)+AV_SAMPLE_FMT_NB*(b)) - if (!ost->audio_resample && dec->sample_fmt != enc->sample_fmt && - MAKE_SFMT_PAIR(enc->sample_fmt,dec->sample_fmt) != ost->reformat_pair) { - if (ost->reformat_ctx) - av_audio_convert_free(ost->reformat_ctx); - ost->reformat_ctx = av_audio_convert_alloc(enc->sample_fmt, 1, - dec->sample_fmt, 1, NULL, 0); - if (!ost->reformat_ctx) { - av_log(NULL, AV_LOG_FATAL, "Cannot convert %s sample format to %s sample format\n", - av_get_sample_fmt_name(dec->sample_fmt), - av_get_sample_fmt_name(enc->sample_fmt)); - exit_program(1); - } - ost->reformat_pair = MAKE_SFMT_PAIR(enc->sample_fmt,dec->sample_fmt); - } + av_assert0(ost->audio_resample || dec->sample_fmt==enc->sample_fmt); if (audio_sync_method > 0) { - double delta = get_sync_ipts(ost, ist->last_dts) * enc->sample_rate - ost->sync_opts - + double delta = get_sync_ipts(ost, ist->pts) * enc->sample_rate - ost->sync_opts - av_fifo_size(ost->fifo) / (enc->channels * osize); int idelta = delta * dec->sample_rate / enc->sample_rate; int byte_delta = idelta * isize * dec->channels; @@ -1430,7 +1658,8 @@ static void do_audio_out(AVFormatContext *s, OutputStream *ost, if (byte_delta < 0) { byte_delta = FFMAX(byte_delta, -size); size += byte_delta; - buf -= byte_delta; + for (i=0; ichannels)); if (!size) @@ -1450,9 +1679,12 @@ static void do_audio_out(AVFormatContext *s, OutputStream *ost, } ist->is_start = 0; - generate_silence(async_buf, dec->sample_fmt, byte_delta); - memcpy(async_buf + byte_delta, buf, size); - buf = async_buf; + for (i=0; isample_fmt, byte_delta/planes); + memcpy(t + byte_delta/planes, buf[i], size/planes); + buf[i] = t; + } size += byte_delta; av_log(NULL, AV_LOG_VERBOSE, "adding %d audio samples of silence\n", idelta); } @@ -1462,39 +1694,28 @@ static void do_audio_out(AVFormatContext *s, OutputStream *ost, av_log(NULL, AV_LOG_VERBOSE, "compensating audio timestamp drift:%f compensation:%d in:%d\n", delta, comp, enc->sample_rate); // fprintf(stderr, "drift:%f len:%d opts:%"PRId64" ipts:%"PRId64" fifo:%d\n", delta, -1, ost->sync_opts, (int64_t)(get_sync_ipts(ost) * enc->sample_rate), av_fifo_size(ost->fifo)/(ost->st->codec->channels * 2)); - av_resample_compensate(*(struct AVResampleContext**)ost->resample, comp, enc->sample_rate); + swr_set_compensation(ost->swr, comp, enc->sample_rate); } } } else if (audio_sync_method == 0) - ost->sync_opts = lrintf(get_sync_ipts(ost, ist->last_dts) * enc->sample_rate) - + ost->sync_opts = lrintf(get_sync_ipts(ost, ist->pts) * enc->sample_rate) - av_fifo_size(ost->fifo) / (enc->channels * osize); // FIXME wrong - if (ost->audio_resample) { + if (ost->audio_resample || ost->audio_channels_mapped) { buftmp = audio_buf; - size_out = audio_resample(ost->resample, - (short *)buftmp, (short *)buf, - size / (dec->channels * isize)); + size_out = swr_convert(ost->swr, ( uint8_t*[]){buftmp}, allocated_audio_buf_size / (enc->channels * osize), + buf, size / (dec->channels * isize)); + if (size_out < 0) { + av_log(NULL, AV_LOG_FATAL, "swr_convert failed\n"); + exit_program(1); + } size_out = size_out * enc->channels * osize; } else { - buftmp = buf; + buftmp = buf[0]; size_out = size; } - if (!ost->audio_resample && dec->sample_fmt != enc->sample_fmt) { - const void *ibuf[6] = { buftmp }; - void *obuf[6] = { audio_buf }; - int istride[6] = { isize }; - int ostride[6] = { osize }; - int len = size_out / istride[0]; - if (av_audio_convert(ost->reformat_ctx, obuf, ostride, ibuf, istride, len) < 0) { - printf("av_audio_convert() failed\n"); - if (exit_on_error) - exit_program(1); - return; - } - buftmp = audio_buf; - size_out = len * osize; - } + av_assert0(ost->audio_resample || dec->sample_fmt==enc->sample_fmt); /* now encode as many frames as possible */ if (!(enc->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE)) { @@ -1590,8 +1811,6 @@ static void do_subtitle_out(AVFormatContext *s, for (i = 0; i < nb; i++) { ost->sync_opts = av_rescale_q(pts, ist->st->time_base, enc->time_base); - if (!check_recording_time(ost)) - return; sub->pts = av_rescale_q(pts, ist->st->time_base, AV_TIME_BASE_Q); // start_display_time is required to be 0 @@ -1621,29 +1840,83 @@ static void do_subtitle_out(AVFormatContext *s, } } -static void do_video_out(AVFormatContext *s, - OutputStream *ost, - AVFrame *in_picture, - int *frame_size, float quality) +static double psnr(double d) +{ + return -10.0 * log(d) / log(10.0); +} + +static void do_video_stats(AVFormatContext *os, OutputStream *ost, + int frame_size) +{ + AVCodecContext *enc; + int frame_number; + double ti1, bitrate, avg_bitrate; + + /* this is executed just the first time do_video_stats is called */ + if (!vstats_file) { + vstats_file = fopen(vstats_filename, "w"); + if (!vstats_file) { + perror("fopen"); + exit_program(1); + } + } + + enc = ost->st->codec; + if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { + frame_number = ost->frame_number; + fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality / (float)FF_QP2LAMBDA); + if (enc->flags&CODEC_FLAG_PSNR) + fprintf(vstats_file, "PSNR= %6.2f ", psnr(enc->coded_frame->error[0] / (enc->width * enc->height * 255.0 * 255.0))); + + fprintf(vstats_file,"f_size= %6d ", frame_size); + /* compute pts value */ + ti1 = ost->sync_opts * av_q2d(enc->time_base); + if (ti1 < 0.01) + ti1 = 0.01; + + bitrate = (frame_size * 8) / av_q2d(enc->time_base) / 1000.0; + avg_bitrate = (double)(video_size * 8) / ti1 / 1000.0; + fprintf(vstats_file, "s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ", + (double)video_size / 1024, ti1, bitrate, avg_bitrate); + fprintf(vstats_file, "type= %c\n", av_get_picture_type_char(enc->coded_frame->pict_type)); + } +} + + +static void do_video_out(AVFormatContext *s, OutputStream *ost, + AVFrame *in_picture, float quality) { int nb_frames, i, ret, format_video_sync; AVCodecContext *enc; double sync_ipts, delta; + double duration = 0; + int frame_size = 0; + InputStream *ist = NULL; + + if (ost->source_index >= 0) + ist = input_streams[ost->source_index]; enc = ost->st->codec; + if (ist && ist->st->start_time != AV_NOPTS_VALUE && ist->st->first_dts != AV_NOPTS_VALUE) { + duration = FFMAX(av_q2d(ist->st->time_base), av_q2d(ist->st->codec->time_base)); + if(ist->st->r_frame_rate.num) + duration= FFMAX(duration, 1/av_q2d(ist->st->r_frame_rate)); + if(ist->st->avg_frame_rate.num && 0) + duration= FFMAX(duration, 1/av_q2d(ist->st->avg_frame_rate)); + + duration /= av_q2d(enc->time_base); + } + sync_ipts = get_sync_ipts(ost, in_picture->pts) / av_q2d(enc->time_base); - delta = sync_ipts - ost->sync_opts; + delta = sync_ipts - ost->sync_opts + duration; /* by default, we output a single frame */ nb_frames = 1; - *frame_size = 0; - format_video_sync = video_sync_method; if (format_video_sync == VSYNC_AUTO) - format_video_sync = (s->oformat->flags & AVFMT_NOTIMESTAMPS) ? VSYNC_PASSTHROUGH : - (s->oformat->flags & AVFMT_VARIABLE_FPS) ? VSYNC_VFR : VSYNC_CFR; + format_video_sync = (s->oformat->flags & AVFMT_VARIABLE_FPS) ? ((s->oformat->flags & AVFMT_NOTIMESTAMPS) ? VSYNC_PASSTHROUGH : VSYNC_VFR) : 1; switch (format_video_sync) { case VSYNC_CFR: @@ -1659,6 +1932,7 @@ static void do_video_out(AVFormatContext *s, else if (delta > 0.6) ost->sync_opts = lrintf(sync_ipts); break; + case VSYNC_DROP: case VSYNC_PASSTHROUGH: ost->sync_opts = lrintf(sync_ipts); break; @@ -1676,9 +1950,6 @@ static void do_video_out(AVFormatContext *s, av_log(NULL, AV_LOG_VERBOSE, "*** %d dup!\n", nb_frames - 1); } - if (!ost->frame_number) - ost->first_pts = ost->sync_opts; - /* duplicates frame if needed */ for (i = 0; i < nb_frames; i++) { AVPacket pkt; @@ -1686,9 +1957,6 @@ static void do_video_out(AVFormatContext *s, pkt.data = NULL; pkt.size = 0; - if (!check_recording_time(ost)) - return; - if (s->oformat->flags & AVFMT_RAWPICTURE && enc->codec->id == CODEC_ID_RAWVIDEO) { /* raw pictures are written as AVPicture structure to @@ -1728,21 +1996,34 @@ static void do_video_out(AVFormatContext *s, big_picture.pict_type = AV_PICTURE_TYPE_I; ost->forced_kf_index++; } + update_benchmark(NULL); ret = avcodec_encode_video2(enc, &pkt, &big_picture, &got_packet); + update_benchmark("encode_video %d.%d", ost->file_index, ost->index); if (ret < 0) { av_log(NULL, AV_LOG_FATAL, "Video encoding failed\n"); exit_program(1); } if (got_packet) { + if (pkt.pts == AV_NOPTS_VALUE && !(enc->codec->capabilities & CODEC_CAP_DELAY)) + pkt.pts = ost->sync_opts; + if (pkt.pts != AV_NOPTS_VALUE) pkt.pts = av_rescale_q(pkt.pts, enc->time_base, ost->st->time_base); if (pkt.dts != AV_NOPTS_VALUE) pkt.dts = av_rescale_q(pkt.dts, enc->time_base, ost->st->time_base); + if (debug_ts) { + av_log(NULL, AV_LOG_INFO, "encoder -> type:video " + "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s\n", + av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &ost->st->time_base), + av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ost->st->time_base)); + } + write_frame(s, &pkt, ost); - *frame_size = pkt.size; + frame_size = pkt.size; video_size += pkt.size; + av_free_packet(&pkt); /* if two pass, output log */ if (ost->logfile && enc->stats_out) { @@ -1758,48 +2039,8 @@ static void do_video_out(AVFormatContext *s, */ ost->frame_number++; } -} - -static double psnr(double d) -{ - return -10.0 * log(d) / log(10.0); -} - -static void do_video_stats(AVFormatContext *os, OutputStream *ost, - int frame_size) -{ - AVCodecContext *enc; - int frame_number; - double ti1, bitrate, avg_bitrate; - - /* this is executed just the first time do_video_stats is called */ - if (!vstats_file) { - vstats_file = fopen(vstats_filename, "w"); - if (!vstats_file) { - perror("fopen"); - exit_program(1); - } - } - - enc = ost->st->codec; - if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { - frame_number = ost->frame_number; - fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality / (float)FF_QP2LAMBDA); - if (enc->flags&CODEC_FLAG_PSNR) - fprintf(vstats_file, "PSNR= %6.2f ", psnr(enc->coded_frame->error[0] / (enc->width * enc->height * 255.0 * 255.0))); - - fprintf(vstats_file,"f_size= %6d ", frame_size); - /* compute pts value */ - ti1 = ost->sync_opts * av_q2d(enc->time_base); - if (ti1 < 0.01) - ti1 = 0.01; - - bitrate = (frame_size * 8) / av_q2d(enc->time_base) / 1000.0; - avg_bitrate = (double)(video_size * 8) / ti1 / 1000.0; - fprintf(vstats_file, "s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ", - (double)video_size / 1024, ti1, bitrate, avg_bitrate); - fprintf(vstats_file, "type= %c\n", av_get_picture_type_char(enc->coded_frame->pict_type)); - } + if (vstats_filename && frame_size) + do_video_stats(output_files[ost->file_index]->ctx, ost, frame_size); } /* check for new output on any of the filtergraphs */ @@ -1807,8 +2048,12 @@ static int poll_filters(void) { AVFilterBufferRef *picref; AVFrame *filtered_frame = NULL; - int i, frame_size, ret; + int i, ret, ret_all; + unsigned nb_success, nb_eof; + while (1) { + /* Reap all buffers present in the buffer sinks */ + /* TODO reindent */ for (i = 0; i < nb_output_streams; i++) { OutputStream *ost = output_streams[i]; OutputFile *of = output_files[ost->file_index]; @@ -1822,27 +2067,35 @@ static int poll_filters(void) avcodec_get_frame_defaults(ost->filtered_frame); filtered_frame = ost->filtered_frame; - while (avfilter_poll_frame(ost->filter->filter->inputs[0])) { - AVRational ist_pts_tb; - if ((ret = get_filtered_video_frame(ost->filter->filter, - filtered_frame, &picref, - &ist_pts_tb)) < 0) - return ret; + while (1) { + AVRational ist_pts_tb = ost->filter->filter->inputs[0]->time_base; + ret = av_buffersink_get_buffer_ref(ost->filter->filter, &picref, + AV_BUFFERSINK_FLAG_NO_REQUEST); + if (ret < 0) { + if (ret != AVERROR(EAGAIN)) { + char buf[256]; + av_strerror(ret, buf, sizeof(buf)); + av_log(NULL, AV_LOG_WARNING, + "Error in av_buffersink_get_buffer_ref(): %s\n", buf); + } + break; + } filtered_frame->pts = av_rescale_q(picref->pts, ist_pts_tb, AV_TIME_BASE_Q); +// if (ost->source_index >= 0) +// *filtered_frame= *input_streams[ost->source_index]->decoded_frame; //for me_threshold if (of->start_time && filtered_frame->pts < of->start_time) return 0; switch (ost->filter->filter->inputs[0]->type) { case AVMEDIA_TYPE_VIDEO: + avfilter_fill_frame_from_video_buffer_ref(filtered_frame, picref); if (!ost->frame_aspect_ratio) - ost->st->codec->sample_aspect_ratio = picref->video->pixel_aspect; + ost->st->codec->sample_aspect_ratio = picref->video->sample_aspect_ratio; - do_video_out(of->ctx, ost, filtered_frame, &frame_size, + do_video_out(of->ctx, ost, filtered_frame, same_quant ? ost->last_quality : ost->st->codec->global_quality); - if (vstats_filename && frame_size) - do_video_stats(of->ctx, ost, frame_size); break; default: // TODO support audio/subtitle filters @@ -1852,10 +2105,30 @@ static int poll_filters(void) avfilter_unref_buffer(picref); } } - return 0; + /* Request frames through all the graphs */ + ret_all = nb_success = nb_eof = 0; + for (i = 0; i < nb_filtergraphs; i++) { + ret = avfilter_graph_request_oldest(filtergraphs[i]->graph); + if (!ret) { + nb_success++; + } else if (ret == AVERROR_EOF) { + nb_eof++; + } else if (ret != AVERROR(EAGAIN)) { + char buf[256]; + av_strerror(ret, buf, sizeof(buf)); + av_log(NULL, AV_LOG_WARNING, + "Error in request_frame(): %s\n", buf); + ret_all = ret; + } + } + if (!nb_success) + break; + /* Try again if anything succeeded */ + } + return nb_eof == nb_filtergraphs ? AVERROR_EOF : ret_all; } -static void print_report(int is_last_report, int64_t timer_start) +static void print_report(int is_last_report, int64_t timer_start, int64_t cur_time) { char buf[1024]; OutputStream *ost; @@ -1863,17 +2136,16 @@ static void print_report(int is_last_report, int64_t timer_start) int64_t total_size; AVCodecContext *enc; int frame_number, vid, i; - double bitrate, ti1, pts; + double bitrate; + int64_t pts = INT64_MAX; static int64_t last_time = -1; static int qp_histogram[52]; + int hours, mins, secs, us; if (!print_stats && !is_last_report) return; if (!is_last_report) { - int64_t cur_time; - /* display the report every 0.5 seconds */ - cur_time = av_gettime(); if (last_time == -1) { last_time = cur_time; return; @@ -1887,11 +2159,13 @@ static void print_report(int is_last_report, int64_t timer_start) oc = output_files[0]->ctx; total_size = avio_size(oc->pb); - if (total_size < 0) // FIXME improve avio_size() so it works with non seekable output too + if (total_size < 0) { // FIXME improve avio_size() so it works with non seekable output too total_size = avio_tell(oc->pb); + if (total_size < 0) + total_size = 0; + } buf[0] = '\0'; - ti1 = 1e10; vid = 0; for (i = 0; i < nb_output_streams; i++) { float q = -1; @@ -1903,11 +2177,12 @@ static void print_report(int is_last_report, int64_t timer_start) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "q=%2.1f ", q); } if (!vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { - float t = (av_gettime() - timer_start) / 1000000.0; + float fps, t = (cur_time-timer_start) / 1000000.0; frame_number = ost->frame_number; - snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "frame=%5d fps=%3d q=%3.1f ", - frame_number, (t > 1) ? (int)(frame_number / t + 0.5) : 0, q); + fps = t > 1 ? frame_number / t : 0; + snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "frame=%5d fps=%3.*f q=%3.1f ", + frame_number, fps < 9.95, fps, q); if (is_last_report) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "L"); if (qp_hist) { @@ -1943,18 +2218,26 @@ static void print_report(int is_last_report, int64_t timer_start) vid = 1; } /* compute min output value */ - pts = (double)ost->st->pts.val * av_q2d(ost->st->time_base); - if ((pts < ti1) && (pts > 0)) - ti1 = pts; + pts = FFMIN(pts, av_rescale_q(ost->st->pts.val, + ost->st->time_base, AV_TIME_BASE_Q)); } - if (ti1 < 0.01) - ti1 = 0.01; - bitrate = (double)(total_size * 8) / ti1 / 1000.0; + secs = pts / AV_TIME_BASE; + us = pts % AV_TIME_BASE; + mins = secs / 60; + secs %= 60; + hours = mins / 60; + mins %= 60; + bitrate = pts ? total_size * 8 / (pts / 1000.0) : 0; + + snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), + "size=%8.0fkB time=", total_size / 1024.0); snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), - "size=%8.0fkB time=%0.2f bitrate=%6.1fkbits/s", - (double)total_size / 1024, ti1, bitrate); + "%02d:%02d:%02d.%02d ", hours, mins, secs, + (100 * us) / AV_TIME_BASE); + snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), + "bitrate=%6.1fkbits/s", bitrate); if (nb_frames_dup || nb_frames_drop) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " dup=%d drop=%d", @@ -1973,6 +2256,9 @@ static void print_report(int is_last_report, int64_t timer_start) extra_size / 1024.0, 100.0 * (total_size - raw) / raw ); + if(video_size + audio_size + extra_size == 0){ + av_log(NULL, AV_LOG_WARNING, "Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)\n"); + } } } @@ -2029,12 +2315,14 @@ static void flush_encoders(void) } break; case AVMEDIA_TYPE_VIDEO: + update_benchmark(NULL); ret = avcodec_encode_video2(enc, &pkt, NULL, &got_packet); + update_benchmark("encode_video %d.%d", ost->file_index, ost->index); if (ret < 0) { av_log(NULL, AV_LOG_FATAL, "Video encoding failed\n"); exit_program(1); } - video_size += ret; + video_size += pkt.size; if (ost->logfile && enc->stats_out) { fprintf(ost->logfile, "%s", enc->stats_out); } @@ -2068,8 +2356,15 @@ static int check_output_constraints(InputStream *ist, OutputStream *ost) if (ost->source_index != ist_index) return 0; - if (of->start_time && ist->last_dts < of->start_time) + if (of->start_time && ist->pts < of->start_time) + return 0; + + if (of->recording_time != INT64_MAX && + av_compare_ts(ist->pts, AV_TIME_BASE_Q, of->recording_time + of->start_time, + (AVRational){ 1, 1000000 }) >= 0) { + ost->is_past_recording_time = 1; return 0; + } return 1; } @@ -2078,6 +2373,7 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p { OutputFile *of = output_files[ost->file_index]; int64_t ost_tb_start_time = av_rescale_q(of->start_time, AV_TIME_BASE_Q, ost->st->time_base); + AVPicture pict; AVPacket opkt; av_init_packet(&opkt); @@ -2086,12 +2382,6 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p !ost->copy_initial_nonkeyframes) return; - if (of->recording_time != INT64_MAX && - ist->last_dts >= of->recording_time + of->start_time) { - ost->is_past_recording_time = 1; - return; - } - /* force the input stream PTS */ if (ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) audio_size += pkt->size; @@ -2106,7 +2396,7 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p opkt.pts = AV_NOPTS_VALUE; if (pkt->dts == AV_NOPTS_VALUE) - opkt.dts = av_rescale_q(ist->last_dts, AV_TIME_BASE_Q, ost->st->time_base); + opkt.dts = av_rescale_q(ist->dts, AV_TIME_BASE_Q, ost->st->time_base); else opkt.dts = av_rescale_q(pkt->dts, ist->st->time_base, ost->st->time_base); opkt.dts -= ost_tb_start_time; @@ -2126,6 +2416,13 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p opkt.data = pkt->data; opkt.size = pkt->size; } + if (of->ctx->oformat->flags & AVFMT_RAWPICTURE) { + /* store AVPicture in AVPacket, as expected by the output format */ + avpicture_fill(&pict, opkt.data, ost->st->codec->pix_fmt, ost->st->codec->width, ost->st->codec->height); + opkt.data = (uint8_t *)&pict; + opkt.size = sizeof(AVPicture); + opkt.flags |= AV_PKT_FLAG_KEY; + } write_frame(of->ctx, &opkt, ost); ost->st->codec->frame_number++; @@ -2135,7 +2432,7 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p static void rate_emu_sleep(InputStream *ist) { if (input_files[ist->file_index]->rate_emu) { - int64_t pts = av_rescale(ist->last_dts, 1000000, AV_TIME_BASE); + int64_t pts = av_rescale(ist->dts, 1000000, AV_TIME_BASE); int64_t now = av_gettime() - ist->start; if (pts > now) usleep(pts - now); @@ -2155,10 +2452,16 @@ static int transcode_audio(InputStream *ist, AVPacket *pkt, int *got_output) avcodec_get_frame_defaults(ist->decoded_frame); decoded_frame = ist->decoded_frame; + update_benchmark(NULL); ret = avcodec_decode_audio4(avctx, decoded_frame, got_output, pkt); + update_benchmark("decode_audio %d.%d", ist->file_index, ist->st->index); if (ret < 0) { return ret; } + if (avctx->sample_rate <= 0) { + av_log(avctx, AV_LOG_ERROR, "Sample rate %d invalid\n", avctx->sample_rate); + return AVERROR_INVALIDDATA; + } if (!*got_output) { /* no audio frame */ @@ -2168,13 +2471,16 @@ static int transcode_audio(InputStream *ist, AVPacket *pkt, int *got_output) /* if the decoder provides a pts, use it instead of the last packet pts. the decoder could be delaying output by a packet or more. */ if (decoded_frame->pts != AV_NOPTS_VALUE) - ist->next_dts = decoded_frame->pts; + ist->dts = ist->next_dts = ist->pts = ist->next_pts = decoded_frame->pts; /* increment next_dts to use for the case where the input stream does not have timestamps or there are multiple frames in the packet */ + ist->next_pts += ((int64_t)AV_TIME_BASE * decoded_frame->nb_samples) / + avctx->sample_rate; ist->next_dts += ((int64_t)AV_TIME_BASE * decoded_frame->nb_samples) / avctx->sample_rate; + // preprocess audio (volume) if (audio_volume != 256) { int decoded_data_size = decoded_frame->nb_samples * avctx->channels * bps; @@ -2251,6 +2557,8 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int AVFrame *decoded_frame; void *buffer_to_free = NULL; int i, ret = 0, resample_changed; + int64_t *best_effort_timestamp; + AVRational *frame_sample_aspect; float quality; if (!ist->decoded_frame && !(ist->decoded_frame = avcodec_alloc_frame())) @@ -2259,11 +2567,13 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int avcodec_get_frame_defaults(ist->decoded_frame); decoded_frame = ist->decoded_frame; pkt->pts = *pkt_pts; - pkt->dts = ist->last_dts; + pkt->dts = ist->dts; *pkt_pts = AV_NOPTS_VALUE; + update_benchmark(NULL); ret = avcodec_decode_video2(ist->st->codec, decoded_frame, got_output, pkt); + update_benchmark("decode_video %d.%d", ist->file_index, ist->st->index); if (ret < 0) return ret; @@ -2275,9 +2585,13 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int av_buffersrc_buffer(ist->filters[i]->filter, NULL); return ret; } - decoded_frame->pts = guess_correct_pts(&ist->pts_ctx, decoded_frame->pkt_pts, - decoded_frame->pkt_dts); + + best_effort_timestamp= av_opt_ptr(avcodec_get_frame_class(), decoded_frame, "best_effort_timestamp"); + if(*best_effort_timestamp != AV_NOPTS_VALUE) + ist->next_pts = ist->pts = decoded_frame->pts = *best_effort_timestamp; + pkt->size = 0; + pre_process_video_frame(ist, (AVPicture *)decoded_frame, &buffer_to_free); rate_emu_sleep(ist); @@ -2307,12 +2621,18 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int } } + frame_sample_aspect= av_opt_ptr(avcodec_get_frame_class(), decoded_frame, "sample_aspect_ratio"); for (i = 0; i < ist->nb_filters; i++) { + int changed = ist->st->codec->width != ist->filters[i]->filter->outputs[0]->w + || ist->st->codec->height != ist->filters[i]->filter->outputs[0]->h + || ist->st->codec->pix_fmt != ist->filters[i]->filter->outputs[0]->format; // XXX what an ugly hack if (ist->filters[i]->graph->nb_outputs == 1) ist->filters[i]->graph->outputs[0]->ost->last_quality = quality; - if (ist->st->codec->codec->capabilities & CODEC_CAP_DR1) { + if (!frame_sample_aspect->num) + *frame_sample_aspect = ist->st->sample_aspect_ratio; + if (ist->dr1 && decoded_frame->type==FF_BUFFER_TYPE_USER && !changed) { FrameBuffer *buf = decoded_frame->opaque; AVFilterBufferRef *fb = avfilter_get_video_buffer_ref_from_arrays( decoded_frame->data, decoded_frame->linesize, @@ -2324,11 +2644,15 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int fb->buf->priv = buf; fb->buf->free = filter_release_buffer; + av_assert0(buf->refcount>0); buf->refcount++; av_buffersrc_buffer(ist->filters[i]->filter, fb); } else - av_vsrc_buffer_add_frame(ist->filters[i]->filter, decoded_frame, - decoded_frame->pts, decoded_frame->sample_aspect_ratio); + if(av_vsrc_buffer_add_frame(ist->filters[i]->filter, decoded_frame,AV_VSRC_BUF_FLAG_OVERWRITE)<0) { + av_log(NULL, AV_LOG_FATAL, "Failed to inject frame into filter network\n"); + exit_program(1); + } + } av_free(buffer_to_free); @@ -2363,13 +2687,25 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output) /* pkt = NULL means EOF (needed to flush decoder buffers) */ static int output_packet(InputStream *ist, const AVPacket *pkt) { - int i; + int ret = 0, i; int got_output; int64_t pkt_pts = AV_NOPTS_VALUE; + AVPacket avpkt; + if (!ist->saw_first_ts) { + ist->dts = ist->st->avg_frame_rate.num ? - ist->st->codec->has_b_frames * AV_TIME_BASE / av_q2d(ist->st->avg_frame_rate) : 0; + ist->pts = 0; + if (pkt != NULL && pkt->pts != AV_NOPTS_VALUE && !ist->decoding_needed) { + ist->dts += av_rescale_q(pkt->pts, ist->st->time_base, AV_TIME_BASE_Q); + ist->pts = ist->dts; //unused but better to set it to a value thats not totally wrong + } + ist->saw_first_ts = 1; + } if (ist->next_dts == AV_NOPTS_VALUE) - ist->next_dts = ist->last_dts; + ist->next_dts = ist->dts; + if (ist->next_pts == AV_NOPTS_VALUE) + ist->next_pts = ist->pts; if (pkt == NULL) { /* EOF handling */ @@ -2381,17 +2717,21 @@ static int output_packet(InputStream *ist, const AVPacket *pkt) avpkt = *pkt; } - if (pkt->dts != AV_NOPTS_VALUE) - ist->next_dts = ist->last_dts = av_rescale_q(pkt->dts, ist->st->time_base, AV_TIME_BASE_Q); - if (pkt->pts != AV_NOPTS_VALUE) + if (pkt->dts != AV_NOPTS_VALUE) { + ist->next_dts = ist->dts = av_rescale_q(pkt->dts, ist->st->time_base, AV_TIME_BASE_Q); + if (ist->st->codec->codec_type != AVMEDIA_TYPE_VIDEO || !ist->decoding_needed) + ist->next_pts = ist->pts = av_rescale_q(pkt->dts, ist->st->time_base, AV_TIME_BASE_Q); + } + if(pkt->pts != AV_NOPTS_VALUE) pkt_pts = av_rescale_q(pkt->pts, ist->st->time_base, AV_TIME_BASE_Q); // while we have more to decode or while the decoder did output something on EOF while (ist->decoding_needed && (avpkt.size > 0 || (!pkt && got_output))) { - int ret = 0; + int duration; handle_eof: - ist->last_dts = ist->next_dts; + ist->pts = ist->next_pts; + ist->dts = ist->next_dts; if (avpkt.size && avpkt.size != pkt->size) { av_log(NULL, ist->showed_multi_packet_warning ? AV_LOG_VERBOSE : AV_LOG_WARNING, @@ -2405,17 +2745,23 @@ static int output_packet(InputStream *ist, const AVPacket *pkt) break; case AVMEDIA_TYPE_VIDEO: ret = transcode_video (ist, &avpkt, &got_output, &pkt_pts); - if (avpkt.duration) - ist->next_dts += av_rescale_q(avpkt.duration, ist->st->time_base, AV_TIME_BASE_Q); - else if (ist->st->r_frame_rate.num) - ist->next_dts += av_rescale_q(1, (AVRational){ist->st->r_frame_rate.den, - ist->st->r_frame_rate.num}, - AV_TIME_BASE_Q); - else if (ist->st->codec->time_base.num != 0) { - int ticks = ist->st->parser ? ist->st->parser->repeat_pict + 1 : - ist->st->codec->ticks_per_frame; - ist->next_dts += av_rescale_q(ticks, ist->st->codec->time_base, AV_TIME_BASE_Q); - } + if (avpkt.duration) { + duration = av_rescale_q(avpkt.duration, ist->st->time_base, AV_TIME_BASE_Q); + } else if(ist->st->codec->time_base.num != 0 && ist->st->codec->time_base.den != 0) { + int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame; + duration = ((int64_t)AV_TIME_BASE * + ist->st->codec->time_base.num * ticks) / + ist->st->codec->time_base.den; + } else + duration = 0; + + if(ist->dts != AV_NOPTS_VALUE && duration) { + ist->next_dts += duration; + }else + ist->next_dts = AV_NOPTS_VALUE; + + if (got_output) + ist->next_pts += duration; //FIXME the duration is not correct in some cases break; case AVMEDIA_TYPE_SUBTITLE: ret = transcode_subtitles(ist, &avpkt, &got_output); @@ -2426,8 +2772,14 @@ static int output_packet(InputStream *ist, const AVPacket *pkt) if (ret < 0) return ret; + + avpkt.dts= + avpkt.pts= AV_NOPTS_VALUE; + // touch data and size only if not EOF if (pkt) { + if(ist->st->codec->codec_type != AVMEDIA_TYPE_AUDIO) + ret = avpkt.size; avpkt.data += ret; avpkt.size -= ret; } @@ -2439,21 +2791,25 @@ static int output_packet(InputStream *ist, const AVPacket *pkt) /* handle stream copy */ if (!ist->decoding_needed) { rate_emu_sleep(ist); - ist->last_dts = ist->next_dts; + ist->dts = ist->next_dts; switch (ist->st->codec->codec_type) { case AVMEDIA_TYPE_AUDIO: ist->next_dts += ((int64_t)AV_TIME_BASE * ist->st->codec->frame_size) / ist->st->codec->sample_rate; break; case AVMEDIA_TYPE_VIDEO: - if (ist->st->codec->time_base.num != 0) { - int ticks = ist->st->parser ? ist->st->parser->repeat_pict + 1 : ist->st->codec->ticks_per_frame; + if (pkt->duration) { + ist->next_dts += av_rescale_q(pkt->duration, ist->st->time_base, AV_TIME_BASE_Q); + } else if(ist->st->codec->time_base.num != 0) { + int ticks= ist->st->parser ? ist->st->parser->repeat_pict + 1 : ist->st->codec->ticks_per_frame; ist->next_dts += ((int64_t)AV_TIME_BASE * ist->st->codec->time_base.num * ticks) / ist->st->codec->time_base.den; } break; } + ist->pts = ist->dts; + ist->next_pts = ist->next_dts; } for (i = 0; pkt && i < nb_output_streams; i++) { OutputStream *ost = output_streams[i]; @@ -2488,25 +2844,17 @@ static int init_input_stream(int ist_index, char *error, int error_len) { int i; InputStream *ist = input_streams[ist_index]; + if (ist->decoding_needed) { AVCodec *codec = ist->dec; if (!codec) { - snprintf(error, error_len, "Decoder (codec id %d) not found for input stream #%d:%d", - ist->st->codec->codec_id, ist->file_index, ist->st->index); + snprintf(error, error_len, "Decoder (codec %s) not found for input stream #%d:%d", + avcodec_get_name(ist->st->codec->codec_id), ist->file_index, ist->st->index); return AVERROR(EINVAL); } - /* update requested sample format for the decoder based on the - corresponding encoder sample format */ - for (i = 0; i < nb_output_streams; i++) { - OutputStream *ost = output_streams[i]; - if (ost->source_index == ist_index) { - update_sample_fmt(ist->st->codec, codec, ost->st->codec); - break; - } - } - - if (codec->type == AVMEDIA_TYPE_VIDEO && codec->capabilities & CODEC_CAP_DR1) { + ist->dr1 = codec->capabilities & CODEC_CAP_DR1; + if (codec->type == AVMEDIA_TYPE_VIDEO && ist->dr1) { ist->st->codec->get_buffer = codec_get_buffer; ist->st->codec->release_buffer = codec_release_buffer; ist->st->codec->opaque = ist; @@ -2534,9 +2882,8 @@ static int init_input_stream(int ist_index, char *error, int error_len) } } - ist->last_dts = ist->st->avg_frame_rate.num ? - ist->st->codec->has_b_frames * AV_TIME_BASE / av_q2d(ist->st->avg_frame_rate) : 0; + ist->next_pts = AV_NOPTS_VALUE; ist->next_dts = AV_NOPTS_VALUE; - init_pts_correction(&ist->pts_ctx); ist->is_start = 1; return 0; @@ -2642,14 +2989,36 @@ static int transcode_init(void) return AVERROR(ENOMEM); } memcpy(codec->extradata, icodec->extradata, icodec->extradata_size); - codec->extradata_size = icodec->extradata_size; - if (!copy_tb) { - codec->time_base = icodec->time_base; - codec->time_base.num *= icodec->ticks_per_frame; - av_reduce(&codec->time_base.num, &codec->time_base.den, - codec->time_base.num, codec->time_base.den, INT_MAX); - } else - codec->time_base = ist->st->time_base; + codec->extradata_size= icodec->extradata_size; + + codec->time_base = ist->st->time_base; + /* + * Avi is a special case here because it supports variable fps but + * having the fps and timebase differe significantly adds quite some + * overhead + */ + if(!strcmp(oc->oformat->name, "avi")) { + if ( copy_tb<0 && av_q2d(icodec->time_base)*icodec->ticks_per_frame > 2*av_q2d(ist->st->time_base) + && av_q2d(ist->st->time_base) < 1.0/500 + || copy_tb==0){ + codec->time_base = icodec->time_base; + codec->time_base.num *= icodec->ticks_per_frame; + codec->time_base.den *= 2; + codec->ticks_per_frame = 2; + } + } else if(!(oc->oformat->flags & AVFMT_VARIABLE_FPS) + && strcmp(oc->oformat->name, "mov") && strcmp(oc->oformat->name, "mp4") && strcmp(oc->oformat->name, "3gp") + && strcmp(oc->oformat->name, "3g2") && strcmp(oc->oformat->name, "psp") && strcmp(oc->oformat->name, "ipod") + ) { + if( copy_tb<0 && av_q2d(icodec->time_base)*icodec->ticks_per_frame > av_q2d(ist->st->time_base) + && av_q2d(ist->st->time_base) < 1.0/500 + || copy_tb==0){ + codec->time_base = icodec->time_base; + codec->time_base.num *= icodec->ticks_per_frame; + } + } + av_reduce(&codec->time_base.num, &codec->time_base.den, + codec->time_base.num, codec->time_base.den, INT_MAX); switch (codec->codec_type) { case AVMEDIA_TYPE_AUDIO: @@ -2676,6 +3045,7 @@ static int transcode_init(void) ist->st->codec->sample_aspect_ratio.num ? ist->st->codec->sample_aspect_ratio : (AVRational){0, 1}; } + ost->st->avg_frame_rate = ist->st->avg_frame_rate; break; case AVMEDIA_TYPE_SUBTITLE: codec->width = icodec->width; @@ -2688,13 +3058,12 @@ static int transcode_init(void) abort(); } } else { + if (!ost->enc) + ost->enc = avcodec_find_encoder(codec->codec_id); if (!ost->enc) { /* should only happen when a default codec is not present. */ - snprintf(error, sizeof(error), "Automatic encoder selection " - "failed for output stream #%d:%d. Default encoder for " - "format %s is probably disabled. Please choose an " - "encoder manually.\n", ost->file_index, ost->index, - oc->oformat->name); + snprintf(error, sizeof(error), "Encoder (codec %s) not found for output stream #%d:%d", + avcodec_get_name(ost->st->codec->codec_id), ost->file_index, ost->index); ret = AVERROR(EINVAL); goto dump_format; } @@ -2709,8 +3078,6 @@ static int transcode_init(void) if (!ost->fifo) { return AVERROR(ENOMEM); } - ost->reformat_pair = MAKE_SFMT_PAIR(AV_SAMPLE_FMT_NONE,AV_SAMPLE_FMT_NONE); - if (!codec->sample_rate) codec->sample_rate = icodec->sample_rate; choose_sample_rate(ost->st, ost->enc); @@ -2720,14 +3087,33 @@ static int transcode_init(void) codec->sample_fmt = icodec->sample_fmt; choose_sample_fmt(ost->st, ost->enc); - if (!codec->channels) + if (ost->audio_channels_mapped) { + /* the requested output channel is set to the number of + * -map_channel only if no -ac are specified */ + if (!codec->channels) { + codec->channels = ost->audio_channels_mapped; + codec->channel_layout = av_get_default_channel_layout(codec->channels); + if (!codec->channel_layout) { + av_log(NULL, AV_LOG_FATAL, "Unable to find an appropriate channel layout for requested number of channel\n"); + exit_program(1); + } + } + /* fill unused channel mapping with -1 (which means a muted + * channel in case the number of output channels is bigger + * than the number of mapped channel) */ + for (j = ost->audio_channels_mapped; j < FF_ARRAY_ELEMS(ost->audio_channels_map); j++) + ost->audio_channels_map[j] = -1; + } else if (!codec->channels) { codec->channels = icodec->channels; - codec->channel_layout = icodec->channel_layout; + codec->channel_layout = icodec->channel_layout; + } if (av_get_channel_layout_nb_channels(codec->channel_layout) != codec->channels) codec->channel_layout = 0; - ost->audio_resample = codec-> sample_rate != icodec->sample_rate || audio_sync_method > 1; - icodec->request_channels = codec-> channels; + ost->audio_resample = codec->sample_rate != icodec->sample_rate || audio_sync_method > 1; + ost->audio_resample |= codec->sample_fmt != icodec->sample_fmt + || codec->channel_layout != icodec->channel_layout; + icodec->request_channels = codec->channels; ost->resample_sample_fmt = icodec->sample_fmt; ost->resample_sample_rate = icodec->sample_rate; ost->resample_channels = icodec->channels; @@ -2742,32 +3128,22 @@ static int transcode_init(void) } } - /* - * We want CFR output if and only if one of those is true: - * 1) user specified output framerate with -r - * 2) user specified -vsync cfr - * 3) output format is CFR and the user didn't force vsync to - * something else than CFR - * - * in such a case, set ost->frame_rate - */ - if (!ost->frame_rate.num && ist && - (video_sync_method == VSYNC_CFR || - (video_sync_method == VSYNC_AUTO && - !(oc->oformat->flags & (AVFMT_NOTIMESTAMPS | AVFMT_VARIABLE_FPS))))) { - ost->frame_rate = ist->st->r_frame_rate.num ? ist->st->r_frame_rate : (AVRational){25, 1}; - if (ost->enc && ost->enc->supported_framerates && !ost->force_fps) { - int idx = av_find_nearest_q_idx(ost->frame_rate, ost->enc->supported_framerates); - ost->frame_rate = ost->enc->supported_framerates[idx]; - } + if (ist && !ost->frame_rate.num) + ost->frame_rate = ist->st->r_frame_rate.num ? ist->st->r_frame_rate : (AVRational) { 25, 1 }; + if (ost->enc && ost->enc->supported_framerates && !ost->force_fps) { + int idx = av_find_nearest_q_idx(ost->frame_rate, ost->enc->supported_framerates); + ost->frame_rate = ost->enc->supported_framerates[idx]; } - if (ost->frame_rate.num) { - codec->time_base = (AVRational){ost->frame_rate.den, ost->frame_rate.num}; - video_sync_method = VSYNC_CFR; - } else if (ist) - codec->time_base = ist->st->time_base; - else - codec->time_base = ost->filter->filter->inputs[0]->time_base; + codec->time_base = (AVRational){ost->frame_rate.den, ost->frame_rate.num}; + if ( av_q2d(codec->time_base) < 0.001 && video_sync_method != VSYNC_PASSTHROUGH + && (video_sync_method == VSYNC_CFR || (video_sync_method == VSYNC_AUTO && !(oc->oformat->flags & AVFMT_VARIABLE_FPS)))){ + av_log(oc, AV_LOG_WARNING, "Frame rate very high for a muxer not efficiently supporting it.\n" + "Please consider specifying a lower framerate, a different muxer or -vsync 2\n"); + } + for (j = 0; j < ost->forced_kf_count; j++) + ost->forced_kf_pts[j] = av_rescale_q(ost->forced_kf_pts[j], + AV_TIME_BASE_Q, + codec->time_base); codec->width = ost->filter->filter->inputs[0]->w; codec->height = ost->filter->filter->inputs[0]->h; @@ -2780,7 +3156,7 @@ static int transcode_init(void) if (codec->width != icodec->width || codec->height != icodec->height || codec->pix_fmt != icodec->pix_fmt) { - codec->bits_per_raw_sample = 0; + codec->bits_per_raw_sample = frame_bits_per_raw_sample; } break; @@ -2792,7 +3168,7 @@ static int transcode_init(void) break; } /* two pass mode */ - if ((codec->flags & (CODEC_FLAG_PASS1 | CODEC_FLAG_PASS2))) { + if (codec->flags & (CODEC_FLAG_PASS1 | CODEC_FLAG_PASS2)) { char logfilename[1024]; FILE *f; @@ -2802,24 +3178,25 @@ static int transcode_init(void) if (!strcmp(ost->enc->name, "libx264")) { av_dict_set(&ost->opts, "stats", logfilename, AV_DICT_DONT_OVERWRITE); } else { - if (codec->flags & CODEC_FLAG_PASS1) { - f = fopen(logfilename, "wb"); - if (!f) { - av_log(NULL, AV_LOG_FATAL, "Cannot write log file '%s' for pass-1 encoding: %s\n", - logfilename, strerror(errno)); - exit_program(1); - } - ost->logfile = f; - } else { + if (codec->flags & CODEC_FLAG_PASS2) { char *logbuffer; size_t logbuffer_size; if (cmdutils_read_file(logfilename, &logbuffer, &logbuffer_size) < 0) { av_log(NULL, AV_LOG_FATAL, "Error reading log file '%s' for pass-2 encoding\n", - logfilename); + logfilename); exit_program(1); } codec->stats_in = logbuffer; } + if (codec->flags & CODEC_FLAG_PASS1) { + f = fopen(logfilename, "wb"); + if (!f) { + av_log(NULL, AV_LOG_FATAL, "Cannot write log file '%s' for pass-1 encoding: %s\n", + logfilename, strerror(errno)); + exit_program(1); + } + ost->logfile = f; + } } } } @@ -2855,7 +3232,7 @@ static int transcode_init(void) assert_avoptions(ost->opts); if (ost->st->codec->bit_rate && ost->st->codec->bit_rate < 1000) av_log(NULL, AV_LOG_WARNING, "The bitrate parameter is set too low." - "It takes bits/s as argument, not kbits/s\n"); + " It takes bits/s as argument, not kbits/s\n"); extra_size += ost->st->codec->extradata_size; if (ost->st->codec->me_threshold) @@ -2893,7 +3270,7 @@ static int transcode_init(void) ret = AVERROR(EINVAL); goto dump_format; } - assert_avoptions(output_files[i]->opts); +// assert_avoptions(output_files[i]->opts); if (strcmp(oc->oformat->name, "rtp")) { want_sdp = 0; } @@ -2955,6 +3332,15 @@ static int transcode_init(void) input_streams[ost->source_index]->st->index, ost->file_index, ost->index); + if (ost->audio_channels_mapped) { + av_log(NULL, AV_LOG_INFO, " [ch:"); + for (j = 0; j < ost->audio_channels_mapped; j++) + if (ost->audio_channels_map[j] == -1) + av_log(NULL, AV_LOG_INFO, " M"); + else + av_log(NULL, AV_LOG_INFO, " %d", ost->audio_channels_map[j]); + av_log(NULL, AV_LOG_INFO, "]"); + } if (ost->sync_ist != input_streams[ost->source_index]) av_log(NULL, AV_LOG_INFO, " [sync #%d:%d]", ost->sync_ist->file_index, @@ -2992,6 +3378,7 @@ static int transcode(void) uint8_t *no_packet; int no_packet_count = 0; int64_t timer_start; + int key; if (!(no_packet = av_mallocz(nb_input_files))) exit_program(1); @@ -3000,8 +3387,9 @@ static int transcode(void) if (ret < 0) goto fail; - av_log(NULL, AV_LOG_INFO, "Press ctrl-c to stop encoding\n"); - term_init(); + if (!using_stdin) { + av_log(NULL, AV_LOG_INFO, "Press [q] to stop, [?] for help\n"); + } timer_start = av_gettime(); @@ -3009,8 +3397,99 @@ static int transcode(void) int file_index, ist_index, past_recording_time = 1; AVPacket pkt; int64_t ipts_min; + int64_t cur_time= av_gettime(); ipts_min = INT64_MAX; + /* if 'q' pressed, exits */ + if (!using_stdin) { + static int64_t last_time; + if (received_nb_signals) + break; + /* read_key() returns 0 on EOF */ + if(cur_time - last_time >= 100000 && !run_as_daemon){ + key = read_key(); + last_time = cur_time; + }else + key = -1; + if (key == 'q') + break; + if (key == '+') av_log_set_level(av_log_get_level()+10); + if (key == '-') av_log_set_level(av_log_get_level()-10); + if (key == 's') qp_hist ^= 1; + if (key == 'h'){ + if (do_hex_dump){ + do_hex_dump = do_pkt_dump = 0; + } else if(do_pkt_dump){ + do_hex_dump = 1; + } else + do_pkt_dump = 1; + av_log_set_level(AV_LOG_DEBUG); + } + if (key == 'c' || key == 'C'){ + char buf[4096], target[64], command[256], arg[256] = {0}; + double time; + int k, n = 0; + fprintf(stderr, "\nEnter command: