diff options
author | elupus <elupus@xbmc.org> | 2012-03-25 23:27:29 +0200 |
---|---|---|
committer | elupus <elupus@xbmc.org> | 2012-03-31 16:28:00 +0200 |
commit | 2836f95ad7d9425fc27c2de62b5c51e7829032f6 (patch) | |
tree | 158a931d0795a3c9d9e21294ac9f1fa63e03f17f /lib/ffmpeg/doc | |
parent | 8a0ce9e337267786236cba4f68d1db93bd28c3ef (diff) |
Update ffmpeg to n0.10.2 (f139838d6473c7b5152178f602cb953a824c2ff9)
xbmc ffmpeg 05f8b5549c5e20cf9a417069838edd6841d7bd40
Diffstat (limited to 'lib/ffmpeg/doc')
45 files changed, 8854 insertions, 1309 deletions
diff --git a/lib/ffmpeg/doc/APIchanges b/lib/ffmpeg/doc/APIchanges index aa1221df45..010fee5f8e 100644 --- a/lib/ffmpeg/doc/APIchanges +++ b/lib/ffmpeg/doc/APIchanges @@ -1,18 +1,558 @@ -Never assume the API of libav* to be stable unless at least 1 week has passed since -the last major version increase. +Never assume the API of libav* to be stable unless at least 1 month has passed +since the last major version increase. + The last version increases were: -libavcodec: ? -libavcore: 2010-07-21 -libavdevice: ? -libavfilter: 2009-10-18 -libavformat: ? -libpostproc: ? -libswscale: ? -libavutil: 2009-03-08 +libavcodec: 2011-04-18 +libavdevice: 2011-04-18 +libavfilter: 2011-04-18 +libavformat: 2011-04-18 +libpostproc: 2011-04-18 +libswscale: 2011-06-20 +libavutil: 2011-04-18 API changes, most recent first: +2012-01-24 - xxxxxxx - lavfi 2.60.100 + Add avfilter_graph_dump. + +2012-01-25 - lavf 53.22.0 + f1caf01 Allow doing av_write_frame(ctx, NULL) for flushing possible + buffered data within a muxer. Added AVFMT_ALLOW_FLUSH for + muxers supporting it (av_write_frame makes sure it is called + only for muxers with this flag). + +2012-03-04 - xxxxxxx - lavu 51.22.1 - error.h + Add AVERROR_UNKNOWN + +2012-02-29 - xxxxxxx - lavf 53.21.0 + Add avformat_get_riff_video_tags() and avformat_get_riff_audio_tags(). + +2012-02-29 - xxxxxxx - lavu 51.22.0 - intfloat.h + Add a new installed header libavutil/intfloat.h with int/float punning + functions. + +2012-02-17 - xxxxxxx - lavc 53.35.0 + Add avcodec_is_open() function. + +2012-01-15 - lavc 53.34.0 + New audio encoding API: + b2c75b6 Add CODEC_CAP_VARIABLE_FRAME_SIZE capability for use by audio + encoders. + 5ee5fa0 Add avcodec_fill_audio_frame() as a convenience function. + b2c75b6 Add avcodec_encode_audio2() and deprecate avcodec_encode_audio(). + Add AVCodec.encode2(). + +2012-01-12 - 3167dc9 - lavfi 2.15.0 + Add a new installed header -- libavfilter/version.h -- with version macros. + +2011-12-08 - a502939 - lavfi 2.52.0 + Add av_buffersink_poll_frame() to buffersink.h. + +2011-12-08 - xxxxxxx - lavu 51.31.0 + Add av_log_format_line. + +2011-12-03 - xxxxxxx - lavu 51.30.0 + Add AVERROR_BUG. + +2011-xx-xx - xxxxxxx - 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-10-20 - b35e9e1 - lavu 51.22.0 + Add av_strtok() to avstring.h. + +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. + +2011-12-12 - 5266045 - lavf 53.17.0 + Add avformat_close_input(). + Deprecate av_close_input_file() and av_close_input_stream(). + +2011-12-02 - 0eea212 - lavc 53.25.0 + Add nb_samples and extended_data fields to AVFrame. + Deprecate AVCODEC_MAX_AUDIO_FRAME_SIZE. + Deprecate avcodec_decode_audio3() in favor of avcodec_decode_audio4(). + avcodec_decode_audio4() writes output samples to an AVFrame, which allows + audio decoders to use get_buffer(). + +2011-12-04 - 560f773 - lavc 53.24.0 + Change AVFrame.data[4]/base[4]/linesize[4]/error[4] to [8] at next major bump. + Change AVPicture.data[4]/linesize[4] to [8] at next major bump. + Change AVCodecContext.error[4] to [8] at next major bump. + Add AV_NUM_DATA_POINTERS to simplify the bump transition. + +2011-11-23 - bbb46f3 - lavu 51.18.0 + Add av_samples_get_buffer_size(), av_samples_fill_arrays(), and + av_samples_alloc(), to samplefmt.h. + +2011-11-23 - 8889cc4 - lavu 51.17.0 + Add planar sample formats and av_sample_fmt_is_planar() to samplefmt.h. + +2011-11-19 - f3a29b7 - lavc 53.21.0 + Move some AVCodecContext fields to a new private struct, AVCodecInternal, + which is accessed from a new field, AVCodecContext.internal. + - fields moved: + AVCodecContext.internal_buffer --> AVCodecInternal.buffer + AVCodecContext.internal_buffer_count --> AVCodecInternal.buffer_count + AVCodecContext.is_copy --> AVCodecInternal.is_copy + +2011-11-16 - 6270671 - lavu 51.16.0 + Add av_timegm() + +2011-11-13 - lavf 53.15.0 + New interrupt callback API, allowing per-AVFormatContext/AVIOContext + interrupt callbacks. + 6aa0b98 Add AVIOInterruptCB struct and the interrupt_callback field to + AVFormatContext. + 1dee0ac Add avio_open2() with additional parameters. Those are + an interrupt callback and an options AVDictionary. + This will allow passing AVOptions to protocols after lavf + 54.0. + +2011-11-06 - ba04ecf - lavu 51.14.0 + Add av_strcasecmp() and av_strncasecmp() to avstring.h. + +2011-11-06 - 07b172f - lavu 51.13.0 + Add av_toupper()/av_tolower() + +2011-11-05 - b6d08f4 - lavf 53.13.0 + Add avformat_network_init()/avformat_network_uninit() + +2011-10-27 - 512557b - lavc 53.15.0 + Remove avcodec_parse_frame. + Deprecate AVCodecContext.parse_only and CODEC_CAP_PARSE_ONLY. + +2011-10-19 - 569129a - lavf 53.10.0 + Add avformat_new_stream(). Deprecate av_new_stream(). + +2011-10-13 - b631fba - lavf 53.9.0 + Add AVFMT_NO_BYTE_SEEK AVInputFormat flag. + +2011-10-12 - lavu 51.12.0 + AVOptions API rewrite. + + - 145f741 FF_OPT_TYPE* renamed to AV_OPT_TYPE_* + - new setting/getting functions with slightly different semantics: + dac66da av_set_string3 -> av_opt_set + av_set_double -> av_opt_set_double + av_set_q -> av_opt_set_q + av_set_int -> av_opt_set_int + + 41d9d51 av_get_string -> av_opt_get + av_get_double -> av_opt_get_double + av_get_q -> av_opt_get_q + av_get_int -> av_opt_get_int + + - 8c5dcaa trivial rename av_next_option -> av_opt_next + - 641c7af new functions - av_opt_child_next, av_opt_child_class_next + and av_opt_find2() + +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-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 + - 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.8.0 + Add avformat_query_codec(). + +2011-08-16 - bca06e7 - lavc 53.11.0 + Add avcodec_get_type(). + +2011-08-06 - 2f63440 - lavf 53.7.0 + Add error_recognition to AVFormatContext. + +2011-08-02 - 9d39cbf - lavc 53.9.1 + Add AV_PKT_FLAG_CORRUPT AVPacket flag. + +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(). + +2011-07-10 - 0b950fe - lavc 53.8.0 + Add avcodec_open2(), deprecate avcodec_open(). + +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(). + +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, + AVFormatParameters and av_write_header. + +2011-06-16 - 7e83e1c, dc59ec5 - lavu 51.7.0 - opt.h + Add av_opt_set_dict() and av_opt_find(). + Deprecate av_find_opt(). + Add AV_DICT_APPEND flag. + +2011-06-10 - cb7c11c - lavu 51.6.0 - opt.h + Add av_opt_flag_is_set(). + +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.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.8.0 - opt.h + Add av_opt_free convenience function. + +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.3.0 - avformat.h + Add fps_probe_size to AVFormatContext. + +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.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 + libavcodec/avcodec.h. + +2011-04-26 - 10d3940 - lavfi 2.3.0 - avfilter.h + Add pict_type and key_frame fields to AVFilterBufferRefVideo. + +2011-04-26 - 7a11c82 - lavfi 2.2.0 - vsrc_buffer + Add sample_aspect_ratio fields to vsrc_buffer arguments + +2011-04-21 - 94f7451 - lavc 53.1.0 - avcodec.h + Add CODEC_CAP_SLICE_THREADS for codecs supporting sliced threading. + +2011-04-15 - lavc 52.120.0 - avcodec.h + AVPacket structure got additional members for passing side information: + 4de339e introduce side information for AVPacket + 2d8591c make containers pass palette change in AVPacket + +2011-04-12 - lavf 52.107.0 - avio.h + Avio cleanup, part II - deprecate the entire URLContext API: + 175389c add avio_check as a replacement for url_exist + ff1ec0c add avio_pause and avio_seek_time as replacements + for _av_url_read_fseek/fpause + cdc6a87 deprecate av_protocol_next(), avio_enum_protocols + should be used instead. + 80c6e23 rename url_set_interrupt_cb->avio_set_interrupt_cb. + f87b1b3 rename open flags: URL_* -> AVIO_* + f8270bb add avio_enum_protocols. + 5593f03 deprecate URLProtocol. + c486dad deprecate URLContext. + 026e175 deprecate the typedef for URLInterruptCB + 8e76a19 deprecate av_register_protocol2. + b840484 deprecate URL_PROTOCOL_FLAG_NESTED_SCHEME + 1305d93 deprecate av_url_read_seek + fa104e1 deprecate av_url_read_pause + 727c7aa deprecate url_get_filename(). + 5958df3 deprecate url_max_packet_size(). + 1869ea0 deprecate url_get_file_handle(). + 32a97d4 deprecate url_filesize(). + e52a914 deprecate url_close(). + 58a48c6 deprecate url_seek(). + 925e908 deprecate url_write(). + dce3756 deprecate url_read_complete(). + bc371ac deprecate url_read(). + 0589da0 deprecate url_open(). + 62eaaea deprecate url_connect. + 5652bb9 deprecate url_alloc. + 333e894 deprecate url_open_protocol + e230705 deprecate url_poll and URLPollEntry + +2011-04-08 - lavf 52.106.0 - avformat.h + Minor avformat.h cleanup: + a9bf9d8 deprecate av_guess_image2_codec + c3675df rename avf_sdp_create->av_sdp_create + +2011-04-03 - lavf 52.105.0 - avio.h + Large-scale renaming/deprecating of AVIOContext-related functions: + 724f6a0 deprecate url_fdopen + 403ee83 deprecate url_open_dyn_packet_buf + 6dc7d80 rename url_close_dyn_buf -> avio_close_dyn_buf + b92c545 rename url_open_dyn_buf -> avio_open_dyn_buf + 8978fed introduce an AVIOContext.seekable field as a replacement for + AVIOContext.is_streamed and url_is_streamed() + b64030f deprecate get_checksum() + 4c4427a deprecate init_checksum() + 4ec153b deprecate udp_set_remote_url/get_local_port + 933e90a deprecate av_url_read_fseek/fpause + 8d9769a deprecate url_fileno + b7f2fdd rename put_flush_packet -> avio_flush + 35f1023 deprecate url_close_buf + 83fddae deprecate url_open_buf + d9d86e0 rename url_fprintf -> avio_printf + 59f65d9 deprecate url_setbufsize + 3e68b3b deprecate url_ferror + e8bb2e2 deprecate url_fget_max_packet_size + 76aa876 rename url_fsize -> avio_size + e519753 deprecate url_fgetc + 655e45e deprecate url_fgets + a2704c9 rename url_ftell -> avio_tell + e16ead0 deprecate get_strz() in favor of avio_get_str + 0300db8,2af07d3 rename url_fskip -> avio_skip + 6b4aa5d rename url_fseek -> avio_seek + 61840b4 deprecate put_tag + 22a3212 rename url_fopen/fclose -> avio_open/close. + 0ac8e2b deprecate put_nbyte + 77eb550 rename put_byte -> avio_w8 + put_[b/l]e<type> -> avio_w[b/l]<type> + put_buffer -> avio_write + b7effd4 rename get_byte -> avio_r8, + get_[b/l]e<type> -> avio_r[b/l]<type> + get_buffer -> avio_read + b3db9ce deprecate get_partial_buffer + 8d9ac96 rename av_alloc_put_byte -> avio_alloc_context + +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 + av_pkt_dump and av_pkt_dump_log. + +2011-02-20 - e731b8d - lavf 52.102.0 - avio.h + * e731b8d - rename init_put_byte() to ffio_init_context(), deprecating the + original, and move it to a private header so it is no longer + part of our public API. Instead, use av_alloc_put_byte(). + * ae628ec - rename ByteIOContext to AVIOContext. + +2011-02-16 - 09d171b - lavf 52.101.0 - avformat.h + lavu 52.39.0 - parseutils.h + * 610219a - Add av_ prefix to dump_format(). + * f6c7375 - Replace parse_date() in lavf with av_parse_time() in lavu. + * ab0287f - Move find_info_tag from lavf to lavu and add av_prefix to it. + +2011-02-15 - lavu 52.38.0 - merge libavcore + libavcore is merged back completely into libavutil + +2011-02-10 - 55bad0c - lavc 52.113.0 - vbv_delay + Add vbv_delay field to AVCodecContext + +2011-02-14 - 24a83bd - lavf 52.100.0 - AV_DISPOSITION_CLEAN_EFFECTS + Add AV_DISPOSITION_CLEAN_EFFECTS disposition flag. + +2011-02-14 - 910b5b8 - lavfi 1.76.0 - AVFilterLink sample_aspect_ratio + Add sample_aspect_ratio field to AVFilterLink. + +2011-02-10 - 12c14cd - lavf 52.99.0 - AVStream.disposition + Add AV_DISPOSITION_HEARING_IMPAIRED and AV_DISPOSITION_VISUAL_IMPAIRED. + +2011-02-09 - 5592734 - lavc 52.112.0 - avcodec_thread_init() + Deprecate avcodec_thread_init()/avcodec_thread_free() use; instead + set thread_count before calling avcodec_open. + +2011-02-09 - 778b08a - lavc 52.111.0 - threading API + Add CODEC_CAP_FRAME_THREADS with new restrictions on get_buffer()/ + release_buffer()/draw_horiz_band() callbacks for appropriate codecs. + Add thread_type and active_thread_type fields to AVCodecContext. + +2011-02-08 - 3940caa - lavf 52.98.0 - av_probe_input_buffer + Add av_probe_input_buffer() to avformat.h for probing format from a + ByteIOContext. + +2011-02-06 - fe174fc - lavf 52.97.0 - avio.h + Add flag for non-blocking protocols: URL_FLAG_NONBLOCK + +2011-02-04 - f124b08 - lavf 52.96.0 - avformat_free_context() + Add avformat_free_context() in avformat.h. + +2011-02-03 - f5b82f4 - lavc 52.109.0 - add CODEC_ID_PRORES + Add CODEC_ID_PRORES to avcodec.h. + +2011-02-03 - fe9a3fb - lavc 52.109.0 - H.264 profile defines + Add defines for H.264 * Constrained Baseline and Intra profiles + +2011-02-02 - lavf 52.95.0 + * 50196a9 - add a new installed header version.h. + * 4efd5cf, dccbd97, 93b78d1 - add several variants of public + avio_{put,get}_str* functions. Deprecate corresponding semi-public + {put,get}_str*. + +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 - r26374 - lavfi 1.74.0 - AVFilterBufferRefAudioProps Rename AVFilterBufferRefAudioProps.samples_nb to nb_samples. @@ -385,16 +925,22 @@ API changes, most recent first: 2010-05-26 - r23334 - lavc 52.72.0 - CODEC_CAP_EXPERIMENTAL Add CODEC_CAP_EXPERIMENTAL flag. + NOTE: this was backported to 0.6 2010-05-23 - r23255 - lavu 50.16.0 - av_get_random_seed() Add av_get_random_seed(). 2010-05-18 - r23161 - lavf 52.63.0 - AVFMT_FLAG_RTP_HINT Add AVFMT_FLAG_RTP_HINT as possible value for AVFormatContext.flags. + NOTE: this was backported to 0.6 2010-05-09 - r23066 - lavfi 1.20.0 - AVFilterPicRef Add interlaced and top_field_first fields to AVFilterPicRef. +------------------------------8<------------------------------------- + 0.6 branch was cut here +----------------------------->8-------------------------------------- + 2010-05-01 - r23002 - lavf 52.62.0 - probe function Add av_probe_input_format2 to API, it allows ignoring probe results below given score and returns the actual probe score. diff --git a/lib/ffmpeg/doc/Makefile b/lib/ffmpeg/doc/Makefile new file mode 100644 index 0000000000..2dbf30a0db --- /dev/null +++ b/lib/ffmpeg/doc/Makefile @@ -0,0 +1,64 @@ +MANPAGES = $(PROGS-yes:%=doc/%.1) +PODPAGES = $(PROGS-yes:%=doc/%.pod) +HTMLPAGES = $(PROGS-yes:%=doc/%.html) \ + doc/developer.html \ + doc/faq.html \ + doc/fate.html \ + doc/general.html \ + doc/git-howto.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 '/^@(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/%.html: TAG = HTML +doc/%.html: doc/%.texi $(SRC_PATH)/doc/t2h.init + $(Q)$(TEXIDEP) + $(M)texi2html -monolithic --init-file $(SRC_PATH)/doc/t2h.init --output $@ $< + +doc/%.pod: TAG = POD +doc/%.pod: doc/%.texi + $(Q)$(TEXIDEP) + $(M)$(SRC_PATH)/doc/texi2pod.pl $< $@ + +doc/%.1: TAG = MAN +doc/%.1: doc/%.pod + $(M)pod2man --section=1 --center=" " --release=" " $< > $@ + +$(DOCS): | doc +OBJDIRS += doc + +install-progs-$(CONFIG_DOC): install-man + +install-man: $(MANPAGES) + $(Q)mkdir -p "$(MANDIR)/man1" + $(INSTALL) -m 644 $(MANPAGES) "$(MANDIR)/man1" + +uninstall: uninstall-man + +uninstall-man: + $(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES)) + +clean:: + $(RM) $(TXTPAGES) doc/*.html doc/*.pod doc/*.1 $(CLEANSUFFIXES:%=doc/%) + +-include $(wildcard $(DOCS:%=%.d)) + +.PHONY: documentation diff --git a/lib/ffmpeg/doc/RELEASE_NOTES b/lib/ffmpeg/doc/RELEASE_NOTES new file mode 100644 index 0000000000..ccaa4e4d3c --- /dev/null +++ b/lib/ffmpeg/doc/RELEASE_NOTES @@ -0,0 +1,49 @@ +Release Notes +============= + +* 0.10 "Freedom" January, 2012 + + +General notes +------------- +This release is binary compatible with 0.8 and 0.9. + +See the Changelog file for a list of significant changes. Note, there +are many more new features and bugfixes than whats listed there. + +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 +----------- + +A number of additional APIs have been introduced and some existing +functions have been deprecated and are scheduled for removal in the next +release. Significant API changes include: + +* new audio decoding API which decodes from an AVPacket to an AVFrame and +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. + +Please see the git history and the file doc/APIchanges for details. + + +Other notable changes +--------------------- + +Libavcodec and libavformat built as shared libraries now hide non-public +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 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 and git history for a more detailed list of changes. diff --git a/lib/ffmpeg/doc/TODO b/lib/ffmpeg/doc/TODO deleted file mode 100644 index 747eee4ab1..0000000000 --- a/lib/ffmpeg/doc/TODO +++ /dev/null @@ -1,82 +0,0 @@ -ffmpeg TODO list: ----------------- - -Fabrice's TODO list: (unordered) -------------------- -Short term: - -- use AVFMTCTX_DISCARD_PKT in ffplay so that DV has a chance to work -- add RTSP regression test (both client and server) -- make ffserver allocate AVFormatContext -- clean up (incompatible change, for 0.5.0): - * AVStream -> AVComponent - * AVFormatContext -> AVInputStream/AVOutputStream - * suppress rate_emu from AVCodecContext -- add new float/integer audio filterting and conversion : suppress - CODEC_ID_PCM_xxc and use CODEC_ID_RAWAUDIO. -- fix telecine and frame rate conversion - -Long term (ask me if you want to help): - -- commit new imgconvert API and new PIX_FMT_xxx alpha formats -- commit new LGPL'ed float and integer-only AC3 decoder -- add WMA integer-only decoder -- add new MPEG4-AAC audio decoder (both integer-only and float version) - -Michael's TODO list: (unordered) (if anyone wanna help with sth, just ask) -------------------- -- optimize H264 CABAC -- more optimizations -- simper rate control - -Philip'a TODO list: (alphabetically ordered) (please help) ------------------- -- Add a multi-ffm filetype so that feeds can be recorded into multiple files rather - than one big file. -- Authenticated users support -- where the authentication is in the URL -- Change ASF files so that the embedded timestamp in the frames is right rather - than being an offset from the start of the stream -- Make ffm files more resilient to changes in the codec structures so that you - can play old ffm files. - -Baptiste's TODO list: ------------------ -- mov edit list support (AVEditList) -- YUV 10 bit per component support "2vuy" -- mxf muxer -- mpeg2 non linear quantizer - -unassigned TODO: (unordered) ---------------- -- use AVFrame for audio codecs too -- rework aviobuf.c buffering strategy and fix url_fskip -- generate optimal huffman tables for mjpeg encoding -- fix ffserver regression tests -- support xvids motion estimation -- support x264s motion estimation -- support x264s rate control -- SNOW: non translational motion compensation -- SNOW: more optimal quantization -- SNOW: 4x4 block support -- SNOW: 1/8 pel motion compensation support -- SNOW: iterative motion estimation based on subsampled images -- SNOW: try B frames and MCTF and see how their PSNR/bitrate/complexity behaves -- SNOW: try to use the wavelet transformed MC-ed reference frame as context for the entropy coder -- SNOW: think about/analyize how to make snow use multiple cpus/threads -- SNOW: finish spec -- FLAC: lossy encoding (viterbi and naive scalar quantization) -- libavfilter -- JPEG2000 decoder & encoder -- MPEG4 GMC encoding support -- macroblock based pixel format (better cache locality, somewhat complex, one paper claimed it faster for high res) -- regression tests for codecs which do not have an encoder (I+P-frame bitstream in svn) -- add support for using mplayers video filters to ffmpeg -- H264 encoder -- per MB ratecontrol (so VCD and such do work better) -- write a script which iteratively changes all functions between always_inline and noinline and benchmarks the result to find the best set of inlined functions -- convert all the non SIMD asm into small asm vs. C testcases and submit them to the gcc devels so they can improve gcc -- generic audio mixing API -- extract PES packetizer from PS muxer and use it for new TS muxer -- implement automatic AVBistreamFilter activation -- make cabac encoder use bytestream (see http://trac.videolan.org/x264/changeset/?format=diff&new=651) -- merge imdct and windowing, the current code does considerable amounts of redundant work diff --git a/lib/ffmpeg/doc/avtools-common-opts.texi b/lib/ffmpeg/doc/avtools-common-opts.texi new file mode 100644 index 0000000000..94d47fd64f --- /dev/null +++ b/lib/ffmpeg/doc/avtools-common-opts.texi @@ -0,0 +1,168 @@ +All the numerical options, if not specified otherwise, accept in input +a string representing a number, which may contain one of the +International System number postfixes, for example 'K', 'M', 'G'. +If 'i' is appended after the postfix, powers of 2 are used instead of +powers of 10. The 'B' postfix multiplies the value for 8, and can be +appended after another postfix or used alone. This allows using for +example 'KB', 'MiB', 'G' and 'B' as postfix. + +Options which do not take arguments are boolean options, and set the +corresponding value to true. They can be set to false by prefixing +with "no" the option name, for example using "-nofoo" in the +command line will set to false the boolean option with name "foo". + +@anchor{Stream specifiers} +@section Stream specifiers +Some options are applied per-stream, e.g. bitrate or codec. Stream specifiers +are used to precisely specify which stream(s) does a given option belong to. + +A stream specifier is a string generally appended to the option name and +separated from it by a colon. E.g. @code{-codec:a:1 ac3} option contains +@code{a:1} stream specifer, which matches the second audio stream. Therefore it +would select the ac3 codec for the second audio stream. + +A stream specifier can match several stream, the option is then applied to all +of them. E.g. the stream specifier in @code{-b:a 128k} matches all audio +streams. + +An empty stream specifier matches all streams, for example @code{-codec copy} +or @code{-codec: copy} would copy all the streams without reencoding. + +Possible forms of stream specifiers are: +@table @option +@item @var{stream_index} +Matches the stream with this index. E.g. @code{-threads:1 4} would set the +thread count for the second stream to 4. +@item @var{stream_type}[:@var{stream_index}] +@var{stream_type} is one of: 'v' for video, 'a' for audio, 's' for subtitle, +'d' for data and 't' for attachments. If @var{stream_index} is given, then +matches stream number @var{stream_index} of this type. Otherwise matches all +streams of this type. +@item p:@var{program_id}[:@var{stream_index}] +If @var{stream_index} is given, then matches stream number @var{stream_index} in +program with id @var{program_id}. Otherwise matches all streams in this program. +@end table +@section Generic options + +These options are shared amongst the av* tools. + +@table @option + +@item -L +Show license. + +@item -h, -?, -help, --help +Show help. + +@item -version +Show version. + +@item -formats +Show available formats. + +The fields preceding the format names have the following meanings: +@table @samp +@item D +Decoding available +@item E +Encoding available +@end table + +@item -codecs +Show available codecs. + +The fields preceding the codec names have the following meanings: +@table @samp +@item D +Decoding available +@item E +Encoding available +@item V/A/S +Video/audio/subtitle codec +@item S +Codec supports slices +@item D +Codec supports direct rendering +@item T +Codec can handle input truncated at random locations instead of only at frame boundaries +@end table + +@item -bsfs +Show available bitstream filters. + +@item -protocols +Show available protocols. + +@item -filters +Show available libavfilter filters. + +@item -pix_fmts +Show available pixel formats. + +@item -sample_fmts +Show available sample formats. + +@item -loglevel @var{loglevel} | -v @var{loglevel} +Set the logging level used by the library. +@var{loglevel} is a number or a string containing one of the following values: +@table @samp +@item quiet +@item panic +@item fatal +@item error +@item warning +@item info +@item verbose +@item debug +@end table + +By default the program logs to stderr, if coloring is supported by the +terminal, colors are used to mark errors and warnings. Log coloring +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 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. + +@end table + +@section AVOptions + +These options are provided directly by the libavformat, libavdevice and +libavcodec libraries. To see the list of available AVOptions, use the +@option{-help} option. They are separated into two categories: +@table @option +@item generic +These options can be set for any container, codec or device. Generic options +are listed under AVFormatContext options for containers/devices and under +AVCodecContext options for codecs. +@item private +These options are specific to the given container, device or codec. Private +options are listed under their corresponding containers/devices/codecs. +@end table + +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 +ffmpeg -i input.flac -id3v2_version 3 out.mp3 +@end example + +All codec AVOptions are obviously per-stream, so the chapter on stream +specifiers applies to them + +Note @option{-nooption} syntax cannot be used for boolean AVOptions, +use @option{-option 0}/@option{-option 1}. + +Note2 old undocumented way of specifying per-stream AVOptions by prepending +v/a/s to the options name is now obsolete and will be removed soon. diff --git a/lib/ffmpeg/doc/avutil.txt b/lib/ffmpeg/doc/avutil.txt index 210bd07264..0847683d1d 100644 --- a/lib/ffmpeg/doc/avutil.txt +++ b/lib/ffmpeg/doc/avutil.txt @@ -19,7 +19,6 @@ integer.c 128bit integer math lls.c mathematics.c greatest common divisor, integer sqrt, integer log2, ... mem.c memory allocation routines with guaranteed alignment -softfloat.c Headers: bswap.h big/little/native-endian conversion code diff --git a/lib/ffmpeg/doc/bitstream_filters.texi b/lib/ffmpeg/doc/bitstream_filters.texi index 1ad67cd5ef..e131f44324 100644 --- a/lib/ffmpeg/doc/bitstream_filters.texi +++ b/lib/ffmpeg/doc/bitstream_filters.texi @@ -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 -ffmpeg -i ../some_mjpeg.avi -vcodec 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 -ffmpeg -i mjpeg-movie.avi -vcodec copy -vbsf mjpeg2jpeg frame_%d.jpg +ffmpeg -i mjpeg-movie.avi -c:v copy -vbsf mjpeg2jpeg frame_%d.jpg exiftran -i -9 frame*.jpg -ffmpeg -i frame_%d.jpg -vcodec copy rotated.avi +ffmpeg -i frame_%d.jpg -c:v copy rotated.avi @end example @section mjpega_dump_header diff --git a/lib/ffmpeg/doc/build_system.txt b/lib/ffmpeg/doc/build_system.txt index b22ff8487d..36c141e9e4 100644 --- a/lib/ffmpeg/doc/build_system.txt +++ b/lib/ffmpeg/doc/build_system.txt @@ -1,9 +1,38 @@ FFmpeg currently uses a custom build system, this text attempts to document some of its obscure features and options. -Options to make: -make V=1 <target> - Build target with verbosity 1, instead of 1, 2 can be used too +Makefile variables: + +V + Disable the default terse mode, the full command issued by make and its + output will be shown on the screen. + +DESTDIR + Destination directory for the install targets, useful to prepare packages + 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. + +libavformat/output-example + Build the libavformat basic example. + +libavcodec/api-example + Build the libavcodec basic example. + +libswscale/swscale-test + Build the swscale self-test (useful also as example). Useful standard make commands: @@ -19,16 +48,3 @@ 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. - -Targets to make: -fate-list - Will list all fate/regression test targets - -fate - Run the fate test suite, note you must have installed it - - -Setting up local fate: -use the following command to get the fate test samples -rsync -aL rsync://rsync.mplayerhq.hu:/samples/fate-suite/ fate/fate-suite -pass --samples=<path to the samples> to configure diff --git a/lib/ffmpeg/doc/decoders.texi b/lib/ffmpeg/doc/decoders.texi new file mode 100644 index 0000000000..87ad4eea26 --- /dev/null +++ b/lib/ffmpeg/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/lib/ffmpeg/doc/demuxers.texi b/lib/ffmpeg/doc/demuxers.texi index 05316ce5cd..a7af1c8d08 100644 --- a/lib/ffmpeg/doc/demuxers.texi +++ b/lib/ffmpeg/doc/demuxers.texi @@ -49,19 +49,60 @@ 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 @file{ffmpeg} 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 -ffmpeg -r 10 -f image2 -i 'img-%03d.jpeg' out.avi +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 -ffmpeg -f image2 -i img.jpeg img.png +ffmpeg -i img.jpeg img.png @end example +@section applehttp + +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 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/lib/ffmpeg/doc/developer.texi b/lib/ffmpeg/doc/developer.texi index b9e246f214..32d666ac68 100644 --- a/lib/ffmpeg/doc/developer.texi +++ b/lib/ffmpeg/doc/developer.texi @@ -34,59 +34,57 @@ 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. -@anchor{Coding Rules} -@section Coding Rules +@section Contributing -FFmpeg is programmed in the ISO C90 language with a few additional -features from ISO C99, namely: +There are 3 ways by which code gets into ffmpeg. @itemize @bullet -@item -the @samp{inline} keyword; -@item -@samp{//} comments; -@item -designated struct initializers (@samp{struct s x = @{ .i = 17 @};}) -@item -compound literals (@samp{x = (struct s) @{ 17, 23 @};}) +@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 -These features are supported by all compilers we care about, so we will not -accept patches to remove their use unless they absolutely do not impair -clarity and performance. +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. -All code must compile with GCC 2.95 and GCC 3.3. Currently, FFmpeg also -compiles with several other compilers, such as the Compaq ccc compiler -or Sun Studio 9, and we would like to keep it that way unless it would -be exceedingly involved. To ensure compatibility, please do not use any -additional C99 features or GCC extensions. Especially watch out for: +@anchor{Coding Rules} +@section Coding Rules + +@subsection Code formatting conventions + +There are the following guidelines regarding the indentation in files: @itemize @bullet @item -mixing statements and declarations; -@item -@samp{long long} (use @samp{int64_t} instead); +Indent size is 4. @item -@samp{__attribute__} not protected by @samp{#ifdef __GNUC__} or similar; +The TAB character is forbidden outside of Makefiles as is any +form of trailing whitespace. Commits containing either will be +rejected by the git repository. @item -GCC statement expressions (@samp{(x = (@{ int y = 4; y; @})}). +You should try to limit your code lines to 80 characters; however, do so if +and only if this improves readability. @end itemize - -Indent size is 4. The presentation is one inspired by 'indent -i4 -kr -nut'. -The TAB character is forbidden outside of Makefiles as is any -form of trailing whitespace. Commits containing either will be -rejected by the Subversion repository. The main priority in FFmpeg is simplicity and small code size in order to minimize the bug count. -Comments: Use the JavaDoc/Doxygen -format (see examples below) so that code documentation +@subsection Comments +Use the JavaDoc/Doxygen format (see examples below) so that code documentation can be generated automatically. All nontrivial functions should have a comment above them explaining what the function does, even if it is just one sentence. All structures and their member variables should be documented, too. + +Avoid Qt-style and similar Doxygen syntax with @code{!} in it, i.e. replace +@code{//!} with @code{///} and similar. Also @@ syntax should be employed +for markup commands, i.e. use @code{@@param} and not @code{\param}. + @example /** - * @@file mpeg.c + * @@file * MPEG codec. * @@author ... */ @@ -114,11 +112,97 @@ int myfunc(int my_parameter) ... @end example +@subsection C language features + +FFmpeg is programmed in the ISO C90 language with a few additional +features from ISO C99, namely: +@itemize @bullet +@item +the @samp{inline} keyword; +@item +@samp{//} comments; +@item +designated struct initializers (@samp{struct s x = @{ .i = 17 @};}) +@item +compound literals (@samp{x = (struct s) @{ 17, 23 @};}) +@end itemize + +These features are supported by all compilers we care about, so we will not +accept patches to remove their use unless they absolutely do not impair +clarity and performance. + +All code must compile with recent versions of GCC and a number of other +currently supported compilers. To ensure compatibility, please do not use +additional C99 features or GCC extensions. Especially watch out for: +@itemize @bullet +@item +mixing statements and declarations; +@item +@samp{long long} (use @samp{int64_t} instead); +@item +@samp{__attribute__} not protected by @samp{#ifdef __GNUC__} or similar; +@item +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 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 +@item +For local variables no prefix is required. +@item +For variables and functions declared as @code{static} no prefixes are required. +@item +For variables and functions used internally by the library, @code{ff_} prefix +should be used. +For example, @samp{ff_w64_demuxer}. +@item +For variables and functions used internally across multiple libraries, use +@code{avpriv_}. For example, @samp{avpriv_aac_parse_header}. +@item +For exported names, each library has its own prefixes. Just check the existing +code and name accordingly. +@end itemize + +@subsection Miscellanous conventions +@itemize @bullet +@item fprintf and printf are forbidden in libavformat and libavcodec, please use av_log() instead. - +@item Casts should be used only when necessary. Unneeded parentheses 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 FFmpeg formatting conventions, paste +the following snippet into your @file{.vimrc}: +@example +" indentation rules for FFmpeg: 4 spaces, no tabs +set expandtab +set shiftwidth=4 +set softtabstop=4 +" allow tabs in Makefiles +autocmd FileType make set noexpandtab shiftwidth=8 softtabstop=8 +" Trailing whitespace and tabs are forbidden, so highlight them. +highlight ForbiddenWhitespace ctermbg=red guibg=red +match ForbiddenWhitespace /\s\+$\|\t/ +" Do not highlight spaces at the end of line while typing on that line. +autocmd InsertEnter * match ForbiddenWhitespace /\t\|\s\+\%#\@@<!$/ +@end example + +For Emacs, add these roughly equivalent lines to your @file{.emacs.d/init.el}: +@example +(setq c-default-style "k&r") +(setq-default c-basic-offset 4) +(setq-default indent-tabs-mode nil) +(setq-default show-trailing-whitespace t) +@end example @section Development Policy @@ -180,10 +264,13 @@ should also be avoided if they don't make the code easier to understand. 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 - If you apply a patch by someone else, include the name and email address in - the log message. Since the ffmpeg-cvslog mailing list is publicly - archived you should add some SPAM protection to the email address. Send an + 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 @@ -212,7 +299,7 @@ should also be avoided if they don't make the code easier to understand. always check values read from some untrusted source before using them 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 @@ -239,12 +326,14 @@ We think our rules are not too hard. If you have comments, contact us. Note, these rules are mostly borrowed from the MPlayer project. +@anchor{Submitting patches} @section Submitting patches -First, (@pxref{Coding Rules}) above if you did not yet. +First, read the @ref{Coding Rules} above if you did not yet, in particular +the rules regarding patch submission. -When you submit your patch, try to send a unified diff (diff '-up' -option). We cannot read other diffs :-) +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 @@ -256,13 +345,13 @@ for us and greatly increases your chances of getting your patch applied. Use the patcheck tool of FFmpeg to check your patch. The tool is located in the tools directory. -Run the regression tests before submitting a patch so that you can -verify that there are no big problems. +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 ffmpeg-devel mailing list, see -@url{http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel} +@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 @@ -291,13 +380,13 @@ send a reminder by email. Your patch should eventually be dealt with. AVInputFormat/AVOutputFormat struct? @item Did you bump the minor version number (and reset the micro version - number) in @file{avcodec.h} or @file{avformat.h}? + number) in @file{libavcodec/version.h} or @file{libavformat/version.h}? @item Did you register it in @file{allcodecs.c} or @file{allformats.c}? @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? @@ -312,22 +401,31 @@ send a reminder by email. Your patch should eventually be dealt with. If it depends on a parser or a library, did you add that dependency in configure? @item - Did you "svn add" the appropriate files before commiting? + Did you @code{git add} the appropriate files before committing? +@item + Did you make sure it compiles standalone, i.e. with + @code{configure --disable-everything --enable-decoder=foo} + (or @code{--enable-demuxer} or whatever your component is)? @end enumerate + @section patch submission checklist @enumerate @item - Do the regression tests pass with the patch applied? + Does @code{make fate} pass with the patch applied? +@item + Was the patch generated with git format-patch or send-email? @item - Does @code{make checkheaders} pass with the patch applied? + 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 - Is the patch a unified diff? + Did you provide a clear git commit log message? @item - Is the patch against latest FFmpeg SVN? + Is the patch against latest FFmpeg git master branch? @item - Are you subscribed to ffmpeg-dev? + 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 @@ -344,9 +442,6 @@ send a reminder by email. Your patch should eventually be dealt with. tools/trasher and the noise bitstream filter. Your decoder or demuxer should not crash or end in a (near) infinite loop when fed damaged data. @item - Is the patch created from the root of the source tree, so it can be - applied with @code{patch -p0}? -@item Does the patch not mix functional and cosmetic changes? @item Did you add tabs or trailing whitespace to the code? Both are forbidden. @@ -382,13 +477,15 @@ send a reminder by email. Your patch should eventually be dealt with. Lines with similar content should be aligned vertically when doing so improves readability. @item - Did you provide a suggestion for a clear commit log message? + 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 ffmpeg-devel will be reviewed, unless they contain a -clear note that the patch is not for SVN. +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, that can be by resubmitting a changed patch or by discussion. Resubmitted @@ -401,34 +498,23 @@ 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. +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. + 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 +be rejected. Instead, submit significant changes or new features as separate patches. +@anchor{Regression tests} @section Regression tests Before submitting a patch (or committing to the repository), you should at least test that you did not break anything. -The regression tests build a synthetic video stream and a synthetic -audio stream. These are then encoded and decoded with all codecs or -formats. The CRC (or MD5) of each generated file is recorded in a -result file. A 'diff' is launched to compare the reference results and -the result file. The output is checked immediately after each test -has run. - -The regression tests then go on to test the FFserver code with a -limited set of streams. It is important that this step runs correctly -as well. - -Run 'make test' to test all the codecs and formats. Commands like -'make regtest-mpeg2' can be used to run a single test. By default, -make will abort if any test fails. To run all tests regardless, -use make -k. To get a more verbose output, use 'make V=1 test' or -'make V=2 test'. - -Run 'make fulltest' to test all the codecs, formats and FFserver. +Running 'make fate' accomplishes this, please see @url{fate.html} for details. [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 diff --git a/lib/ffmpeg/doc/encoders.texi b/lib/ffmpeg/doc/encoders.texi new file mode 100644 index 0000000000..65841eda7f --- /dev/null +++ b/lib/ffmpeg/doc/encoders.texi @@ -0,0 +1,588 @@ +@chapter Encoders +@c man begin ENCODERS + +Encoders are configured elements in FFmpeg which allow the encoding of +multimedia streams. + +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}. + +You can disable all the encoders with the configure option +@code{--disable-encoders} and selectively enable / disable single encoders +with the options @code{--enable-encoder=@var{ENCODER}} / +@code{--disable-encoder=@var{ENCODER}}. + +The option @code{-codecs} of the ff* tools will display the list of +enabled encoders. + +@c man end ENCODERS + +@chapter Audio Encoders +@c man begin AUDIO ENCODERS + +A description of some of the currently available audio encoders +follows. + +@section ac3 and ac3_fixed + +AC-3 audio encoders. + +These encoders implement part of ATSC A/52:2010 and ETSI TS 102 366, as well as +the undocumented RealAudio 3 (a.k.a. dnet). + +The @var{ac3} encoder uses floating-point math, while the @var{ac3_fixed} +encoder only uses fixed-point integer math. This does not mean that one is +always faster, just that one or the other may be better suited to a +particular system. The floating-point encoder will generally produce better +quality audio for a given bitrate. The @var{ac3_fixed} encoder is not the +default codec for any of the output formats, so it must be specified explicitly +using the option @code{-acodec ac3_fixed} in order to use it. + +@subsection AC-3 Metadata + +The AC-3 metadata options are used to set parameters that describe the audio, +but in most cases do not affect the audio encoding itself. Some of the options +do directly affect or influence the decoding and playback of the resulting +bitstream, while others are just for informational purposes. A few of the +options will add bits to the output stream that could otherwise be used for +audio data, and will thus affect the quality of the output. Those will be +indicated accordingly with a note in the option list below. + +These parameters are described in detail in several publicly-available +documents. +@itemize +@item @uref{http://www.atsc.org/cms/standards/a_52-2010.pdf,A/52:2010 - Digital Audio Compression (AC-3) (E-AC-3) Standard} +@item @uref{http://www.atsc.org/cms/standards/a_54a_with_corr_1.pdf,A/54 - Guide to the Use of the ATSC Digital Television Standard} +@item @uref{http://www.dolby.com/uploadedFiles/zz-_Shared_Assets/English_PDFs/Professional/18_Metadata.Guide.pdf,Dolby Metadata Guide} +@item @uref{http://www.dolby.com/uploadedFiles/zz-_Shared_Assets/English_PDFs/Professional/46_DDEncodingGuidelines.pdf,Dolby Digital Professional Encoding Guidelines} +@end itemize + +@subsubsection Metadata Control Options + +@table @option + +@item -per_frame_metadata @var{boolean} +Allow Per-Frame Metadata. Specifies if the encoder should check for changing +metadata for each frame. +@table @option +@item 0 +The metadata values set at initialization will be used for every frame in the +stream. (default) +@item 1 +Metadata values can be changed before encoding each frame. +@end table + +@end table + +@subsubsection Downmix Levels + +@table @option + +@item -center_mixlev @var{level} +Center Mix Level. The amount of gain the decoder should apply to the center +channel when downmixing to stereo. This field will only be written to the +bitstream if a center channel is present. The value is specified as a scale +factor. There are 3 valid values: +@table @option +@item 0.707 +Apply -3dB gain +@item 0.595 +Apply -4.5dB gain (default) +@item 0.500 +Apply -6dB gain +@end table + +@item -surround_mixlev @var{level} +Surround Mix Level. The amount of gain the decoder should apply to the surround +channel(s) when downmixing to stereo. This field will only be written to the +bitstream if one or more surround channels are present. The value is specified +as a scale factor. There are 3 valid values: +@table @option +@item 0.707 +Apply -3dB gain +@item 0.500 +Apply -6dB gain (default) +@item 0.000 +Silence Surround Channel(s) +@end table + +@end table + +@subsubsection Audio Production Information +Audio Production Information is optional information describing the mixing +environment. Either none or both of the fields are written to the bitstream. + +@table @option + +@item -mixing_level @var{number} +Mixing Level. Specifies peak sound pressure level (SPL) in the production +environment when the mix was mastered. Valid values are 80 to 111, or -1 for +unknown or not indicated. The default value is -1, but that value cannot be +used if the Audio Production Information is written to the bitstream. Therefore, +if the @code{room_type} option is not the default value, the @code{mixing_level} +option must not be -1. + +@item -room_type @var{type} +Room Type. Describes the equalization used during the final mixing session at +the studio or on the dubbing stage. A large room is a dubbing stage with the +industry standard X-curve equalization; a small room has flat equalization. +This field will not be written to the bitstream if both the @code{mixing_level} +option and the @code{room_type} option have the default values. +@table @option +@item 0 +@itemx notindicated +Not Indicated (default) +@item 1 +@itemx large +Large Room +@item 2 +@itemx small +Small Room +@end table + +@end table + +@subsubsection Other Metadata Options + +@table @option + +@item -copyright @var{boolean} +Copyright Indicator. Specifies whether a copyright exists for this audio. +@table @option +@item 0 +@itemx off +No Copyright Exists (default) +@item 1 +@itemx on +Copyright Exists +@end table + +@item -dialnorm @var{value} +Dialogue Normalization. Indicates how far the average dialogue level of the +program is below digital 100% full scale (0 dBFS). This parameter determines a +level shift during audio reproduction that sets the average volume of the +dialogue to a preset level. The goal is to match volume level between program +sources. A value of -31dB will result in no volume level change, relative to +the source volume, during audio reproduction. Valid values are whole numbers in +the range -31 to -1, with -31 being the default. + +@item -dsur_mode @var{mode} +Dolby Surround Mode. Specifies whether the stereo signal uses Dolby Surround +(Pro Logic). This field will only be written to the bitstream if the audio +stream is stereo. Using this option does @b{NOT} mean the encoder will actually +apply Dolby Surround processing. +@table @option +@item 0 +@itemx notindicated +Not Indicated (default) +@item 1 +@itemx off +Not Dolby Surround Encoded +@item 2 +@itemx on +Dolby Surround Encoded +@end table + +@item -original @var{boolean} +Original Bit Stream Indicator. Specifies whether this audio is from the +original source and not a copy. +@table @option +@item 0 +@itemx off +Not Original Source +@item 1 +@itemx on +Original Source (default) +@end table + +@end table + +@subsection Extended Bitstream Information +The extended bitstream options are part of the Alternate Bit Stream Syntax as +specified in Annex D of the A/52:2010 standard. It is grouped into 2 parts. +If any one parameter in a group is specified, all values in that group will be +written to the bitstream. Default values are used for those that are written +but have not been specified. If the mixing levels are written, the decoder +will use these values instead of the ones specified in the @code{center_mixlev} +and @code{surround_mixlev} options if it supports the Alternate Bit Stream +Syntax. + +@subsubsection Extended Bitstream Information - Part 1 + +@table @option + +@item -dmix_mode @var{mode} +Preferred Stereo Downmix Mode. Allows the user to select either Lt/Rt +(Dolby Surround) or Lo/Ro (normal stereo) as the preferred stereo downmix mode. +@table @option +@item 0 +@itemx notindicated +Not Indicated (default) +@item 1 +@itemx ltrt +Lt/Rt Downmix Preferred +@item 2 +@itemx loro +Lo/Ro Downmix Preferred +@end table + +@item -ltrt_cmixlev @var{level} +Lt/Rt Center Mix Level. The amount of gain the decoder should apply to the +center channel when downmixing to stereo in Lt/Rt mode. +@table @option +@item 1.414 +Apply +3dB gain +@item 1.189 +Apply +1.5dB gain +@item 1.000 +Apply 0dB gain +@item 0.841 +Apply -1.5dB gain +@item 0.707 +Apply -3.0dB gain +@item 0.595 +Apply -4.5dB gain (default) +@item 0.500 +Apply -6.0dB gain +@item 0.000 +Silence Center Channel +@end table + +@item -ltrt_surmixlev @var{level} +Lt/Rt Surround Mix Level. The amount of gain the decoder should apply to the +surround channel(s) when downmixing to stereo in Lt/Rt mode. +@table @option +@item 0.841 +Apply -1.5dB gain +@item 0.707 +Apply -3.0dB gain +@item 0.595 +Apply -4.5dB gain +@item 0.500 +Apply -6.0dB gain (default) +@item 0.000 +Silence Surround Channel(s) +@end table + +@item -loro_cmixlev @var{level} +Lo/Ro Center Mix Level. The amount of gain the decoder should apply to the +center channel when downmixing to stereo in Lo/Ro mode. +@table @option +@item 1.414 +Apply +3dB gain +@item 1.189 +Apply +1.5dB gain +@item 1.000 +Apply 0dB gain +@item 0.841 +Apply -1.5dB gain +@item 0.707 +Apply -3.0dB gain +@item 0.595 +Apply -4.5dB gain (default) +@item 0.500 +Apply -6.0dB gain +@item 0.000 +Silence Center Channel +@end table + +@item -loro_surmixlev @var{level} +Lo/Ro Surround Mix Level. The amount of gain the decoder should apply to the +surround channel(s) when downmixing to stereo in Lo/Ro mode. +@table @option +@item 0.841 +Apply -1.5dB gain +@item 0.707 +Apply -3.0dB gain +@item 0.595 +Apply -4.5dB gain +@item 0.500 +Apply -6.0dB gain (default) +@item 0.000 +Silence Surround Channel(s) +@end table + +@end table + +@subsubsection Extended Bitstream Information - Part 2 + +@table @option + +@item -dsurex_mode @var{mode} +Dolby Surround EX Mode. Indicates whether the stream uses Dolby Surround EX +(7.1 matrixed to 5.1). Using this option does @b{NOT} mean the encoder will actually +apply Dolby Surround EX processing. +@table @option +@item 0 +@itemx notindicated +Not Indicated (default) +@item 1 +@itemx on +Dolby Surround EX Off +@item 2 +@itemx off +Dolby Surround EX On +@end table + +@item -dheadphone_mode @var{mode} +Dolby Headphone Mode. Indicates whether the stream uses Dolby Headphone +encoding (multi-channel matrixed to 2.0 for use with headphones). Using this +option does @b{NOT} mean the encoder will actually apply Dolby Headphone +processing. +@table @option +@item 0 +@itemx notindicated +Not Indicated (default) +@item 1 +@itemx on +Dolby Headphone Off +@item 2 +@itemx off +Dolby Headphone On +@end table + +@item -ad_conv_type @var{type} +A/D Converter Type. Indicates whether the audio has passed through HDCD A/D +conversion. +@table @option +@item 0 +@itemx standard +Standard A/D Converter (default) +@item 1 +@itemx hdcd +HDCD A/D Converter +@end table + +@end table + +@subsection Other AC-3 Encoding Options + +@table @option + +@item -stereo_rematrixing @var{boolean} +Stereo Rematrixing. Enables/Disables use of rematrixing for stereo input. This +is an optional AC-3 feature that increases quality by selectively encoding +the left/right channels as mid/side. This option is enabled by default, and it +is highly recommended that it be left as enabled except for testing purposes. + +@end table + +@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 +implemented in fixed-point. + +@table @option + +@item -channel_coupling @var{boolean} +Enables/Disables use of channel coupling, which is an optional AC-3 feature +that increases quality by combining high frequency information from multiple +channels into a single channel. The per-channel high frequency information is +sent with less accuracy in both the frequency and time domains. This allows +more bits to be used for lower frequencies while preserving enough information +to reconstruct the high frequencies. This option is enabled by default for the +floating-point encoder and should generally be left as enabled except for +testing purposes or to increase encoding speed. +@table @option +@item -1 +@itemx auto +Selected by Encoder (default) +@item 0 +@itemx off +Disable Channel Coupling +@item 1 +@itemx on +Enable Channel Coupling +@end table + +@item -cpl_start_band @var{number} +Coupling Start Band. Sets the channel coupling start band, from 1 to 15. If a +value higher than the bandwidth is used, it will be reduced to 1 less than the +coupling end band. If @var{auto} is used, the start band will be determined by +the encoder based on the bit rate, sample rate, and channel layout. This option +has no effect if channel coupling is disabled. +@table @option +@item -1 +@itemx auto +Selected by Encoder (default) +@end table + +@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/lib/ffmpeg/doc/errno.txt b/lib/ffmpeg/doc/errno.txt new file mode 100644 index 0000000000..31cab26fc2 --- /dev/null +++ b/lib/ffmpeg/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/lib/ffmpeg/doc/eval.texi b/lib/ffmpeg/doc/eval.texi index 99cd034cdf..92fdc6d0a6 100644 --- a/lib/ffmpeg/doc/eval.texi +++ b/lib/ffmpeg/doc/eval.texi @@ -1,7 +1,7 @@ @chapter Expression Evaluation @c man begin EXPRESSION EVALUATION -When evaluating an arithemetic expression, FFmpeg uses an internal +When evaluating an arithmetic expression, FFmpeg uses an internal formula evaluator, implemented through the @file{libavutil/eval.h} interface. @@ -50,36 +50,88 @@ 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 -@var{var}, which was previosly stored with st(@var{var}, @var{expr}). +@var{var}, which was previously stored with st(@var{var}, @var{expr}). The function returns the loaded value. @item while(cond, expr) Evaluate expression @var{expr} while the expression @var{cond} is non-zero, and returns the value of the last @var{expr} evaluation, or NAN if @var{cond} was always false. + +@item ceil(expr) +Round the value of expression @var{expr} upwards to the nearest +integer. For example, "ceil(1.5)" is "2.0". + +@item floor(expr) +Round the value of expression @var{expr} downwards to the nearest +integer. For example, "floor(-1.5)" is "-2.0". + +@item trunc(expr) +Round the value of expression @var{expr} towards zero to the nearest +integer. For example, "trunc(-1.5)" is "-1.0". + +@item sqrt(expr) +Compute the square root of @var{expr}. This is equivalent to +"(@var{expr})^.5". + +@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. @end table -Note that: +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 + +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 -@end example - -When A evaluates to either 1 or 0, that is the same as -@example -A*B + eq(A,0)*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/lib/ffmpeg/doc/examples/Makefile b/lib/ffmpeg/doc/examples/Makefile new file mode 100644 index 0000000000..b363590d53 --- /dev/null +++ b/lib/ffmpeg/doc/examples/Makefile @@ -0,0 +1,21 @@ +# use pkg-config for getting CFLAGS abd LDFLAGS +FFMPEG_LIBS=libavdevice libavformat libavfilter libavcodec libswscale libavutil +CFLAGS+=$(shell pkg-config --cflags $(FFMPEG_LIBS)) +LDFLAGS+=$(shell pkg-config --libs $(FFMPEG_LIBS)) + +EXAMPLES=decoding_encoding filtering 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/lib/ffmpeg/doc/examples/decoding_encoding.c b/lib/ffmpeg/doc/examples/decoding_encoding.c new file mode 100644 index 0000000000..5271edf34e --- /dev/null +++ b/lib/ffmpeg/doc/examples/decoding_encoding.c @@ -0,0 +1,477 @@ +/* + * Copyright (c) 2001 Fabrice Bellard + * + * 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 + * libavcodec API use example. + * + * 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 "libavutil/imgutils.h" +#include "libavutil/opt.h" +#include "libavcodec/avcodec.h" +#include "libavutil/mathematics.h" +#include "libavutil/samplefmt.h" + +#define INBUF_SIZE 4096 +#define AUDIO_INBUF_SIZE 20480 +#define AUDIO_REFILL_THRESH 4096 + +/* + * Audio encoding example + */ +static void audio_encode_example(const char *filename) +{ + AVCodec *codec; + AVCodecContext *c= NULL; + int frame_size, i, j, out_size, outbuf_size; + FILE *f; + short *samples; + float t, tincr; + uint8_t *outbuf; + + printf("Audio encoding\n"); + + /* find the MP2 encoder */ + codec = avcodec_find_encoder(CODEC_ID_MP2); + if (!codec) { + fprintf(stderr, "codec not found\n"); + exit(1); + } + + c = avcodec_alloc_context3(codec); + + /* put sample parameters */ + c->bit_rate = 64000; + c->sample_rate = 44100; + c->channels = 2; + c->sample_fmt = AV_SAMPLE_FMT_S16; + + /* open it */ + if (avcodec_open(c, codec) < 0) { + fprintf(stderr, "could not open codec\n"); + exit(1); + } + + /* the codec gives us the frame size, in samples */ + frame_size = c->frame_size; + samples = malloc(frame_size * 2 * c->channels); + outbuf_size = 10000; + outbuf = malloc(outbuf_size); + + f = fopen(filename, "wb"); + if (!f) { + fprintf(stderr, "could not open %s\n", filename); + exit(1); + } + + /* encode a single tone sound */ + t = 0; + tincr = 2 * M_PI * 440.0 / c->sample_rate; + for(i=0;i<200;i++) { + for(j=0;j<frame_size;j++) { + samples[2*j] = (int)(sin(t) * 10000); + samples[2*j+1] = samples[2*j]; + t += tincr; + } + /* encode the samples */ + out_size = avcodec_encode_audio(c, outbuf, outbuf_size, samples); + fwrite(outbuf, 1, out_size, f); + } + fclose(f); + free(outbuf); + free(samples); + + avcodec_close(c); + av_free(c); +} + +/* + * Audio decoding. + */ +static void audio_decode_example(const char *outfilename, const char *filename) +{ + AVCodec *codec; + AVCodecContext *c= NULL; + int len; + FILE *f, *outfile; + uint8_t inbuf[AUDIO_INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; + AVPacket avpkt; + AVFrame *decoded_frame = NULL; + + av_init_packet(&avpkt); + + printf("Audio decoding\n"); + + /* find the mpeg audio decoder */ + codec = avcodec_find_decoder(CODEC_ID_MP2); + if (!codec) { + fprintf(stderr, "codec not found\n"); + exit(1); + } + + c = avcodec_alloc_context3(codec); + + /* open it */ + if (avcodec_open(c, codec) < 0) { + fprintf(stderr, "could not open codec\n"); + exit(1); + } + + f = fopen(filename, "rb"); + if (!f) { + fprintf(stderr, "could not open %s\n", filename); + exit(1); + } + outfile = fopen(outfilename, "wb"); + if (!outfile) { + av_free(c); + exit(1); + } + + /* decode until eof */ + avpkt.data = inbuf; + avpkt.size = fread(inbuf, 1, AUDIO_INBUF_SIZE, f); + + while (avpkt.size > 0) { + int got_frame = 0; + + if (!decoded_frame) { + if (!(decoded_frame = avcodec_alloc_frame())) { + fprintf(stderr, "out of memory\n"); + exit(1); + } + } else + avcodec_get_frame_defaults(decoded_frame); + + len = avcodec_decode_audio4(c, decoded_frame, &got_frame, &avpkt); + if (len < 0) { + fprintf(stderr, "Error while decoding\n"); + exit(1); + } + if (got_frame) { + /* if a frame has been decoded, output it */ + int data_size = av_samples_get_buffer_size(NULL, c->channels, + decoded_frame->nb_samples, + c->sample_fmt, 1); + fwrite(decoded_frame->data[0], 1, data_size, outfile); + } + 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 + * a parser, or use a proper container format through + * libavformat. */ + memmove(inbuf, avpkt.data, avpkt.size); + avpkt.data = inbuf; + len = fread(avpkt.data + avpkt.size, 1, + AUDIO_INBUF_SIZE - avpkt.size, f); + if (len > 0) + avpkt.size += len; + } + } + + fclose(outfile); + fclose(f); + + avcodec_close(c); + av_free(c); + av_free(decoded_frame); +} + +/* + * Video encoding example + */ +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; + FILE *f; + AVFrame *picture; + uint8_t *outbuf; + + printf("Video encoding\n"); + + /* find the mpeg1 video encoder */ + codec = avcodec_find_encoder(codec_id); + if (!codec) { + fprintf(stderr, "codec not found\n"); + exit(1); + } + + c = avcodec_alloc_context3(codec); + picture= avcodec_alloc_frame(); + + /* put sample parameters */ + c->bit_rate = 400000; + /* resolution must be a multiple of two */ + c->width = 352; + c->height = 288; + /* frames per second */ + c->time_base= (AVRational){1,25}; + c->gop_size = 10; /* emit one intra frame every ten frames */ + 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_open(c, codec) < 0) { + fprintf(stderr, "could not open codec\n"); + exit(1); + } + + f = fopen(filename, "wb"); + if (!f) { + fprintf(stderr, "could not open %s\n", filename); + exit(1); + } + + /* alloc image and output buffer */ + outbuf_size = 100000; + outbuf = malloc(outbuf_size); + + /* 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++) { + fflush(stdout); + /* prepare a dummy image */ + /* Y */ + for(y=0;y<c->height;y++) { + for(x=0;x<c->width;x++) { + picture->data[0][y * picture->linesize[0] + x] = x + y + i * 3; + } + } + + /* Cb and Cr */ + for(y=0;y<c->height/2;y++) { + for(x=0;x<c->width/2;x++) { + picture->data[1][y * picture->linesize[1] + x] = 128 + y + i * 2; + picture->data[2][y * picture->linesize[2] + x] = 64 + x + i * 5; + } + } + + /* encode the image */ + out_size = avcodec_encode_video(c, outbuf, outbuf_size, picture); + printf("encoding frame %3d (size=%5d)\n", i, out_size); + fwrite(outbuf, 1, out_size, f); + } + + /* get the delayed frames */ + for(; out_size; i++) { + fflush(stdout); + + out_size = avcodec_encode_video(c, outbuf, outbuf_size, NULL); + printf("write frame %3d (size=%5d)\n", i, out_size); + fwrite(outbuf, 1, out_size, f); + } + + /* add sequence end code to have a real mpeg file */ + outbuf[0] = 0x00; + outbuf[1] = 0x00; + outbuf[2] = 0x01; + outbuf[3] = 0xb7; + fwrite(outbuf, 1, 4, f); + fclose(f); + free(outbuf); + + avcodec_close(c); + av_free(c); + av_free(picture->data[0]); + av_free(picture); + printf("\n"); +} + +/* + * Video decoding example + */ + +static void pgm_save(unsigned char *buf, int wrap, int xsize, int ysize, + char *filename) +{ + FILE *f; + int i; + + f=fopen(filename,"w"); + fprintf(f,"P5\n%d %d\n%d\n",xsize,ysize,255); + for(i=0;i<ysize;i++) + fwrite(buf + i * wrap,1,xsize,f); + fclose(f); +} + +static void video_decode_example(const char *outfilename, const char *filename) +{ + AVCodec *codec; + AVCodecContext *c= NULL; + int frame, got_picture, len; + FILE *f; + AVFrame *picture; + uint8_t inbuf[INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; + char buf[1024]; + AVPacket avpkt; + + av_init_packet(&avpkt); + + /* set end of buffer to 0 (this ensures that no overreading happens for damaged mpeg streams) */ + memset(inbuf + INBUF_SIZE, 0, FF_INPUT_BUFFER_PADDING_SIZE); + + printf("Video decoding\n"); + + /* find the mpeg1 video decoder */ + codec = avcodec_find_decoder(CODEC_ID_MPEG1VIDEO); + if (!codec) { + fprintf(stderr, "codec not found\n"); + exit(1); + } + + c = avcodec_alloc_context3(codec); + picture= avcodec_alloc_frame(); + + if(codec->capabilities&CODEC_CAP_TRUNCATED) + c->flags|= CODEC_FLAG_TRUNCATED; /* we do not send complete frames */ + + /* For some codecs, such as msmpeg4 and mpeg4, width and height + MUST be initialized there because this information is not + available in the bitstream. */ + + /* open it */ + if (avcodec_open(c, codec) < 0) { + fprintf(stderr, "could not open codec\n"); + exit(1); + } + + /* the codec gives us the frame size, in samples */ + + f = fopen(filename, "rb"); + if (!f) { + fprintf(stderr, "could not open %s\n", filename); + exit(1); + } + + frame = 0; + for(;;) { + avpkt.size = fread(inbuf, 1, INBUF_SIZE, f); + if (avpkt.size == 0) + break; + + /* NOTE1: some codecs are stream based (mpegvideo, mpegaudio) + and this is the only method to use them because you cannot + know the compressed data size before analysing it. + + BUT some other codecs (msmpeg4, mpeg4) are inherently frame + based, so you must call them with all the data for one + frame exactly. You must also initialize 'width' and + 'height' before initializing them. */ + + /* NOTE2: some codecs allow the raw parameters (frame size, + sample rate) to be changed at any frame. We handle this, so + you should also take care of it */ + + /* here, we use a stream based decoder (mpeg1video), so we + feed decoder and see if it could decode a frame */ + avpkt.data = inbuf; + while (avpkt.size > 0) { + len = avcodec_decode_video2(c, picture, &got_picture, &avpkt); + if (len < 0) { + fprintf(stderr, "Error while decoding frame %d\n", frame); + exit(1); + } + if (got_picture) { + printf("saving frame %3d\n", frame); + fflush(stdout); + + /* the picture is allocated by the decoder. no need to + free it */ + snprintf(buf, sizeof(buf), outfilename, frame); + pgm_save(picture->data[0], picture->linesize[0], + c->width, c->height, buf); + frame++; + } + avpkt.size -= len; + avpkt.data += len; + } + } + + /* some codecs, such as MPEG, transmit the I and P frame with a + latency of one frame. You must do the following to have a + chance to get the last frame of the video */ + avpkt.data = NULL; + avpkt.size = 0; + len = avcodec_decode_video2(c, picture, &got_picture, &avpkt); + if (got_picture) { + printf("saving last frame %3d\n", frame); + fflush(stdout); + + /* the picture is allocated by the decoder. no need to + free it */ + snprintf(buf, sizeof(buf), outfilename, frame); + pgm_save(picture->data[0], picture->linesize[0], + c->width, c->height, buf); + frame++; + } + + fclose(f); + + avcodec_close(c); + av_free(c); + av_free(picture); + printf("\n"); +} + +int main(int argc, char **argv) +{ + const char *filename; + + /* must be called before using avcodec lib */ + avcodec_init(); + + /* register all the codecs */ + avcodec_register_all(); + + if (argc <= 1) { + audio_encode_example("/tmp/test.mp2"); + audio_decode_example("/tmp/test.sw", "/tmp/test.mp2"); + + 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]; + } + + // audio_decode_example("/tmp/test.sw", filename); + video_decode_example("/tmp/test%d.pgm", filename); + + return 0; +} diff --git a/lib/ffmpeg/doc/examples/filtering.c b/lib/ffmpeg/doc/examples/filtering.c new file mode 100644 index 0000000000..06e513026e --- /dev/null +++ b/lib/ffmpeg/doc/examples/filtering.c @@ -0,0 +1,229 @@ +/* + * 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 <libavcodec/avcodec.h> +#include <libavformat/avformat.h> +#include <libavfilter/avfiltergraph.h> +#include <libavfilter/vsrc_buffer.h> + +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, i; + 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 = av_find_stream_info(fmt_ctx)) < 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_open(dec_ctx, dec)) < 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; +} + +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); + + /* pull filtered pictures from the filtergraph */ + while (avfilter_poll_frame(buffersink_ctx->inputs[0])) { + av_vsink_buffer_get_video_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); + av_close_input_file(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/lib/ffmpeg/doc/examples/metadata.c b/lib/ffmpeg/doc/examples/metadata.c new file mode 100644 index 0000000000..7d29be7049 --- /dev/null +++ b/lib/ffmpeg/doc/examples/metadata.c @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2011 Reinhard Tartler + * + * 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 + * Shows how the metadata API can be used in application programs. + */ + +#include <stdio.h> + +#include <libavformat/avformat.h> +#include <libavutil/dict.h> + +int main (int argc, char **argv) +{ + AVFormatContext *fmt_ctx = NULL; + AVDictionaryEntry *tag = NULL; + int ret; + + if (argc != 2) { + printf("usage: %s <input_file>\n" + "example program to demonstrate the use of the libavformat metadata API.\n" + "\n", argv[0]); + return 1; + } + + av_register_all(); + if ((ret = avformat_open_input(&fmt_ctx, argv[1], NULL, NULL))) + return ret; + + while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) + printf("%s=%s\n", tag->key, tag->value); + + avformat_free_context(fmt_ctx); + return 0; +} diff --git a/lib/ffmpeg/doc/examples/muxing.c b/lib/ffmpeg/doc/examples/muxing.c new file mode 100644 index 0000000000..e72bfacc49 --- /dev/null +++ b/lib/ffmpeg/doc/examples/muxing.c @@ -0,0 +1,556 @@ +/* + * Copyright (c) 2003 Fabrice Bellard + * + * 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 + * libavformat API example. + * + * Output a media file in any supported libavformat format. + * The default codecs are used. + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <math.h> + +#include "libavutil/mathematics.h" +#include "libavformat/avformat.h" +#include "libswscale/swscale.h" + +#undef exit + +/* 5 seconds stream duration */ +#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 */ + +static int sws_flags = SWS_BICUBIC; + +/**************************************************************/ +/* audio output */ + +static float t, tincr, tincr2; +static int16_t *samples; +static uint8_t *audio_outbuf; +static int audio_outbuf_size; +static int audio_input_frame_size; + +/* + * add an audio output stream + */ +static AVStream *add_audio_stream(AVFormatContext *oc, enum CodecID codec_id) +{ + AVCodecContext *c; + AVStream *st; + + st = avformat_new_stream(oc, NULL); + if (!st) { + fprintf(stderr, "Could not alloc stream\n"); + exit(1); + } + st->id = 1; + + c = st->codec; + c->codec_id = codec_id; + c->codec_type = AVMEDIA_TYPE_AUDIO; + + /* put sample parameters */ + c->sample_fmt = AV_SAMPLE_FMT_S16; + c->bit_rate = 64000; + c->sample_rate = 44100; + c->channels = 2; + + // some formats want stream headers to be separate + if (oc->oformat->flags & AVFMT_GLOBALHEADER) + c->flags |= CODEC_FLAG_GLOBAL_HEADER; + + return st; +} + +static void open_audio(AVFormatContext *oc, AVStream *st) +{ + AVCodecContext *c; + AVCodec *codec; + + c = st->codec; + + /* find the audio encoder */ + codec = avcodec_find_encoder(c->codec_id); + if (!codec) { + fprintf(stderr, "codec not found\n"); + exit(1); + } + + /* open it */ + if (avcodec_open(c, codec) < 0) { + fprintf(stderr, "could not open codec\n"); + exit(1); + } + + /* init signal generator */ + t = 0; + tincr = 2 * M_PI * 110.0 / c->sample_rate; + /* increment frequency by 110 Hz per second */ + tincr2 = 2 * M_PI * 110.0 / c->sample_rate / c->sample_rate; + + audio_outbuf_size = 10000; + audio_outbuf = av_malloc(audio_outbuf_size); + + /* ugly hack for PCM codecs (will be removed ASAP with new PCM + support to compute the input frame size in samples */ + if (c->frame_size <= 1) { + audio_input_frame_size = audio_outbuf_size / c->channels; + switch(st->codec->codec_id) { + case CODEC_ID_PCM_S16LE: + case CODEC_ID_PCM_S16BE: + case CODEC_ID_PCM_U16LE: + case CODEC_ID_PCM_U16BE: + audio_input_frame_size >>= 1; + break; + default: + break; + } + } else { + audio_input_frame_size = c->frame_size; + } + samples = av_malloc(audio_input_frame_size * 2 * c->channels); +} + +/* prepare a 16 bit dummy audio frame of 'frame_size' samples and + 'nb_channels' channels */ +static void get_audio_frame(int16_t *samples, int frame_size, int nb_channels) +{ + int j, i, v; + int16_t *q; + + q = samples; + for (j = 0; j < frame_size; j++) { + v = (int)(sin(t) * 10000); + for(i = 0; i < nb_channels; i++) + *q++ = v; + t += tincr; + tincr += tincr2; + } +} + +static void write_audio_frame(AVFormatContext *oc, AVStream *st) +{ + AVCodecContext *c; + AVPacket pkt; + av_init_packet(&pkt); + + c = st->codec; + + get_audio_frame(samples, audio_input_frame_size, c->channels); + + pkt.size = avcodec_encode_audio(c, audio_outbuf, audio_outbuf_size, samples); + + if (c->coded_frame && c->coded_frame->pts != AV_NOPTS_VALUE) + pkt.pts= av_rescale_q(c->coded_frame->pts, c->time_base, st->time_base); + pkt.flags |= AV_PKT_FLAG_KEY; + pkt.stream_index = st->index; + pkt.data = audio_outbuf; + + /* write the compressed frame in the media file */ + if (av_interleaved_write_frame(oc, &pkt) != 0) { + fprintf(stderr, "Error while writing audio frame\n"); + exit(1); + } +} + +static void close_audio(AVFormatContext *oc, AVStream *st) +{ + avcodec_close(st->codec); + + av_free(samples); + av_free(audio_outbuf); +} + +/**************************************************************/ +/* video output */ + +static AVFrame *picture, *tmp_picture; +static uint8_t *video_outbuf; +static int frame_count, video_outbuf_size; + +/* add a video output stream */ +static AVStream *add_video_stream(AVFormatContext *oc, enum CodecID codec_id) +{ + AVCodecContext *c; + AVStream *st; + AVCodec *codec; + + st = avformat_new_stream(oc, NULL); + if (!st) { + fprintf(stderr, "Could not alloc stream\n"); + exit(1); + } + + 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 */ + c->width = 352; + c->height = 288; + /* time base: this is the fundamental unit of time (in seconds) in terms + of which frame timestamps are represented. for fixed-fps content, + timebase should be 1/framerate and timestamp increments should be + identically 1. */ + c->time_base.den = STREAM_FRAME_RATE; + c->time_base.num = 1; + c->gop_size = 12; /* emit one intra frame every twelve frames at most */ + c->pix_fmt = STREAM_PIX_FMT; + if (c->codec_id == CODEC_ID_MPEG2VIDEO) { + /* just for testing, we also add B frames */ + c->max_b_frames = 2; + } + if (c->codec_id == CODEC_ID_MPEG1VIDEO){ + /* Needed to avoid using macroblocks in which some coeffs overflow. + This does not happen with normal video, it just happens here as + the motion of the chroma plane does not match the luma plane. */ + c->mb_decision=2; + } + // some formats want stream headers to be separate + if (oc->oformat->flags & AVFMT_GLOBALHEADER) + c->flags |= CODEC_FLAG_GLOBAL_HEADER; + + return st; +} + +static AVFrame *alloc_picture(enum PixelFormat pix_fmt, int width, int height) +{ + AVFrame *picture; + uint8_t *picture_buf; + int size; + + picture = avcodec_alloc_frame(); + if (!picture) + return NULL; + size = avpicture_get_size(pix_fmt, width, height); + picture_buf = av_malloc(size); + if (!picture_buf) { + av_free(picture); + return NULL; + } + avpicture_fill((AVPicture *)picture, picture_buf, + pix_fmt, width, height); + return picture; +} + +static void open_video(AVFormatContext *oc, AVStream *st) +{ + AVCodec *codec; + AVCodecContext *c; + + c = st->codec; + + /* find the video encoder */ + codec = avcodec_find_encoder(c->codec_id); + if (!codec) { + fprintf(stderr, "codec not found\n"); + exit(1); + } + + /* open the codec */ + if (avcodec_open(c, codec) < 0) { + fprintf(stderr, "could not open codec\n"); + exit(1); + } + + video_outbuf = NULL; + if (!(oc->oformat->flags & AVFMT_RAWPICTURE)) { + /* allocate output buffer */ + /* XXX: API change will be done */ + /* buffers passed into lav* can be allocated any way you prefer, + as long as they're aligned enough for the architecture, and + they're freed appropriately (such as using av_free for buffers + allocated with av_malloc) */ + video_outbuf_size = 200000; + video_outbuf = av_malloc(video_outbuf_size); + } + + /* allocate the encoded raw picture */ + picture = alloc_picture(c->pix_fmt, c->width, c->height); + if (!picture) { + fprintf(stderr, "Could not allocate picture\n"); + exit(1); + } + + /* if the output format is not YUV420P, then a temporary YUV420P + picture is needed too. It is then converted to the required + output format */ + tmp_picture = NULL; + if (c->pix_fmt != PIX_FMT_YUV420P) { + tmp_picture = alloc_picture(PIX_FMT_YUV420P, c->width, c->height); + if (!tmp_picture) { + fprintf(stderr, "Could not allocate temporary picture\n"); + exit(1); + } + } +} + +/* prepare a dummy image */ +static void fill_yuv_image(AVFrame *pict, int frame_index, int width, int height) +{ + int x, y, i; + + i = frame_index; + + /* Y */ + for (y = 0; y < height; y++) { + for (x = 0; x < width; x++) { + pict->data[0][y * pict->linesize[0] + x] = x + y + i * 3; + } + } + + /* Cb and Cr */ + for (y = 0; y < height/2; y++) { + for (x = 0; x < width/2; x++) { + pict->data[1][y * pict->linesize[1] + x] = 128 + y + i * 2; + pict->data[2][y * pict->linesize[2] + x] = 64 + x + i * 5; + } + } +} + +static void write_video_frame(AVFormatContext *oc, AVStream *st) +{ + int out_size, ret; + AVCodecContext *c; + static struct SwsContext *img_convert_ctx; + + c = st->codec; + + if (frame_count >= STREAM_NB_FRAMES) { + /* no more frame to compress. The codec has a latency of a few + frames if using B frames, so we get the last frames by + passing the same picture again */ + } else { + if (c->pix_fmt != PIX_FMT_YUV420P) { + /* as we only generate a YUV420P picture, we must convert it + to the codec pixel format if needed */ + if (img_convert_ctx == NULL) { + img_convert_ctx = sws_getContext(c->width, c->height, + PIX_FMT_YUV420P, + c->width, c->height, + c->pix_fmt, + sws_flags, NULL, NULL, NULL); + if (img_convert_ctx == NULL) { + fprintf(stderr, "Cannot initialize the conversion context\n"); + exit(1); + } + } + fill_yuv_image(tmp_picture, frame_count, c->width, c->height); + sws_scale(img_convert_ctx, tmp_picture->data, tmp_picture->linesize, + 0, c->height, picture->data, picture->linesize); + } else { + fill_yuv_image(picture, frame_count, c->width, c->height); + } + } + + + if (oc->oformat->flags & AVFMT_RAWPICTURE) { + /* raw video case. The API will change slightly in the near + future for that. */ + AVPacket pkt; + av_init_packet(&pkt); + + pkt.flags |= AV_PKT_FLAG_KEY; + pkt.stream_index = st->index; + pkt.data = (uint8_t *)picture; + pkt.size = sizeof(AVPicture); + + ret = av_interleaved_write_frame(oc, &pkt); + } else { + /* encode the image */ + out_size = avcodec_encode_video(c, video_outbuf, video_outbuf_size, picture); + /* if zero size, it means the image was buffered */ + if (out_size > 0) { + AVPacket pkt; + av_init_packet(&pkt); + + if (c->coded_frame->pts != AV_NOPTS_VALUE) + pkt.pts= av_rescale_q(c->coded_frame->pts, 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; + + /* write the compressed frame in the media file */ + ret = av_interleaved_write_frame(oc, &pkt); + } else { + ret = 0; + } + } + if (ret != 0) { + fprintf(stderr, "Error while writing video frame\n"); + exit(1); + } + frame_count++; +} + +static void close_video(AVFormatContext *oc, AVStream *st) +{ + avcodec_close(st->codec); + av_free(picture->data[0]); + av_free(picture); + if (tmp_picture) { + av_free(tmp_picture->data[0]); + av_free(tmp_picture); + } + av_free(video_outbuf); +} + +/**************************************************************/ +/* media file output */ + +int main(int argc, char **argv) +{ + const char *filename; + AVOutputFormat *fmt; + AVFormatContext *oc; + AVStream *audio_st, *video_st; + double audio_pts, video_pts; + int i; + + /* initialize libavcodec, and register all codecs and formats */ + av_register_all(); + + if (argc != 2) { + printf("usage: %s output_file\n" + "API example program to output a media file with libavformat.\n" + "The output format is automatically guessed according to the file extension.\n" + "Raw images can also be output by using '%%d' in the filename\n" + "\n", argv[0]); + return 1; + } + + filename = argv[1]; + + /* 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"); + avformat_alloc_output_context2(&oc, NULL, "mpeg", filename); + } + if (!oc) { + return 1; + } + fmt = oc->oformat; + + /* add the audio and video streams using the default format codecs + and initialize the codecs */ + video_st = NULL; + audio_st = NULL; + if (fmt->video_codec != CODEC_ID_NONE) { + video_st = add_video_stream(oc, fmt->video_codec); + } + if (fmt->audio_codec != CODEC_ID_NONE) { + audio_st = add_audio_stream(oc, fmt->audio_codec); + } + + av_dump_format(oc, 0, filename, 1); + + /* now that all the parameters are set, we can open the audio and + video codecs and allocate the necessary encode buffers */ + if (video_st) + open_video(oc, video_st); + if (audio_st) + open_audio(oc, audio_st); + + /* open the output file, if needed */ + if (!(fmt->flags & AVFMT_NOFILE)) { + if (avio_open(&oc->pb, filename, AVIO_FLAG_WRITE) < 0) { + fprintf(stderr, "Could not open '%s'\n", filename); + return 1; + } + } + + /* write the stream header, if any */ + av_write_header(oc); + picture->pts = 0; + for(;;) { + /* compute current audio and video time */ + if (audio_st) + audio_pts = (double)audio_st->pts.val * audio_st->time_base.num / audio_st->time_base.den; + else + audio_pts = 0.0; + + if (video_st) + video_pts = (double)video_st->pts.val * video_st->time_base.num / video_st->time_base.den; + else + video_pts = 0.0; + + if ((!audio_st || audio_pts >= STREAM_DURATION) && + (!video_st || video_pts >= STREAM_DURATION)) + break; + + /* write interleaved audio and video frames */ + if (!video_st || (video_st && audio_st && audio_pts < video_pts)) { + write_audio_frame(oc, audio_st); + } else { + write_video_frame(oc, video_st); + picture->pts++; + } + } + + /* write the trailer, if any. the trailer must be written + * before you close the CodecContexts open when you wrote the + * header; otherwise write_trailer may try to use memory that + * was freed on av_codec_close() */ + av_write_trailer(oc); + + /* close each codec */ + if (video_st) + close_video(oc, video_st); + if (audio_st) + close_audio(oc, audio_st); + + /* free the streams */ + for(i = 0; i < oc->nb_streams; i++) { + av_freep(&oc->streams[i]->codec); + av_freep(&oc->streams[i]); + } + + if (!(fmt->flags & AVFMT_NOFILE)) { + /* close the output file */ + avio_close(oc->pb); + } + + /* free the stream */ + av_free(oc); + + return 0; +} diff --git a/lib/ffmpeg/doc/faq.texi b/lib/ffmpeg/doc/faq.texi index 100adff312..5f371a4546 100644 --- a/lib/ffmpeg/doc/faq.texi +++ b/lib/ffmpeg/doc/faq.texi @@ -11,22 +11,6 @@ @chapter General Questions -@section When will the next FFmpeg version be released? / Why are FFmpeg releases so few and far between? - -Like most open source projects FFmpeg suffers from a certain lack of -manpower. For this reason the developers have to prioritize the work -they do and putting out releases is not at the top of the list, fixing -bugs and reviewing patches takes precedence. Please don't complain or -request more timely and/or frequent releases unless you are willing to -help out creating them. - -@section I have a problem with an old version of FFmpeg; where should I report it? -Nowhere. We do not support old FFmpeg versions in any way, we simply lack -the time, motivation and manpower to do so. If you have a problem with an -old version of FFmpeg, upgrade to the latest Subversion snapshot. If you -still experience the problem, then you can report it according to the -guidelines in @url{http://ffmpeg.org/bugreports.html}. - @section Why doesn't FFmpeg support feature [xyz]? Because no one has taken on that task yet. FFmpeg development is @@ -40,30 +24,6 @@ No. Windows DLLs are not portable, bloated and often slow. Moreover FFmpeg strives to support all codecs natively. A DLL loader is not conducive to that goal. -@section My bug report/mail to ffmpeg-devel/user has not received any replies. - -Likely reasons -@itemize -@item We are busy and haven't had time yet to read your report or -investigate the issue. -@item You didn't follow @url{http://ffmpeg.org/bugreports.html}. -@item You didn't use Subversion HEAD. -@item You reported a segmentation fault without gdb output. -@item You describe a problem but not how to reproduce it. -@item It's unclear if you use ffmpeg as command line tool or use -libav* from another application. -@item You speak about a video having problems on playback but -not what you use to play it. -@item We have no faint clue what you are talking about besides -that it is related to FFmpeg. -@end itemize - -@section Is there a forum for FFmpeg? I do not like mailing lists. - -You may view our mailing lists with a more forum-alike look here: -@url{http://dir.gmane.org/gmane.comp.video.ffmpeg.user}, -but, if you post, please remember that our mailing list rules still apply there. - @section I cannot read this file although this format seems to be supported by ffmpeg. Even if ffmpeg can read the container format, it may not support all its @@ -87,7 +47,7 @@ The following list of video codecs should work on most Windows systems: .asf only @item mpeg4 Only if you have some MPEG-4 codec like ffdshow or Xvid installed. -@item mpeg1 +@item mpeg1video .mpg only @end table Note, ASF files often have .wmv or .wma extensions in Windows. It should also @@ -99,9 +59,9 @@ The following list of audio codecs should work on most Windows systems: @table @option @item adpcm_ima_wav @item adpcm_ms -@item pcm +@item pcm_s16le always -@item mp3 +@item libmp3lame If some MP3 codec like LAME is installed. @end table @@ -123,7 +83,8 @@ problem and an NP-hard problem... @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 +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? @@ -147,7 +108,7 @@ that match @code{*jpg} to the @file{/tmp} directory in the sequence of @file{img001.jpg}, @file{img002.jpg} and so on. @example - x=1; for i in *jpg; do counter=$(printf %03d $x); ln "$i" /tmp/img"$counter".jpg; x=$(($x+1)); done + x=1; for i in *jpg; do counter=$(printf %03d $x); ln -s "$i" /tmp/img"$counter".jpg; x=$(($x+1)); done @end example If you want to sequence them by oldest modified first, substitute @@ -174,15 +135,15 @@ The @file{movie.mpg} used as input will be converted to Instead of relying on file format self-recognition, you may also use @table @option -@item -vcodec ppm -@item -vcodec png -@item -vcodec mjpeg +@item -c:v ppm +@item -c:v png +@item -c:v mjpeg @end table to force the encoding. Applying that to the previous example: @example - ffmpeg -i movie.mpg -f image2 -vcodec 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. @@ -201,59 +162,21 @@ 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. -Choose a different codec with the -vcodec command line option. +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 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 -same standard). Thus, use '-vcodec mpeg4' to encode in these formats. The +same standard). Thus, use '-c:v mpeg4' to encode in these formats. The default fourcc stored in an MPEG-4-coded file will be 'FMP4'. If you want a different fourcc, use the '-vtag' option. E.g., '-vtag xvid' will force the fourcc 'xvid' to be stored as the video fourcc rather than the default. -@section How do I encode videos which play on the iPod? - -@table @option -@item needed stuff --acodec libfaac -vcodec mpeg4 width<=320 height<=240 -@item working stuff -mv4, title -@item non-working stuff -B-frames -@item example command line -ffmpeg -i input -acodec libfaac -ab 128kb -vcodec mpeg4 -b 1200kb -mbd 2 -flags +mv4 -trellis 2 -aic 2 -cmp 2 -subcmp 2 -s 320x180 -metadata title=X output.mp4 -@end table - -@section How do I encode videos which play on the PSP? - -@table @option -@item needed stuff --acodec libfaac -vcodec mpeg4 width*height<=76800 width%16=0 height%16=0 -ar 24000 -r 30000/1001 or 15000/1001 -f psp -@item working stuff -mv4, title -@item non-working stuff -B-frames -@item example command line -ffmpeg -i input -acodec libfaac -ab 128kb -vcodec mpeg4 -b 1200kb -ar 24000 -mbd 2 -flags +mv4 -trellis 2 -aic 2 -cmp 2 -subcmp 2 -s 368x192 -r 30000/1001 -metadata title=X -f psp output.mp4 -@item needed stuff for H.264 --acodec libfaac -vcodec libx264 width*height<=76800 width%16=0? height%16=0? -ar 48000 -coder 1 -r 30000/1001 or 15000/1001 -f psp -@item working stuff for H.264 -title, loop filter -@item non-working stuff for H.264 -CAVLC -@item example command line -ffmpeg -i input -acodec libfaac -ab 128kb -vcodec libx264 -b 1200kb -ar 48000 -mbd 2 -coder 1 -cmp 2 -subcmp 2 -s 368x192 -r 30000/1001 -metadata title=X -f psp -flags loop -trellis 2 -partitions parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 output.mp4 -@item higher resolution for newer PSP firmwares, width<=480, height<=272 --vcodec libx264 -level 21 -coder 1 -f psp -@item example command line -ffmpeg -i input -acodec libfaac -ab 128kb -ac 2 -ar 48000 -vcodec libx264 -level 21 -b 640kb -coder 1 -f psp -flags +loop -trellis 2 -partitions +parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 -g 250 -s 480x272 output.mp4 -@end table - @section Which are good parameters for encoding high quality MPEG-4? '-mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 300 -pass 1/2', @@ -280,12 +203,13 @@ 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 FFmpeg: +... and then feed that text file to ffmpeg: @example ffmpeg -i input.avs @end example -For ANY other help on Avisynth, please visit @url{http://www.avisynth.org/}. +For ANY other help on Avisynth, please visit the +@uref{http://www.avisynth.org/, Avisynth homepage}. @section How can I join video files? @@ -298,13 +222,13 @@ equally humble @code{copy} under Windows), and finally transcoding back to your format of choice. @example -ffmpeg -i input1.avi -sameq intermediate1.mpg -ffmpeg -i input2.avi -sameq 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 -ffmpeg -i intermediate_all.mpg -sameq output.avi +ffmpeg -i intermediate_all.mpg -same_quant output.avi @end example -Notice that you should either use @code{-sameq} or set a reasonably high +Notice that you should either use @code{-same_quant} or set a reasonably high bitrate for your intermediate and output files, if you want to preserve video quality. @@ -314,10 +238,10 @@ of named pipes, should your platform support it: @example mkfifo intermediate1.mpg mkfifo intermediate2.mpg -ffmpeg -i input1.avi -sameq -y intermediate1.mpg < /dev/null & -ffmpeg -i input2.avi -sameq -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 |\ -ffmpeg -f mpeg -i - -sameq -vcodec 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 @@ -344,27 +268,47 @@ cat temp1.a temp2.a > all.a & cat temp1.v temp2.v > all.v & ffmpeg -f u16le -acodec pcm_s16le -ac 2 -ar 44100 -i all.a \ -f yuv4mpegpipe -i all.v \ - -sameq -y output.flv + -same_quant -y output.flv rm temp[12].[av] all.[av] @end example -@section FFmpeg does not adhere to the -maxrate setting, some frames are bigger than maxrate/fps. +@section -profile option fails when encoding H.264 video with AAC audio + +@command{ffmpeg} prints an error like + +@example +Undefined constant or missing '(' in 'baseline' +Unable to parse option value "baseline" +Error setting option profile to value baseline. +@end example + +Short answer: write @option{-profile:v} instead of @option{-profile}. + +Long answer: this happens because the @option{-profile} option can apply to both +video and audio. Specifically the AAC encoder also defines some profiles, none +of which are named @var{baseline}. -Read the MPEG spec about video buffer verifier. +The solution is to apply the @option{-profile} option to the video stream only +by using @url{http://ffmpeg.org/ffmpeg.html#Stream-specifiers-1, Stream specifiers}. +Appending @code{:v} to it will do exactly that. -@section I want CBR, but no matter what I do frame sizes differ. +@section Using @option{-f lavfi}, audio becomes mono for no apparent reason. -You do not understand what CBR is, please read the MPEG spec. -Read about video buffer verifier and constant bitrate. -The one sentence summary is that there is a buffer and the input rate is -constant, the output can vary as needed. +Use @option{-dumpgraph -} to find out exactly where the channel layout is +lost. -@section How do I check if a stream is CBR? +Most likely, it is through @code{auto-inserted aconvert}. Try to understand +why the converting filter was needed at that place. -To quote the MPEG-2 spec: -"There is no way to tell that a bitstream is constant bitrate without -examining all of the vbv_delay values and making complicated computations." +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 @@ -412,34 +356,26 @@ the FFmpeg Windows Help Forum at No. These tools are too bloated and they complicate the build. -@section Why not rewrite ffmpeg in object-oriented C++? +@section Why not rewrite FFmpeg in object-oriented C++? 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 "Programming Religion" at (@url{http://www.tux.org/lkml/#s15}). +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, used the *_g versions. +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 want to compile xyz.c alone but my compiler produced many errors. - -Common code is in its own files in libav* and is used by the individual -codecs. They will not work without the common parts, you have to compile -the whole libav*. If you wish, disable some parts with configure switches. -You can also try to hack it and remove more, but if you had problems fixing -the compilation failure then you are probably not qualified for this. - -@section I'm using libavcodec 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. 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 @@ -447,19 +383,16 @@ 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 + +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 FFmpeg and @file{libmpdemux/demux_lavf.c} in MPlayer sources. -@section I get "No compatible shell script interpreter found." in MSys. - -The standard MSys bash (2.04) is broken. You need to install 2.05 or later. - -@section I get "./configure: line <xxx>: pr: command not found" in MSys. - -The standard MSys install doesn't come with pr. You need to get it from the coreutils package. - @section Where can I find libav* headers for Pascal/Delphi? see @url{http://www.iversenit.dk/dev/ffmpeg-headers/} @@ -474,12 +407,24 @@ 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 framerate. +@section AVStream.r_frame_rate is wrong, it is much larger than the frame rate. -r_frame_rate is NOT the average framerate, it is the smallest framerate +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? + +Make sure you have the fate-suite samples and the @code{SAMPLES} Make variable +or @code{FATE_SAMPLES} environment variable or the @code{--samples} +@command{configure} option is set to the right path. + +@section Why is @code{make fate} not finding the samples? + +Do you happen to have a @code{~} character in the samples path to indicate a +home directory? The value is used in ways where the shell cannot expand it, +causing FATE to not find files. Just replace @code{~} by the full path. + @bye diff --git a/lib/ffmpeg/doc/fate.texi b/lib/ffmpeg/doc/fate.texi new file mode 100644 index 0000000000..acb4bfe6a1 --- /dev/null +++ b/lib/ffmpeg/doc/fate.texi @@ -0,0 +1,174 @@ +\input texinfo @c -*- texinfo -*- + +@settitle FATE Automated Testing Environment +@titlepage +@center @titlefont{FATE Automated Testing Environment} +@end titlepage + +@node Top +@top + +@contents + +@chapter Introduction + + FATE is an extended regression suite on the client-side and a means +for results aggregation and presentation on the server-side. + + 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. + + In any way you can have a look at the publicly viewable FATE results +by visiting this website: + + @url{http://fate.ffmpeg.org/} + + 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 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=<path to the samples directory>'. 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 +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 +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 <arch>-<os>-<compiler>-<compiler version>. 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: + + 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 + +@table @option +@item fate-rsync + 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). +@end table + +@section Makefile variables + +@table @option +@item V + 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. + +@item THREADS + Specify how many threads to use while running regression tests, it is + quite useful to detect thread-related regressions. +@end table + +Example: +@example +make V=1 SAMPLES=/var/fate/samples THREADS=2 fate +@end example diff --git a/lib/ffmpeg/doc/ffmpeg.texi b/lib/ffmpeg/doc/ffmpeg.texi index 047444ab62..ecf147ab55 100644 --- a/lib/ffmpeg/doc/ffmpeg.texi +++ b/lib/ffmpeg/doc/ffmpeg.texi @@ -1,8 +1,8 @@ \input texinfo @c -*- texinfo -*- -@settitle FFmpeg Documentation +@settitle ffmpeg Documentation @titlepage -@center @titlefont{FFmpeg Documentation} +@center @titlefont{ffmpeg Documentation} @end titlepage @top @@ -15,34 +15,50 @@ The generic syntax is: @example @c man begin SYNOPSIS -ffmpeg [[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 -FFmpeg is a very fast video and audio converter. It can also grab from -a live audio/video source. +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. -The command line interface is designed to be intuitive, in the sense -that FFmpeg tries to figure out all parameters that can possibly be -derived automatically. You usually only have to specify the target -bitrate you want. +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 +cannot be interpreted as an option is considered to be an output filename. -FFmpeg can also convert from any sample rate to any other, and resize -video on the fly with a high quality polyphase filter. +Each input or output file can in principle contain any number of streams of +different types (video/audio/subtitle/attachment/data). Allowed number and/or +types of streams can be limited by the container format. Selecting, which +streams from which inputs go into output, is done either automatically or with +the @code{-map} option (see the Stream selection chapter). + +To refer to input files in options, you must use their indices (0-based). E.g. +the first input file is @code{0}, the second is @code{1} etc. Similarly, streams +within a file are referred to by their indices. E.g. @code{2:3} refers to the +fourth stream in the third input file. See also the Stream specifiers chapter. As a general rule, options are applied to the next specified file. Therefore, order is important, and you can have the same option on the command line multiple times. Each occurrence is then applied to the next input or output file. +Exceptions from this rule are the global options (e.g. verbosity level), +which should be specified first. + +Do not mix input and output files -- first specify all input files, then all +output files. Also do not mix options which belong to different files. All +options apply ONLY to the next input or output file and are reset between files. @itemize @item To set the video bitrate of the output file to 64kbit/s: @example -ffmpeg -i input.avi -b 64k output.avi +ffmpeg -i input.avi -b:v 64k output.avi @end example @item @@ -61,51 +77,90 @@ ffmpeg -r 1 -i input.m2v -r 24 output.avi The format option may be needed for raw input files. -By default, FFmpeg tries to convert as losslessly as possible: It -uses the same audio and video parameters for the outputs as the one -specified for the inputs. - @c man end DESCRIPTION +@chapter Stream selection +@c man begin STREAM SELECTION + +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 +described. + +@c man end STREAM SELECTION + @chapter Options @c man begin OPTIONS -@include fftools-common-opts.texi +@include avtools-common-opts.texi @section Main options @table @option -@item -f @var{fmt} -Force format. +@item -f @var{fmt} (@emph{input/output}) +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. -@item -i @var{filename} +@item -i @var{filename} (@emph{input}) input file name -@item -y -Overwrite output files. +@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 re-encoded. + +For example +@example +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 +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. -@item -t @var{duration} -Restrict the transcoded/captured video sequence -to the duration specified in seconds. -@code{hh:mm:ss[.xxx]} syntax is also supported. +@item -t @var{duration} (@emph{output}) +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} +@item -fs @var{limit_size} (@emph{output}) Set the file size limit. -@item -ss @var{position} -Seek to given time position in seconds. -@code{hh:mm:ss[.xxx]} syntax is also supported. +@item -ss @var{position} (@emph{input/output}) +When used as an input option (before @code{-i}), seeks in this input file to +@var{position}. When used as an output option (before an output filename), +decodes but discards input until the timestamps reach @var{position}. This is +slower, but more accurate. -@item -itsoffset @var{offset} +@var{position} may be either in seconds or in @code{hh:mm:ss[.xxx]} form. + +@item -itsoffset @var{offset} (@emph{input}) Set the input time offset in seconds. @code{[-]hh:mm:ss[.xxx]} syntax is also supported. -This option affects all the input files that follow it. The offset is added to the timestamps of the input files. Specifying a positive offset means that the corresponding -streams are delayed by 'offset' seconds. +streams are delayed by @var{offset} seconds. -@item -timestamp @var{time} +@item -timestamp @var{time} (@emph{output}) Set the recording timestamp in the container. The syntax for @var{time} is: @example @@ -117,21 +172,31 @@ interpreted as UTC. If the year-month-day part is not specified it takes the current year-month-day. -@item -metadata @var{key}=@var{value} +@item -metadata[:metadata_specifier] @var{key}=@var{value} (@emph{output,per-metadata}) Set a metadata key/value pair. +An optional @var{metadata_specifier} may be given to set metadata +on streams or chapters. See @code{-map_metadata} documentation for +details. + +This option overrides metadata set with @code{-map_metadata}. It is +also possible to delete metadata by using an empty value. + For example, for setting the title in the output file: @example ffmpeg -i in.avi -metadata title="my title" out.flv @end example -@item -v @var{number} -Set the logging verbosity level. +To set the language of the first audio stream: +@example +ffmpeg -i INPUT -metadata:s:a:1 language=eng OUTPUT +@end example -@item -target @var{type} -Specify target file type ("vcd", "svcd", "dvd", "dv", "dv50", "pal-vcd", -"ntsc-svcd", ... ). All the format options (bitrate, codecs, -buffer sizes) are then set automatically. You can just type: +@item -target @var{type} (@emph{output}) +Specify target file type (@code{vcd}, @code{svcd}, @code{dvd}, @code{dv}, +@code{dv50}). @var{type} may be prefixed with @code{pal-}, @code{ntsc-} or +@code{film-} to use the corresponding standard. All the format options +(bitrate, codecs, buffer sizes) are then set automatically. You can just type: @example ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg @@ -144,31 +209,71 @@ they do not conflict with the standard, as in: ffmpeg -i myfile.avi -target vcd -bf 2 /tmp/vcd.mpg @end example -@item -dframes @var{number} -Set the number of data frames to record. +@item -dframes @var{number} (@emph{output}) +Set the number of data frames to record. This is an alias for @code{-frames:d}. -@item -scodec @var{codec} -Force subtitle codec ('copy' to copy stream). +@item -frames[:@var{stream_specifier}] @var{framecount} (@emph{output,per-stream}) +Stop writing to the stream after @var{framecount} frames. -@item -newsubtitle -Add a new subtitle stream to the current output stream. +@item -q[:@var{stream_specifier}] @var{q} (@emph{output,per-stream}) +@itemx -qscale[:@var{stream_specifier}] @var{q} (@emph{output,per-stream}) +Use fixed quality scale (VBR). The meaning of @var{q} is +codec-dependent. -@item -slang @var{code} -Set the ISO 639 language code (3 letters) of the current subtitle stream. +@item -filter[:@var{stream_specifier}] @var{filter_graph} (@emph{output,per-stream}) +@var{filter_graph} is a description of the filter graph to apply to +the stream. Use @code{-filters} to show all the available filters +(including also sources and sinks). +@item -pre[:@var{stream_specifier}] @var{preset_name} (@emph{output,per-stream}) +Specify the preset for matching stream(s). + +@item -stats (@emph{global}) +Print encoding progress/statistics. On by default. + +@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 +are implemented as a specific type of stream, so this option will add +a new stream to the file. It is then possible to use per-stream options +on this stream in the usual way. Attachment streams created with this +option will be created after all the other streams (i.e. those created +with @code{-map} or automatic mappings). + +Note that for Matroska you also have to set the mimetype metadata tag: +@example +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). + +@item -dump_attachment[:@var{stream_specifier}] @var{filename} (@emph{input,per-stream}) +Extract the matching attachment stream into a file named @var{filename}. If +@var{filename} is empty, then the value of the @code{filename} metadata tag +will be used. + +E.g. to extract the first attachment to a file named 'out.ttf': +@example +ffmpeg -dump_attachment:t:0 out.ttf INPUT +@end example +To extract all attachments to files determined by the @code{filename} tag: +@example +ffmpeg -dump_attachment:t "" INPUT +@end example + +Technical note -- attachments are implemented as codec extradata, so this +option can actually be used to extract extradata from any stream, not just +attachments. @end table @section Video Options @table @option -@item -b @var{bitrate} -Set the video bitrate in bit/s (default = 200 kb/s). -@item -vframes @var{number} -Set the number of video frames to record. -@item -r @var{fps} +@item -vframes @var{number} (@emph{output}) +Set the number of video frames to record. This is an alias for @code{-frames:v}. +@item -r[:@var{stream_specifier}] @var{fps} (@emph{input/output,per-stream}) Set frame rate (Hz value, fraction or abbreviation), (default = 25). -@item -s @var{size} -Set frame size. The format is @samp{wxh} (ffserver default = 160x128, ffmpeg default = same as source). +@item -s[:@var{stream_specifier}] @var{size} (@emph{input/output,per-stream}) +Set frame size. The format is @samp{wxh} (default - same as source). The following abbreviations are recognized: @table @samp @item sqcif @@ -231,8 +336,14 @@ The following abbreviations are recognized: 1920x1080 @end table -@item -aspect @var{aspect} -Set aspect ratio (4:3, 16:9 or 1.3333, 1.7777). +@item -aspect[:@var{stream_specifier}] @var{aspect} (@emph{output,per-stream}) +Set the video display aspect ratio specified by @var{aspect}. + +@var{aspect} can be a floating point number string, 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. 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} @@ -247,7 +358,8 @@ crop=width:height:x:y instead. @item -padcolor @var{hex_color} All the pad options have been removed. Use -vf pad=width:height:x:y:color instead. -@item -vn + +@item -vn (@emph{output}) Disable video recording. @item -bt @var{tolerance} Set video bitrate tolerance (in bits, default 4000k). @@ -263,16 +375,18 @@ Requires -bufsize to be set. Set min video bitrate (in bit/s). Most useful in setting up a CBR encode: @example -ffmpeg -i myfile.avi -b 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k out.m2v +ffmpeg -i myfile.avi -b:v 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k out.m2v @end example It is of little use elsewise. @item -bufsize @var{size} Set video buffer verifier buffer size (in bits). -@item -vcodec @var{codec} -Force video codec to @var{codec}. Use the @code{copy} special value to -tell that the raw codec data must be copied as is. -@item -sameq -Use same video quality as source (implies VBR). +@item -vcodec @var{codec} (@emph{output}) +Set the video codec. This is an alias for @code{-codec:v}. +@item -same_quant +Use same quantizer as source (implies VBR). + +Note that this is NOT SAME QUALITY. Do not use this option unless you know you +need it. @item -pass @var{n} Select the pass number (1 or 2). It is used to do two-pass @@ -283,46 +397,41 @@ at the exact requested bitrate. On pass 1, you may just deactivate audio and set output to null, examples for Windows and Unix: @example -ffmpeg -i foo.mov -vcodec libxvid -pass 1 -an -f rawvideo -y NUL -ffmpeg -i foo.mov -vcodec 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} +@item -passlogfile @var{prefix} (@emph{global}) Set two-pass log file name prefix to @var{prefix}, the default file name prefix is ``ffmpeg2pass''. The complete file name will be @file{PREFIX-N.log}, where N is a number specific to the output -stream. - -@item -newvideo -Add a new video stream to the current 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} +@item -vf @var{filter_graph} (@emph{output}) @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). +also sources and sinks). This is an alias for @code{-filter:v}. @end table @section Advanced Video Options @table @option -@item -pix_fmt @var{format} -Set pixel format. Use 'list' as parameter to show all the supported +@item -pix_fmt[:@var{stream_specifier}] @var{format} (@emph{input/output,per-stream}) +Set pixel format. Use @code{-pix_fmts} to show all the supported pixel formats. -@item -sws_flags @var{flags} +@item -sws_flags @var{flags} (@emph{input/output}) Set SwScaler flags. @item -g @var{gop_size} Set the group of pictures size. @item -intra -Use only intra frames. +deprecated, use -g 1 @item -vdt @var{n} Discard threshold. -@item -qscale @var{q} -Use fixed video quantizer scale (VBR). @item -qmin @var{q} minimum video quantizer scale (VBR) @item -qmax @var{q} @@ -394,8 +503,11 @@ and the following constants are available: @item avgTex @end table -@item -rc_override @var{override} -rate control override for specific intervals +@item -rc_override[:@var{stream_specifier}] @var{override} (@emph{output,per-stream}) +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 -me_method @var{method} Set motion estimation method to @var{method}. Available methods are (from lowest to best quality): @@ -486,7 +598,7 @@ Use 'frames' B-frames (supported for MPEG-1, MPEG-2 and MPEG-4). macroblock decision @table @samp @item 0 -FF_MB_DECISION_SIMPLE: Use mb_cmp (cannot change it yet in FFmpeg). +FF_MB_DECISION_SIMPLE: Use mb_cmp (cannot change it yet in ffmpeg). @item 1 FF_MB_DECISION_BITS: Choose the one which needs the fewest bits. @item 2 @@ -520,123 +632,231 @@ Calculate PSNR of compressed frames. Dump video coding statistics to @file{vstats_HHMMSS.log}. @item -vstats_file @var{file} Dump video coding statistics to @var{file}. -@item -top @var{n} +@item -top[:@var{stream_specifier}] @var{n} (@emph{output,per-stream}) top=1/bottom=0/auto=-1 field first @item -dc @var{precision} Intra_dc_precision. -@item -vtag @var{fourcc/tag} -Force video tag/fourcc. -@item -qphist -Show QP histogram. +@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 @item -vbsf @var{bitstream_filter} -Bitstream filters available are "dump_extra", "remove_extra", "noise", "h264_mp4toannexb", "imxdump", "mjpegadump", "mjpeg2jpeg". -@example -ffmpeg -i h264.mp4 -vcodec copy -vbsf h264_mp4toannexb -an out.h264 -@end example -@item -force_key_frames @var{time}[,@var{time}...] +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. This option can be useful to ensure that a seek point is present at a chapter mark or any other designated place in the output file. The timestamps must be specified in ascending order. + +@item -copyinkf[:@var{stream_specifier}] (@emph{output,per-stream}) +When doing stream copy, copy also non-key frames found at the +beginning. @end table @section Audio Options @table @option -@item -aframes @var{number} -Set the number of audio frames to record. -@item -ar @var{freq} -Set the audio sampling frequency. For input streams it is set by -default to 44100 Hz, for output streams it is set by default to the -frequency of the input stream. If the input file has audio streams -with different frequencies, the behaviour is undefined. -@item -ab @var{bitrate} -Set the audio bitrate in bit/s (default = 64k). -@item -aq @var{q} -Set the audio quality (codec-specific, VBR). -@item -ac @var{channels} -Set the number of audio channels. For input streams it is set by -default to 1, for output streams it is set by default to the same -number of audio channels in input. If the input file has audio streams -with different channel count, the behaviour is undefined. -@item -an +@item -aframes @var{number} (@emph{output}) +Set the number of audio frames to record. This is an alias for @code{-frames:a}. +@item -ar[:@var{stream_specifier}] @var{freq} (@emph{input/output,per-stream}) +Set the audio sampling frequency. For output streams it is set by +default to the frequency of the corresponding input stream. For input +streams this option only makes sense for audio grabbing devices and raw +demuxers and is mapped to the corresponding demuxer options. +@item -aq @var{q} (@emph{output}) +Set the audio quality (codec-specific, VBR). This is an alias for -q:a. +@item -ac[:@var{stream_specifier}] @var{channels} (@emph{input/output,per-stream}) +Set the number of audio channels. For output streams it is set by +default to the number of input audio channels. For input streams +this option only makes sense for audio grabbing devices and raw demuxers +and is mapped to the corresponding demuxer options. +@item -an (@emph{output}) Disable audio recording. -@item -acodec @var{codec} -Force audio codec to @var{codec}. Use the @code{copy} special value to -specify that the raw codec data must be copied as is. -@item -newaudio -Add a new audio track to the output file. If you want to specify parameters, -do so before @code{-newaudio} (@code{-acodec}, @code{-ab}, etc..). - -Mapping will be done automatically, if the number of output streams is equal to -the number of input streams, else it will pick the first one that matches. You -can override the mapping using @code{-map} as usual. - -Example: -@example -ffmpeg -i file.mpg -vcodec copy -acodec ac3 -ab 384k test.mpg -acodec mp2 -ab 192k -newaudio -@end example -@item -alang @var{code} -Set the ISO 639 language code (3 letters) of the current audio stream. +@item -acodec @var{codec} (@emph{input/output}) +Set the audio codec. This is an alias for @code{-codec:a}. +@item -sample_fmt[:@var{stream_specifier}] @var{sample_fmt} (@emph{output,per-stream}) +Set the audio sample format. Use @code{-sample_fmts} to get a list +of supported sample formats. @end table @section Advanced Audio options: @table @option -@item -atag @var{fourcc/tag} -Force audio tag/fourcc. +@item -atag @var{fourcc/tag} (@emph{output}) +Force audio tag/fourcc. This is an alias for @code{-tag:a}. +@item -audio_service_type @var{type} +Set the type of service that the audio stream contains. +@table @option +@item ma +Main Audio Service (default) +@item ef +Effects +@item vi +Visually Impaired +@item hi +Hearing Impaired +@item di +Dialogue +@item co +Commentary +@item em +Emergency +@item vo +Voice Over +@item ka +Karaoke +@end table @item -absf @var{bitstream_filter} -Bitstream filters available are "dump_extra", "remove_extra", "noise", "mp3comp", "mp3decomp". +Deprecated, see -bsf @end table @section Subtitle options: @table @option -@item -scodec @var{codec} -Force subtitle codec ('copy' to copy stream). -@item -newsubtitle -Add a new subtitle stream to the current output stream. @item -slang @var{code} Set the ISO 639 language code (3 letters) of the current subtitle stream. -@item -sn +@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} -Bitstream filters available are "mov2textsub", "text2movsub". -@example -ffmpeg -i file.mov -an -vn -sbsf mov2textsub -scodec copy -f rawvideo sub.txt -@end example +Deprecated, see -bsf @end table @section Audio/Video grab options @table @option -@item -vc @var{channel} -Set video grab channel (DV1394 only). -@item -tvstd @var{standard} -Set television standard (NTSC, PAL (SECAM)). -@item -isync +@item -isync (@emph{global}) Synchronize read on input. @end table @section Advanced options @table @option -@item -map @var{input_stream_id}[:@var{sync_stream_id}] -Set stream mapping from input streams to output streams. -Just enumerate the input streams in the order you want them in the output. -@var{sync_stream_id} if specified sets the input stream to sync -against. -@item -map_meta_data @var{outfile}[,@var{metadata}]:@var{infile}[,@var{metadata}] -Set meta data information of @var{outfile} from @var{infile}. Note that those -are file indices (zero-based), not filenames. -Optional @var{metadata} parameters specify, which metadata to copy - (g)lobal -(i.e. metadata that applies to the whole file), per-(s)tream, per-(c)hapter or -per-(p)rogram. All metadata specifiers other than global must be followed by the -stream/chapter/program number. If metadata specifier is omitted, it defaults to -global. - -By default, global metadata is copied from the first input file to all output files, +@item -map [-]@var{input_file_id}[:@var{stream_specifier}][,@var{sync_file_id}[:@var{stream_specifier}]] (@emph{output}) + +Designate one or more input streams as a source for the output file. Each input +stream is identified by the input file index @var{input_file_id} and +the input stream index @var{input_stream_id} within the input +file. Both indices start at 0. If specified, +@var{sync_file_id}:@var{stream_specifier} sets which input stream +is used as a presentation sync reference. + +The first @code{-map} option on the command line specifies the +source for output stream 0, the second @code{-map} option specifies +the source for output stream 1, etc. + +A @code{-} character before the stream identifier creates a "negative" mapping. +It disables matching streams from already created mappings. + +For example, to map ALL streams from the first input file to output +@example +ffmpeg -i INPUT -map 0 output +@end example + +For example, if you have two audio streams in the first input file, +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 +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}. + +For example, to select the stream with index 2 from input file +@file{a.mov} (specified by the identifier "0:2"), and stream with +index 6 from input @file{b.mov} (specified by the identifier "1:6"), +and copy them to the output file @file{out.mov}: +@example +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 +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 +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} are 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 +channel layouts don't match (for instance two "-map_channel" options and "-ac +6"). + +You can also extract each channel of an @var{INPUT} to specific outputs; the +following command extract each channel of the audio stream (file 0, stream 0) +to the respective @var{OUTPUT_CH0} and @var{OUTPUT_CH1}: +@example +ffmpeg -i INPUT -map_channel 0.0.0 OUTPUT_CH0 -map_channel 0.0.1 OUTPUT_CH1 +@end example + +The following example split the channels of a stereo input into streams: + +@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 spliting a stereo stream into two single channel mono streams +is possible. + +@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. +Optional @var{metadata_spec_in/out} parameters specify, which metadata to copy. +A metadata specifier can have the following forms: +@table @option +@item @var{g} +global metadata, i.e. metadata that applies to the whole file + +@item @var{s}[:@var{stream_spec}] +per-stream metadata. @var{stream_spec} is a stream specifier as described +in the @ref{Stream specifiers} chapter. In an input metadata specifier, the first +matching stream is copied from. In an output metadata specifier, all matching +streams are copied to. + +@item @var{c}:@var{chapter_index} +per-chapter metadata. @var{chapter_index} is the zero-based chapter index. + +@item @var{p}:@var{program_index} +per-program metadata. @var{program_index} is the zero-based program index. +@end table +If metadata specifier is omitted, it defaults to global. + +By default, global metadata is copied from the first input file, per-stream and per-chapter metadata is copied along with streams/chapters. These default mappings are disabled by creating any mapping of the relevant type. A negative file index can be used to create a dummy mapping that just disables automatic copying. @@ -644,50 +864,92 @@ 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 -ffmpeg -i in.ogg -map_meta_data 0:0,s0 out.mp3 +ffmpeg -i in.ogg -map_metadata 0:s:0 out.mp3 @end example -@item -map_chapters @var{outfile}:@var{infile} -Copy chapters from @var{infile} to @var{outfile}. If no chapter mapping is specified, -then chapters are copied from the first input file with at least one chapter to all -output files. Use a negative file index to disable any chapter copying. -@item -debug + +To do the reverse, i.e. copy global metadata to all audio streams: +@example +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. + +@item -map_chapters @var{input_file_index} (@emph{output}) +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 @var{category} Print specific debug info. -@item -benchmark +@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 -dump -Dump each input packet. -@item -hex +@item -timelimit @var{duration} (@emph{global}) +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 -bitexact -Only use bit exact algorithms (for codec testing). @item -ps @var{size} Set RTP payload size in bytes. -@item -re +@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 -threads @var{count} Thread count. @item -vsync @var{parameter} Video sync method. @table @option -@item 0 +@item 0, passthrough Each frame is passed with its timestamp from the demuxer to the muxer. -@item 1 +@item 1, cfr Frames will be duplicated and dropped to achieve exactly the requested constant framerate. -@item 2 +@item 2, vfr Frames are passed through with their timestamp or dropped so as to prevent 2 frames from having the same timestamp. -@item -1 +@item -1, auto Chooses between 1 and 2 depending on muxer capabilities. This is the default method. @end table @@ -709,11 +971,11 @@ Copy input stream time base from input to output when stream copying. Finish encoding when the shortest input stream ends. @item -dts_delta_threshold Timestamp discontinuity delta threshold. -@item -muxdelay @var{seconds} +@item -muxdelay @var{seconds} (@emph{input}) Set the maximum demux-decode delay. -@item -muxpreload @var{seconds} +@item -muxpreload @var{seconds} (@emph{input}) Set the initial demux-decode delay. -@item -streamid @var{output-stream-index}:@var{new-value} +@item -streamid @var{output-stream-index}:@var{new-value} (@emph{output}) Assign a new stream-id value to an output stream. This option should be specified prior to the output filename to which it applies. For the situation where multiple output files exist, a streamid @@ -724,15 +986,35 @@ an output mpegts file: @example 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}) +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 +ffmpeg -i h264.mp4 -c:v copy -vbsf h264_mp4toannexb -an out.h264 +@end example +@example +ffmpeg -i file.mov -an -vn -sbsf mov2textsub -c:s copy -f rawvideo sub.txt +@end example + +@item -tag[:@var{stream_specifier}] @var{codec_tag} (@emph{per-stream}) +Force a tag/fourcc for matching streams. + +@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 @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{ffpresets} directory in the FFmpeg source tree for examples. +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 @@ -749,6 +1031,7 @@ 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}. @@ -758,7 +1041,7 @@ 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 +@c man end OPTIONS @chapter Tips @c man begin TIPS @@ -771,7 +1054,7 @@ the Linux player does not seem to be very fast, so it can miss frames. An example is: @example -ffmpeg -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 @@ -798,35 +1081,50 @@ To have a constant quality (but a variable bitrate), use the option '-qscale n' when 'n' is between 1 (excellent quality) and 31 (worst quality). -@item -When converting video files, you can use the '-sameq' option which -uses the same quality factor in the encoder as in the decoder. -It allows almost lossless encoding. - @end itemize @c man end TIPS @chapter Examples @c man begin EXAMPLES +@section Preset files + +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 FFmpeg source tree for examples. + +Preset files are specified with the @code{pre} option, this option takes a +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 -FFmpeg can grab video and audio from devices given that you specify the input -format and device. +If you specify the input format and device then ffmpeg can grab video +and audio directly. @example 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 FFmpeg with any TV viewer such as xawtv -(@url{http://linux.bytesex.org/xawtv/}) by Gerd Knorr. You also +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 -FFmpeg can grab the X11 display. +Grab the X11 display with ffmpeg via @example ffmpeg -f x11grab -s cif -r 25 -i :0.0 /tmp/out.mpg @@ -844,7 +1142,7 @@ variable. 10 is the x-offset and 20 the y-offset for the grabbing. @section Video and Audio file format conversion -FFmpeg can use any supported file format and protocol as input: +Any supported file format and protocol can serve as input to ffmpeg: Examples: @itemize @@ -864,7 +1162,7 @@ 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 FFmpeg cannot guess it. +if ffmpeg cannot guess it. @item You can input from a raw YUV420P file: @@ -908,7 +1206,7 @@ You can encode to several formats at the same time and define a mapping from input stream to output streams: @example -ffmpeg -i /tmp/a.wav -ab 64k /tmp/a.mp2 -ab 128k /tmp/b.mp2 -map 0:0 -map 0:0 +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 @@ -919,7 +1217,7 @@ stream, in the order of the definition of output streams. You can transcode decrypted VOBs: @example -ffmpeg -i snatch_1.vob -f avi -vcodec mpeg4 -b 800k -g 300 -bf 2 -acodec libmp3lame -ab 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 @@ -963,21 +1261,18 @@ only formats accepting a normal integer are suitable. You can put many streams of the same type in the output: @example -ffmpeg -i test1.avi -i test2.avi -vcodec copy -acodec copy -vcodec copy -acodec copy test12.avi -newvideo -newaudio +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 -In addition to the first video and audio streams, the resulting -output file @file{test12.avi} will contain the second video -and the second audio stream found in the input streams list. - -The @code{-newvideo}, @code{-newaudio} and @code{-newsubtitle} -options have to be specified immediately after the name of the output -file to which you want to add them. +The resulting output file @file{test12.avi} will contain first four streams from +the input file in reverse order. @end itemize @c man end EXAMPLES @include eval.texi +@include decoders.texi +@include encoders.texi @include demuxers.texi @include muxers.texi @include indevs.texi @@ -990,14 +1285,14 @@ file to which you want to add them. @ignore @setfilename ffmpeg -@settitle FFmpeg video converter +@settitle ffmpeg video converter @c man begin SEEALSO ffplay(1), ffprobe(1), ffserver(1) and the FFmpeg HTML documentation @c man end @c man begin AUTHORS -The FFmpeg developers +See git history @c man end @end ignore diff --git a/lib/ffmpeg/doc/ffmpeg.txt b/lib/ffmpeg/doc/ffmpeg.txt new file mode 100644 index 0000000000..1fa42e78ee --- /dev/null +++ b/lib/ffmpeg/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-:--- | : : + OuputFile output_files[] / +------------------------------------+ : : + / 1 | : : : | : : + ^ +------+------------+-----+ / +------------------------------------+ : : + : | : ost_index -:-----:------/ 2 | : : : | : : + nb_output_files : +------+------------+-----+ +====================================+ : : + : | : ost_index -:-----|-----------------> 3 | : : : | : : + : +------+------------+-----+ +------------------------------------+ : nb_output_streams : + : | : : | 4 | | : : + : +------+------------+-----+ +------------------------------------+ : : + : | : : | 5 | | : : + v +------+------------+-----+ +------------------------------------+ : : + 6 | | : : + +------------------------------------+ : : + 7 | | : : + +====================================+ v : + : diff --git a/lib/ffmpeg/doc/ffplay.texi b/lib/ffmpeg/doc/ffplay.texi index e0518b859e..06666f6e59 100644 --- a/lib/ffmpeg/doc/ffplay.texi +++ b/lib/ffmpeg/doc/ffplay.texi @@ -1,8 +1,8 @@ \input texinfo @c -*- texinfo -*- -@settitle FFplay Documentation +@settitle ffplay Documentation @titlepage -@center @titlefont{FFplay Documentation} +@center @titlefont{ffplay Documentation} @end titlepage @top @@ -13,7 +13,7 @@ @example @c man begin SYNOPSIS -ffplay [options] @file{input_file} +ffplay [options] [@file{input_file}] @c man end @end example @@ -28,7 +28,7 @@ various FFmpeg APIs. @chapter Options @c man begin OPTIONS -@include fftools-common-opts.texi +@include avtools-common-opts.texi @section Main options @@ -38,8 +38,9 @@ Force displayed width. @item -y @var{height} Force displayed height. @item -s @var{size} -Set frame size (WxH or abbreviation), needed for videos which don't -contain a header with the frame size like raw YUV. +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 @@ -58,27 +59,44 @@ Force format. Set window title (default is the input filename). @item -loop @var{number} Loops movie playback <number> 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} 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 @@ -116,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 @@ -148,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. @@ -156,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 diff --git a/lib/ffmpeg/doc/ffprobe.texi b/lib/ffmpeg/doc/ffprobe.texi index de65eee664..829a46e4b6 100644 --- a/lib/ffmpeg/doc/ffprobe.texi +++ b/lib/ffmpeg/doc/ffprobe.texi @@ -1,8 +1,8 @@ \input texinfo @c -*- texinfo -*- -@settitle FFprobe Documentation +@settitle ffprobe Documentation @titlepage -@center @titlefont{FFprobe Documentation} +@center @titlefont{ffprobe Documentation} @end titlepage @top @@ -22,7 +22,7 @@ ffprobe [options] [@file{input_file}] @chapter Description @c man begin DESCRIPTION -FFprobe gathers information from multimedia streams and prints it in +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 @@ -33,7 +33,7 @@ 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 +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. @@ -41,26 +41,19 @@ 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 the form: -@example -[SECTION] -key1=val1 -... -keyN=valN -[/SECTION] -@end example +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, and -are prefixed by the string "TAG:". +and printed in the corresponding "FORMAT" or "STREAM" section. @c man end @chapter Options @c man begin OPTIONS -@include fftools-common-opts.texi +@include avtools-common-opts.texi @section Main options @@ -87,6 +80,25 @@ Use sexagesimal format HH:MM:SS.MICROSECONDS for time values. 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. @@ -101,6 +113,13 @@ 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. @@ -108,18 +127,199 @@ multimedia stream. Each media stream information is printed within a dedicated section with name "STREAM". +@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 muxers.texi @include protocols.texi @include indevs.texi @ignore @setfilename ffprobe -@settitle FFprobe media prober +@settitle ffprobe media prober @c man begin SEEALSO ffmpeg(1), ffplay(1), ffserver(1) and the FFmpeg HTML documentation diff --git a/lib/ffmpeg/doc/ffprobe.xsd b/lib/ffmpeg/doc/ffprobe.xsd new file mode 100644 index 0000000000..9ac80bb0e6 --- /dev/null +++ b/lib/ffmpeg/doc/ffprobe.xsd @@ -0,0 +1,164 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.ffmpeg.org/schema/ffprobe" + xmlns:ffprobe="http://www.ffmpeg.org/schema/ffprobe"> + + <xsd:element name="ffprobe" type="ffprobe:ffprobeType"/> + + <xsd:complexType name="ffprobeType"> + <xsd:sequence> + <xsd:element name="packets" type="ffprobe:packetsType" minOccurs="0" maxOccurs="1" /> + <xsd:element name="frames" type="ffprobe:framesType" minOccurs="0" maxOccurs="1" /> + <xsd:element name="streams" type="ffprobe:streamsType" minOccurs="0" maxOccurs="1" /> + <xsd:element name="format" type="ffprobe:formatType" minOccurs="0" maxOccurs="1" /> + <xsd:element name="error" type="ffprobe:errorType" minOccurs="0" maxOccurs="1" /> + <xsd:element name="program_version" type="ffprobe:programVersionType" minOccurs="0" maxOccurs="1" /> + <xsd:element name="library_versions" type="ffprobe:libraryVersionsType" minOccurs="0" maxOccurs="1" /> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="packetsType"> + <xsd:sequence> + <xsd:element name="packet" type="ffprobe:packetType" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="framesType"> + <xsd:sequence> + <xsd:element name="frame" type="ffprobe:frameType" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="packetType"> + <xsd:attribute name="codec_type" type="xsd:string" use="required" /> + <xsd:attribute name="stream_index" type="xsd:int" use="required" /> + <xsd:attribute name="pts" type="xsd:long" /> + <xsd:attribute name="pts_time" type="xsd:float" /> + <xsd:attribute name="dts" type="xsd:long" /> + <xsd:attribute name="dts_time" type="xsd:float" /> + <xsd:attribute name="duration" type="xsd:long" /> + <xsd:attribute name="duration_time" type="xsd:float" /> + <xsd:attribute name="size" type="xsd:long" use="required" /> + <xsd:attribute name="pos" type="xsd:long" /> + <xsd:attribute name="flags" type="xsd:string" use="required" /> + </xsd:complexType> + + <xsd:complexType name="frameType"> + <xsd:attribute name="media_type" type="xsd:string" use="required"/> + <xsd:attribute name="key_frame" type="xsd:int" use="required"/> + <xsd:attribute name="pts" type="xsd:long" /> + <xsd:attribute name="pts_time" type="xsd:float"/> + <xsd:attribute name="pkt_pts" type="xsd:long" /> + <xsd:attribute name="pkt_pts_time" type="xsd:float"/> + <xsd:attribute name="pkt_dts" type="xsd:long" /> + <xsd:attribute name="pkt_dts_time" type="xsd:float"/> + <xsd:attribute name="pkt_pos" type="xsd:long" /> + + <!-- audio attributes --> + <xsd:attribute name="sample_fmt" type="xsd:string"/> + <xsd:attribute name="nb_samples" type="xsd:long" /> + + <!-- video attributes --> + <xsd:attribute name="width" type="xsd:long" /> + <xsd:attribute name="height" type="xsd:long" /> + <xsd:attribute name="pix_fmt" type="xsd:string"/> + <xsd:attribute name="sample_aspect_ratio" type="xsd:string"/> + <xsd:attribute name="pict_type" type="xsd:string"/> + <xsd:attribute name="coded_picture_number" type="xsd:long" /> + <xsd:attribute name="display_picture_number" type="xsd:long" /> + <xsd:attribute name="interlaced_frame" type="xsd:int" /> + <xsd:attribute name="top_field_first" type="xsd:int" /> + <xsd:attribute name="repeat_pict" type="xsd:int" /> + <xsd:attribute name="reference" type="xsd:int" /> + </xsd:complexType> + + <xsd:complexType name="streamsType"> + <xsd:sequence> + <xsd:element name="stream" type="ffprobe:streamType" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="streamType"> + <xsd:attribute name="index" type="xsd:int" use="required"/> + <xsd:attribute name="codec_name" type="xsd:string" /> + <xsd:attribute name="codec_long_name" type="xsd:string" /> + <xsd:attribute name="codec_type" type="xsd:string" /> + <xsd:attribute name="codec_time_base" type="xsd:string" use="required"/> + <xsd:attribute name="codec_tag" type="xsd:string" use="required"/> + <xsd:attribute name="codec_tag_string" type="xsd:string" use="required"/> + + <!-- video attributes --> + <xsd:attribute name="width" type="xsd:int"/> + <xsd:attribute name="height" type="xsd:int"/> + <xsd:attribute name="has_b_frames" type="xsd:int"/> + <xsd:attribute name="sample_aspect_ratio" type="xsd:string"/> + <xsd:attribute name="display_aspect_ratio" type="xsd:string"/> + <xsd:attribute name="pix_fmt" type="xsd:string"/> + <xsd:attribute name="level" type="xsd:int"/> + <xsd:attribute name="timecode" type="xsd:string"/> + + <!-- audio attributes --> + <xsd:attribute name="sample_fmt" type="xsd:string"/> + <xsd:attribute name="sample_rate" type="xsd:int"/> + <xsd:attribute name="channels" type="xsd:int"/> + <xsd:attribute name="bits_per_sample" type="xsd:int"/> + + <xsd:attribute name="id" type="xsd:string"/> + <xsd:attribute name="r_frame_rate" type="xsd:string" use="required"/> + <xsd:attribute name="avg_frame_rate" type="xsd:string" use="required"/> + <xsd:attribute name="time_base" type="xsd:string" use="required"/> + <xsd:attribute name="start_time" type="xsd:float"/> + <xsd:attribute name="duration" type="xsd:float"/> + <xsd:attribute name="nb_frames" type="xsd:int"/> + </xsd:complexType> + + <xsd:complexType name="formatType"> + <xsd:sequence> + <xsd:element name="tag" type="ffprobe:tagType" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + + <xsd:attribute name="filename" type="xsd:string" use="required"/> + <xsd:attribute name="nb_streams" type="xsd:int" use="required"/> + <xsd:attribute name="format_name" type="xsd:string" use="required"/> + <xsd:attribute name="format_long_name" type="xsd:string" use="required"/> + <xsd:attribute name="start_time" type="xsd:float"/> + <xsd:attribute name="duration" type="xsd:float"/> + <xsd:attribute name="size" type="xsd:long"/> + <xsd:attribute name="bit_rate" type="xsd:long"/> + </xsd:complexType> + + <xsd:complexType name="tagType"> + <xsd:attribute name="key" type="xsd:string" use="required"/> + <xsd:attribute name="value" type="xsd:string" use="required"/> + </xsd:complexType> + + <xsd:complexType name="errorType"> + <xsd:attribute name="code" type="xsd:int" use="required"/> + <xsd:attribute name="string" type="xsd:string" use="required"/> + </xsd:complexType> + + <xsd:complexType name="programVersionType"> + <xsd:attribute name="version" type="xsd:string" use="required"/> + <xsd:attribute name="copyright" type="xsd:string" use="required"/> + <xsd:attribute name="build_date" type="xsd:string" use="required"/> + <xsd:attribute name="build_time" type="xsd:string" use="required"/> + <xsd:attribute name="compiler_type" type="xsd:string" use="required"/> + <xsd:attribute name="compiler_version" type="xsd:string" use="required"/> + <xsd:attribute name="configuration" type="xsd:string" use="required"/> + </xsd:complexType> + + <xsd:complexType name="libraryVersionType"> + <xsd:attribute name="name" type="xsd:string" use="required"/> + <xsd:attribute name="major" type="xsd:int" use="required"/> + <xsd:attribute name="minor" type="xsd:int" use="required"/> + <xsd:attribute name="micro" type="xsd:int" use="required"/> + <xsd:attribute name="version" type="xsd:int" use="required"/> + </xsd:complexType> + + <xsd:complexType name="libraryVersionsType"> + <xsd:sequence> + <xsd:element name="library_version" type="ffprobe:libraryVersionType" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> +</xsd:schema> diff --git a/lib/ffmpeg/doc/ffserver.texi b/lib/ffmpeg/doc/ffserver.texi index 0cab3c8a98..074c075f0b 100644 --- a/lib/ffmpeg/doc/ffserver.texi +++ b/lib/ffmpeg/doc/ffserver.texi @@ -1,8 +1,8 @@ \input texinfo @c -*- texinfo -*- -@settitle FFserver Documentation +@settitle ffserver Documentation @titlepage -@center @titlefont{FFserver Documentation} +@center @titlefont{ffserver Documentation} @end titlepage @top @@ -22,24 +22,25 @@ ffserver [options] @chapter Description @c man begin DESCRIPTION -FFserver is a streaming server for both audio and video. It supports +ffserver 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 ffserver.conf). -FFserver 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 ffserver / ffmpeg. All questions about parameters for ffmpeg, codec questions, -etc. are not covered here. Read @file{ffmpeg-doc.html} for more +etc. are not covered here. Read @file{ffmpeg.html} for more information. @section How does it work? -FFserver receives prerecorded files or FFM streams from some ffmpeg +ffserver receives prerecorded files or FFM streams from some ffmpeg instance as input, then streams them over RTP/RTSP/HTTP. An ffserver instance will listen on some port as specified in the @@ -57,7 +58,7 @@ file. @section Status stream -FFserver 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 @@ -110,8 +111,8 @@ As a simple test, just run the following two command lines where INPUTFILE is some file which you can decode with ffmpeg: @example -./ffserver -f doc/ffserver.conf & -./ffmpeg -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 @@ -146,7 +147,7 @@ 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 ffmpeg. -@subsection The audio and video loose sync after a while. +@subsection The audio and video lose sync after a while. Yes, they do. @@ -240,7 +241,7 @@ For example: @samp{http://localhost:8080/test.asf?date=2002-07-26T23:05:00}. @chapter Options @c man begin OPTIONS -@include fftools-common-opts.texi +@include avtools-common-opts.texi @section Main options @@ -249,8 +250,8 @@ For example: @samp{http://localhost:8080/test.asf?date=2002-07-26T23:05:00}. 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 <Stream> sections. FFserver will not launch any -ffmpeg instance, so you will have to launch them manually. +within the various <Stream> 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 ffserver to run in the foreground @@ -261,11 +262,11 @@ rather than as a daemon. @ignore @setfilename ffserver -@settitle FFserver video server +@settitle ffserver video server @c man begin SEEALSO -ffmpeg(1), ffplay(1), ffprobe(1), the @file{ffmpeg/doc/ffserver.conf} +ffmpeg(1), ffplay(1), ffprobe(1), the @file{ffserver.conf} example and the FFmpeg HTML documentation @c man end diff --git a/lib/ffmpeg/doc/fftools-common-opts.texi b/lib/ffmpeg/doc/fftools-common-opts.texi deleted file mode 100644 index d72ca5cc00..0000000000 --- a/lib/ffmpeg/doc/fftools-common-opts.texi +++ /dev/null @@ -1,93 +0,0 @@ -All the numerical options, if not specified otherwise, accept in input -a string representing a number, which may contain one of the -International System number postfixes, for example 'K', 'M', 'G'. -If 'i' is appended after the postfix, powers of 2 are used instead of -powers of 10. The 'B' postfix multiplies the value for 8, and can be -appended after another postfix or used alone. This allows using for -example 'KB', 'MiB', 'G' and 'B' as postfix. - -Options which do not take arguments are boolean options, and set the -corresponding value to true. They can be set to false by prefixing -with "no" the option name, for example using "-nofoo" in the -commandline will set to false the boolean option with name "foo". - -@section Generic options - -These options are shared amongst the ff* tools. - -@table @option - -@item -L -Show license. - -@item -h, -?, -help, --help -Show help. - -@item -version -Show version. - -@item -formats -Show available formats. - -The fields preceding the format names have the following meanings: -@table @samp -@item D -Decoding available -@item E -Encoding available -@end table - -@item -codecs -Show available codecs. - -The fields preceding the codec names have the following meanings: -@table @samp -@item D -Decoding available -@item E -Encoding available -@item V/A/S -Video/audio/subtitle codec -@item S -Codec supports slices -@item D -Codec supports direct rendering -@item T -Codec can handle input truncated at random locations instead of only at frame boundaries -@end table - -@item -bsfs -Show available bitstream filters. - -@item -protocols -Show available protocols. - -@item -filters -Show available libavfilter filters. - -@item -pix_fmts -Show available pixel formats. - -@item -loglevel @var{loglevel} -Set the logging level used by the library. -@var{loglevel} is a number or a string containing one of the following values: -@table @samp -@item quiet -@item panic -@item fatal -@item error -@item warning -@item info -@item verbose -@item debug -@end table - -By default the program logs to stderr, if coloring is supported by the -terminal, colors are used to mark errors and warnings. Log coloring -can be disabled setting the environment variable -@env{FFMPEG_FORCE_NOCOLOR} or @env{NO_COLOR}, or can be forced setting -the environment variable @env{FFMPEG_FORCE_COLOR}. -The use of the environment variable @env{NO_COLOR} is deprecated and -will be dropped in a following FFmpeg version. - -@end table diff --git a/lib/ffmpeg/doc/filters.texi b/lib/ffmpeg/doc/filters.texi index 3842886521..43eec40d16 100644 --- a/lib/ffmpeg/doc/filters.texi +++ b/lib/ffmpeg/doc/filters.texi @@ -17,9 +17,9 @@ output pads is called a "sink". @section Filtergraph syntax A filtergraph can be represented using a textual representation, which -is recognized by the @code{-vf} and @code{-af} options of the ff* -tools, and by the @code{av_parse_graph()} function defined in -@file{libavfilter/avfiltergraph}. +is recognized by the @code{-vf} option of the ff* +tools, and by the @code{avfilter_graph_parse()} function defined in +@file{libavfilter/avfiltergraph.h}. A filterchain consists of a sequence of connected filters, each one connected to the previous one in the sequence. A filterchain is @@ -93,16 +93,396 @@ Follows a BNF description for the filtergraph syntax: @c man begin AUDIO FILTERS When you configure your FFmpeg build, you can disable any of the -existing filters using --disable-filters. +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{packing_format}". + +@var{sample_format} specifies the sample format, and can be a string or +the corresponding numeric value defined in @file{libavutil/samplefmt.h}. + +@var{channel_layout} specifies the channel layout, and can be a string +or the corresponding number value defined in @file{libavutil/audioconvert.h}. + +@var{packing_format} specifies the type of packing in output, can be one +of "planar" or "packed", or the corresponding numeric values "0" or "1". + +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 unsigned 8-bit, stereo, packed: +@example +aconvert=u8:stereo:packed +@end example + +@item +Convert input to unsigned 8-bit, automatically select out channel layout +and packing format: +@example +aconvert=u8:auto: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 + @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, +@item the number of output channels is supported by libswresample (16 at the + moment) +@c if SWR_CH_MAX changes, fix the line above. +@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 @@ -110,31 +490,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 3, this is +equivalent to: +@example +abuffer=44100:1:3: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 an optional sequence of @var{key}=@var{value} pairs, +separated by ":". -It accepts as optional parameter a string of the form -@var{sample_rate}:@var{channel_layout}. +The description of the accepted options follows. -@var{sample_rate} specify the sample rate, and defaults to 44100. +@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 @@ -144,6 +705,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 @@ -156,12 +728,28 @@ tools. @c man begin VIDEO FILTERS When you configure your FFmpeg build, you can disable any of the -existing filters using --disable-filters. +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 in input the name of the ass file to render. + +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 blackframe Detect frames that are (almost) completely black. Can be useful to @@ -183,6 +771,66 @@ threshold, and defaults to 98. @var{threshold} is the threshold below which a pixel value is considered black, and defaults to 32. +@section boxblur + +Apply boxblur algorithm to the input video. + +This filter accepts the parameters: +@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 +@var{luma_power}. + +@var{luma_radius}, @var{chroma_radius}, and @var{alpha_radius} represent +the radius in pixels of the box used for blurring the corresponding +input plane. They are expressions, and can contain the following +constants: +@table @option +@item w, h +the input width and height in pixels + +@item cw, ch +the input chroma image width and height in pixels + +@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. +@end table + +The radius must be a non-negative number, and must not be greater than +the value of the expression @code{min(w,h)/2} for the luma and alpha planes, +and of @code{min(cw,ch)/2} for the chroma planes. + +@var{luma_power}, @var{chroma_power}, and @var{alpha_power} represent +how many times the boxblur filter is applied to the corresponding +plane. + +Some examples follow: + +@itemize + +@item +Apply a boxblur filter with luma, chroma, and alpha radius +set to 2: +@example +boxblur=2:1 +@end example + +@item +Set luma radius to 2, alpha and chroma radius to 0 +@example +boxblur=2:1:0:0:0:0 +@end example + +@item +Set luma and chroma radius to a fraction of the video dimension +@example +boxblur=min(h\,w)/10:1:min(cw\,ch)/10:1 +@end example + +@end itemize + @section copy Copy the input source unchanged to the output. Mainly useful for @@ -195,26 +843,35 @@ Crop the input video to @var{out_w}:@var{out_h}:@var{x}:@var{y}. The parameters 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 x, y the computed values for @var{x} and @var{y}. They are evaluated for each new frame. @item in_w, in_h -the input width and heigth +the input width and height @item iw, ih same as @var{in_w} and @var{in_h} @item out_w, out_h -the output (cropped) width and heigth +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 @@ -321,6 +978,128 @@ indicates never reset and return the largest area encountered during playback. @end table +@section delogo + +Suppress a TV station logo by a simple interpolation of the surrounding +pixels. Just set a rectangle covering the logo and watch it disappear +(and sometimes something even uglier appear - your mileage may vary). + +The filter accepts parameters as a string of the form +"@var{x}:@var{y}:@var{w}:@var{h}:@var{band}", or as a list of +@var{key}=@var{value} pairs, separated by ":". + +The description of the accepted parameters follows. + +@table @option + +@item x, y +Specify the top left corner coordinates of the logo. They must be +specified. + +@item w, h +Specify the width and height of the logo to clear. They must be +specified. + +@item band, t +Specify the thickness of the fuzzy edge of the rectangle (added to +@var{w} and @var{h}). The default value is 4. + +@item show +When set to 1, a green rectangle is drawn on the screen to simplify +finding the right @var{x}, @var{y}, @var{w}, @var{h} parameters, and +@var{band} is set to 4. The default value is 0. + +@end table + +Some examples follow. + +@itemize + +@item +Set a rectangle covering the area with top left corner coordinates 0,0 +and size 100x77, setting a band of size 10: +@example +delogo=0:0:100:77:10 +@end example + +@item +As the previous example, but use named options: +@example +delogo=x=0:y=0:w=100:h=77:band=10 +@end example + +@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. @@ -353,6 +1132,329 @@ drawbox drawbox=10:20:200:60:red@@0.5" @end example +@section drawtext + +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 FFmpeg with +@code{--enable-libfreetype}. + +The filter also recognizes strftime() sequences in the provided text +and expands them accordingly. Check the documentation of strftime(). + +The filter accepts parameters as a list of @var{key}=@var{value} pairs, +separated by ":". + +The description of the accepted parameters follows. + +@table @option + +@item fontfile +The font file to be used for drawing text. Path must be included. +This parameter is mandatory. + +@item text +The text string to be drawn. The text must be a sequence of UTF-8 +encoded characters. +This parameter is mandatory if no file is specified with the parameter +@var{textfile}. + +@item textfile +A text file containing text to be drawn. The text must be a sequence +of UTF-8 encoded characters. + +This parameter is mandatory if no text string is specified with the +parameter @var{text}. + +If both text and textfile are specified, an error is thrown. + +@item x, y +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. + +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. +The default value of @var{fontsize} is 16. + +@item fontcolor +The color to be used for drawing fonts. +Either a string (e.g. "red") or in 0xRRGGBB[AA] format +(e.g. "0xff000033"), possibly followed by an alpha specifier. +The default value of @var{fontcolor} is "black". + +@item boxcolor +The color to be used for drawing box around text. +Either a string (e.g. "yellow") or in 0xRRGGBB[AA] format +(e.g. "0xff00ff"), possibly followed by an alpha specifier. +The default value of @var{boxcolor} is "white". + +@item box +Used to draw a box around text using background color. +Value should be either 1 (enable) or 0 (disable). +The default value of @var{box} is 0. + +@item shadowx, shadowy +The x and y offsets for the text shadow position with respect to the +position of the text. They can be either positive or negative +values. Default value for both is "0". + +@item shadowcolor +The color to be used for drawing a shadow behind the drawn text. It +can be a color name (e.g. "yellow") or a string in the 0xRRGGBB[AA] +form (e.g. "0xff00ff"), possibly followed by an alpha specifier. +The default value of @var{shadowcolor} is "black". + +@item ft_load_flags +Flags to be used for loading the fonts. + +The flags map the corresponding flags supported by libfreetype, and are +a combination of the following values: +@table @var +@item default +@item no_scale +@item no_hinting +@item render +@item no_bitmap +@item vertical_layout +@item force_autohint +@item crop_bitmap +@item pedantic +@item ignore_global_advance_width +@item no_recurse +@item ignore_transform +@item monochrome +@item linear_design +@item no_autohint +@item end table +@end table + +Default value is "render". + +For more information consult the documentation for the FT_LOAD_* +libfreetype flags. + +@item tabsize +The size in number of spaces to use for rendering the tab. +Default value is 4. +@end table + +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. +Note that timecode options are @emph{not} effective if FFmpeg is build with +@code{--disable-avcodec}. + +@item r, rate +frame rate (timecode only) +@end table + +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 + +@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%. + +@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 + +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 + +@end itemize + +For more information about libfreetype, check: +@url{http://www.freetype.org/}. + +@section fade + +Apply fade-in/out effect to input video. + +It accepts the parameters: +@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. + +@var{start_frame} specifies the number of the start frame for starting +to apply the fade effect. + +@var{nb_frames} specifies the number of frames for which the fade +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 +fade=in:0:30 + +# fade out last 45 frames of a 200-frame video +fade=out:155:45 + +# fade in first 25 frames and fade out last 25 frames of a 1000-frame video +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 + +Transform the field order of the input video. + +It accepts one parameter which specifies the required field order that +the input interlaced video will be transformed to. The parameter can +assume one of the following values: + +@table @option +@item 0 or bff +output bottom field first +@item 1 or tff +output top field first +@end table + +Default value is "tff". + +Transformation is achieved by shifting the picture content up or down +by one line, and filling the remaining line with appropriate picture content. +This method is consistent with most broadcast field order converters. + +If the input video is not flagged as being interlaced, or it is already +flagged as being of the required output field order then this filter does +not alter the incoming video. + +This filter is very useful when converting to or from PAL DV material, +which is bottom field first. + +For example: +@example +ffmpeg -i in.vob -vf "fieldorder=bff" out.dv +@end example + @section fifo Buffer input images and send them when they are requested. @@ -386,7 +1488,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 FFmpeg with --enable-frei0r. +header and configure FFmpeg with @code{--enable-frei0r}. The filter supports the syntax: @example @@ -434,10 +1536,14 @@ 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. +This filter is designed for playback only. Do not use it prior to +lossy compression, because compression tends to lose the dither and +bring back the bands. + The filter takes two optional parameters, separated by ':': @var{strength}:@var{radius} @@ -464,8 +1570,7 @@ gradfun=1.2 Flip the input video horizontally. -For example to horizontally flip the video in input with -@file{ffmpeg}: +For example to horizontally flip the input video with @command{ffmpeg}: @example ffmpeg -i in.avi -vf "hflip" out.avi @end example @@ -497,6 +1602,224 @@ a float number which specifies chroma temporal strength, defaults to @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial} @end table +@section lut, lutrgb, lutyuv + +Compute a look-up table for binding each pixel component input value +to an output value, and apply it to input video. + +@var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb} +to an RGB input video. + +These filters accept in input a ":"-separated list of options, which +specify the expressions used for computing the lookup table for the +corresponding pixel component values. + +The @var{lut} filter requires either YUV or RGB pixel formats in +input, and accepts the options: +@table @option +@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 +input. + +The @var{lutrgb} filter requires RGB pixel formats in input, and +accepts the options: +@table @option +@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 +@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 w, h +the input width and height + +@item val +input value for the pixel component + +@item clipval +the input value clipped in the @var{minval}-@var{maxval} range + +@item maxval +maximum value for the pixel component + +@item minval +minimum value for the pixel component + +@item negval +the negated value for the pixel component value clipped in the +@var{minval}-@var{maxval} range , it corresponds to the expression +"maxval-clipval+minval" + +@item clip(val) +the computed value in @var{val} clipped in the +@var{minval}-@var{maxval} range + +@item gammaval(gamma) +the computed gamma correction value of the pixel component value +clipped in the @var{minval}-@var{maxval} range, corresponds to the +expression +"pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval" + +@end table + +All expressions default to "val". + +Some examples follow: +@example +# negate input video +lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val" +lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val" + +# the above is the same as +lutrgb="r=negval:g=negval:b=negval" +lutyuv="y=negval:u=negval:v=negval" + +# negate luminance +lutyuv=y=negval + +# remove chroma components, turns the video into a graytone image +lutyuv="u=128:v=128" + +# apply a luma burning effect +lutyuv="y=2*val" + +# remove green and blue components +lutrgb="g=0:b=0" + +# set a constant alpha channel value on input +format=rgba,lutrgb=a="maxval-minval/2" + +# correct luminance gamma by a 0.5 factor +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 2xsai +@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 mirror +@item noise +@item ow +@item palette +@item perspective +@item phase +@item pp7 +@item pullup +@item qp +@item rectangle +@item remove-logo +@item rotate +@item sab +@item screenshot +@item smartblur +@item softpulldown +@item softskip +@item spp +@item swapuv +@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 +# remove a logo by interpolating the surrounding pixels +mp=delogo=200:200:80:20:1 + +# 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. + +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 @@ -524,7 +1847,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 FFmpeg with --enable-libopencv. +configure FFmpeg with @code{--enable-libopencv}. The filter takes the parameters: @var{filter_name}@{:=@}@var{filter_params}. @@ -534,7 +1857,7 @@ The filter takes the parameters: @var{filter_name}@{:=@}@var{filter_params}. filter. If not specified the default values are assumed. Refer to the official libopencv documentation for more precise -informations: +information: @url{http://opencv.willowgarage.com/documentation/c/image_filtering.html} Follows the list of supported libopencv filters. @@ -550,7 +1873,7 @@ It accepts the parameters: @var{struct_el}:@var{nb_iterations}. @var{struct_el} represents a structuring element, and has the syntax: @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape} -@var{cols} and @var{rows} represent the number of colums and rows of +@var{cols} and @var{rows} represent the number of columns and rows of the structuring element, @var{anchor_x} and @var{anchor_y} the anchor point, and @var{shape} the shape for the structuring element, and can be one of the values "rect", "cross", "ellipse", "custom". @@ -592,8 +1915,7 @@ Erode an image by using a specific structuring element. This filter corresponds to the libopencv function @code{cvErode}. The filter accepts the parameters: @var{struct_el}:@var{nb_iterations}, -with the same meaning and use of those of the dilate filter -(@pxref{dilate}). +with the same syntax and semantics as the @ref{dilate} filter. @subsection smooth @@ -617,6 +1939,7 @@ other parameters is 0. These parameters correspond to the parameters assigned to the libopencv function @code{cvSmooth}. +@anchor{overlay} @section overlay Overlay one video on top of another. @@ -624,10 +1947,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 @@ -644,6 +1967,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 @@ -657,13 +1991,13 @@ 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 -movie=0:png:logo.png [logo]; +movie=logo.png [logo]; [in][logo] overlay=10:main_h-overlay_h-10 [out] # insert 2 different transparent PNG logos (second logo on bottom # right corner): -movie=0:png:logo1.png [logo1]; -movie=0:png:logo2.png [logo2]; +movie=logo1.png [logo1]; +movie=logo2.png [logo2]; [in][logo1] overlay=10:H-h-10 [in+logo1]; [in+logo1][logo2] overlay=W-w-10:H-h-10 [out] @@ -672,7 +2006,7 @@ movie=0:png:logo2.png [logo2]; color=red@.3:WxH [over]; [in][over] overlay [out] @end example -You can chain togheter more overlays but the efficiency of such +You can chain together more overlays but the efficiency of such approach is yet to be tested. @section pad @@ -683,6 +2017,41 @@ given coordinates @var{x}, @var{y}. It accepts the following parameters: @var{width}:@var{height}:@var{x}:@var{y}:@var{color}. +The parameters @var{width}, @var{height}, @var{x}, and @var{y} are +expressions containing the following constants: + +@table @option +@item in_w, in_h +the input video width and height + +@item iw, ih +same as @var{in_w} and @var{in_h} + +@item out_w, out_h +the output width and height, that is the size of the padded area as +specified by the @var{width} and @var{height} expressions + +@item ow, oh +same as @var{out_w} and @var{out_h} + +@item x, y +x and y offsets as specified by the @var{x} and @var{y} +expressions, or NAN if not yet specified + +@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. +@end table + Follows the description of the accepted parameters. @table @option @@ -692,6 +2061,9 @@ Specify the size of the output image with the paddings added. If the value for @var{width} or @var{height} is 0, the corresponding input size is used for the output. +The @var{width} expression can reference the value set by the +@var{height} expression, and vice versa. + The default value of @var{width} and @var{height} is 0. @item x, y @@ -699,6 +2071,9 @@ The default value of @var{width} and @var{height} is 0. Specify the offsets where to place the input image in the padded area with respect to the top/left border of the output image. +The @var{x} expression can reference the value set by the @var{y} +expression, and vice versa. + The default value of @var{x} and @var{y} is 0. @item color @@ -710,13 +2085,35 @@ The default value of @var{color} is "black". @end table -For example: +Some examples follow: @example # Add paddings with color "violet" to the input video. Output video # size is 640x480, the top-left corner of the input video is placed at -# row 0, column 40. +# column 0, row 40. pad=640:480:0:40:violet + +# pad the input to get an output with dimensions increased bt 3/2, +# and put the input video at the center of the padded area +pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2" + +# pad the input to get a squared output with size equal to the maximum +# value between the input width and height, and put the input video at +# the center of the padded area +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" @end example @section pixdesctest @@ -733,15 +2130,37 @@ can be used to test the monowhite pixel format descriptor definition. @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. -For example the command: +The parameters @var{width} and @var{height} are expressions containing +the following constants: -@example -./ffmpeg -i in.avi -vf "scale=200:100" out.avi -@end example +@table @option +@item in_w, in_h +the input width and height + +@item iw, ih +same as @var{in_w} and @var{in_h} + +@item out_w, out_h +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} -will scale the input video to a size of 200x100. +@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. +@end table If the input image format is different from the format requested by the next filter, the scale filter will convert the input to the @@ -756,6 +2175,184 @@ 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 + +Some examples follow: +@example +# scale the input video to a size of 200x100. +scale=200:100 + +# scale the input to 2x +scale=2*iw:2*ih +# the above is the same as +scale=2*in_w:2*in_h + +# scale the input to half size +scale=iw/2:ih/2 + +# increase the width, and set the height to the same size +scale=3/2*iw:ow + +# seek for Greek harmony +scale=iw:1/PHI*iw +scale=ih*PHI:ih + +# increase the height, and set the width to 3/2 of the height +scale=3/2*oh:3/5*ih + +# increase the size, but make the size a multiple of the chroma +scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub" + +# increase the width to a maximum of 500 pixels, keep the same input aspect ratio +scale='min(500\, iw*3/2):-1' +@end example + +@section select +Select frames to pass in output. + +It accepts in input an expression, which is evaluated for each input +frame. If the expression is evaluated to a non-zero value, the frame +is selected and passed to the output, otherwise it is discarded. + +The expression can contain the following constants: + +@table @option +@item n +the sequential number of the filtered frame, starting from 0 + +@item selected_n +the sequential number of the selected frame, starting from 0 + +@item prev_selected_n +the sequential number of the last selected frame, NAN if undefined + +@item TB +timebase of the input timestamps + +@item pts +the PTS (Presentation TimeStamp) of the filtered video frame, +expressed in @var{TB} units, NAN if undefined + +@item t +the PTS (Presentation TimeStamp) of the filtered video frame, +expressed in seconds, NAN if undefined + +@item prev_pts +the PTS of the previously filtered video frame, NAN if undefined + +@item prev_selected_pts +the PTS of the last previously filtered video frame, NAN if undefined + +@item prev_selected_t +the PTS of the last previously selected video frame, NAN if undefined + +@item start_pts +the PTS of the first video frame in the video, NAN if undefined + +@item start_t +the time of the first video frame in the video, NAN if undefined + +@item pict_type +the type of the filtered frame, can assume one of the following +values: +@table @option +@item I +@item P +@item B +@item S +@item SI +@item SP +@item BI +@end table + +@item interlace_type +the frame interlace type, can assume one of the following values: +@table @option +@item PROGRESSIVE +the frame is progressive (not interlaced) +@item TOPFIRST +the frame is top-field-first +@item BOTTOMFIRST +the frame is bottom-field-first +@end table + +@item key +1 if the filtered frame is a key-frame, 0 otherwise + +@item pos +the position in the file of the filtered frame, -1 if the information +is not available (e.g. for synthetic video) +@end table + +The default value of the select expression is "1". + +Some examples follow: + +@example +# select all frames in input +select + +# the above is the same as: +select=1 + +# skip all frames: +select=0 + +# select only I-frames +select='eq(pict_type\,I)' + +# select one frame every 100 +select='not(mod(n\,100))' + +# select only frames contained in the 10-20 time interval +select='gte(t\,10)*lte(t\,20)' + +# select only I frames contained in the 10-20 time interval +select='gte(t\,10)*lte(t\,20)*eq(pict_type\,I)' + +# select frames with a minimum distance of 10 seconds +select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)' +@end example + +@anchor{setdar} +@section setdar + +Set 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} + +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. + +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". + +For example to change the display aspect ratio to 16:9, specify: +@example +setdar=16:9 +# the above is equivalent to +setdar=1.77777 +@end example + +See also the @ref{setsar} filter documentation. + @section setpts Change the PTS (presentation timestamp) of the input video frames. @@ -767,15 +2364,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. @@ -816,13 +2404,39 @@ 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". @@ -846,13 +2460,72 @@ settb=2*intb settb=AVTB @end example +@section showinfo + +Show a line containing various information for each input video frame. +The input video 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. + +@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 video) + +@item fmt +pixel format name + +@item sar +sample aspect ratio of the input frame, expressed in the form +@var{num}/@var{den} + +@item s +size of the input frame, expressed in the form +@var{width}x@var{height} + +@item i +interlaced mode ("P" for "progressive", "T" for top field first, "B" +for bottom field first) + +@item iskey +1 if the frame is a key frame, 0 otherwise + +@item type +picture type of the input frame ("I" for an I-frame, "P" for a +P-frame, "B" for a B-frame, "?" for unknown type). +Check also the documentation of the @code{AVPictureType} enum and of +the @code{av_get_picture_type_char} function defined in +@file{libavutil/avutil.h}. + +@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) of each plane of the input frame, +expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]" +@end table + @section slicify Pass the images of input video on to next video filter as multiple slices. @example -./ffmpeg -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 @@ -861,6 +2534,82 @@ 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 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 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. @@ -911,7 +2660,7 @@ It accepts the following parameters: Negative values for the amount will blur the input video, while positive values will sharpen. All parameters are optional and default to the -equivalent of the string '5:5:1.0:0:0:0.0'. +equivalent of the string '5:5:1.0:5:5:0.0'. @table @option @@ -929,13 +2678,13 @@ and 5.0, default value is 1.0. @item chroma_msize_x Set the chroma matrix horizontal size. It can be an integer between 3 -and 13, default value is 0. +and 13, default value is 5. @item chroma_msize_y Set the chroma matrix vertical size. It can be an integer between 3 -and 13, default value is 0. +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. @@ -949,7 +2698,7 @@ unsharp=7:7:2.5 unsharp=7:7:-2:7:7:-2 # Use the default values with @command{ffmpeg} -./ffmpeg -i in.avi -vf "unsharp" out.mp4 +ffmpeg -i in.avi -vf "unsharp" out.mp4 @end example @section vflip @@ -957,7 +2706,7 @@ unsharp=7:7:-2:7:7:-2 Flip the input video vertically. @example -./ffmpeg -i in.avi -vf "vflip" out.avi +ffmpeg -i in.avi -vf "vflip" out.avi @end example @section yadif @@ -965,7 +2714,7 @@ Flip the input video vertically. Deinterlace the input video ("yadif" means "yet another deinterlacing filter"). -It accepts the optional parameters: @var{mode}:@var{parity}. +It accepts the optional parameters: @var{mode}:@var{parity}:@var{auto}. @var{mode} specifies the interlacing mode to adopt, accepts one of the following values: @@ -988,9 +2737,9 @@ interlaced video, accepts one of the following values: @table @option @item 0 -assume bottom field first -@item 1 assume top field first +@item 1 +assume bottom field first @item -1 enable automatic detection @end table @@ -999,6 +2748,18 @@ Default value is -1. If interlacing is unknown or decoder does not export this information, top field first will be assumed. +@var{auto} specifies if deinterlacer should trust the interlaced flag +and only deinterlace frames marked as interlaced + +@table @option +@item 0 +deinterlace all frames +@item 1 +only deinterlace frames marked as interlaced +@end table + +Default value is 0. + @c man end VIDEO FILTERS @chapter Video Sources @@ -1014,9 +2775,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{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 explicitely defined. +All the parameters but @var{scale_params} need to be explicitly +defined. Follows the list of the accepted parameters. @@ -1033,22 +2795,147 @@ name. @item timebase_num, timebase_den Specify numerator and denomitor of the timebase assumed by the 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: @example -buffer=320:240:yuv410p:1:24 +buffer=320:240:yuv410p:1:24:1:1 @end example will instruct the source to accept video frames with size 320x240 and -with format "yuv410p" and assuming 1/24 as the timestamps timebase. +with format "yuv410p", assuming 1/24 as the timestamps timebase and +square pixels (1:1 sample aspect ratio). 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. @@ -1067,7 +2954,7 @@ alpha specifier. The default value is "black". @item frame_size Specify the size of the sourced video, it may be a string of the form -@var{width}x@var{heigth}, or the name of a size abbreviation. The +@var{width}x@var{height}, or the name of a size abbreviation. The default value is "320x240". @item frame_rate @@ -1088,28 +2975,124 @@ to the pad with identifier "in". "color=red@@0.2:qcif:10 [color]; [in][color] overlay [out]" @end example -@section nullsrc +@section movie + +Read a video 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 +Specifies 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 +Specifies 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 +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". + +@end table + +This filter allows to overlay a second video on top of main input of +a filtergraph as shown in this graph: +@example +input -----------> deltapts0 --> overlay --> output + ^ + | +movie --> scale--> deltapts1 -------+ +@end example + +Some examples follow: +@example +# skip 3.2 seconds from the start of the avi file in.avi, and overlay it +# on top of the input labelled as "in". +movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [movie]; +[in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out] + +# read from a video4linux2 device, and overlay it on top of the input +# labelled as "in" +movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [movie]; +[in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out] + +@end example + +@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. -Null video source, never return images. It is mainly useful as a -template and to be employed in analysis / debugging tools. +@item test, t -It accepts as optional parameter a string of the form -@var{width}:@var{height}:@var{timebase}. +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 -@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). +Default value is "all", which will cycle through the list of all tests. +@end table + +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 FFmpeg with --enable-frei0r. +header and configure FFmpeg with @code{--enable-frei0r}. The source supports the syntax: @example @@ -1122,16 +3105,211 @@ form @var{width}x@var{height} or a frame size abbreviation. the form @var{num}/@var{den} or a frame rate abbreviation. @var{src_name} is the name to the frei0r source to load. For more information regarding frei0r and how to set the parameters read the -section "frei0r" (@pxref{frei0r}) in the description of the video -filters. +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 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 +stripe from top to bottom. + +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. + +These sources accept an optional sequence of @var{key}=@var{value} pairs, +separated by ":". The description of the accepted options follows. + +@table @option + +@item size, s +Specify the size of the sourced video, it may be a string of the form +@var{width}x@var{height}, or the name of a size abbreviation. The +default value is "320x240". + +@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 sar +Set the sample aspect ratio of the sourced video. + +@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 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: +@example +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 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 @chapter Video Sinks @@ -1139,6 +3317,19 @@ frei0r_src=200x200:10:partik0l=1234 [overlay]; [in][overlay] overlay 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/lib/ffmpeg/doc/general.texi b/lib/ffmpeg/doc/general.texi index 950159f1b3..c3506efd93 100644 --- a/lib/ffmpeg/doc/general.texi +++ b/lib/ffmpeg/doc/general.texi @@ -9,29 +9,92 @@ @contents -@chapter external libraries +@chapter External libraries 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 OpenCORE AMR +@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}. -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 instructions for -installing the libraries. Then pass @code{--enable-libopencore-amrnb} and/or -@code{--enable-libopencore-amrwb} to configure to enable the libraries. +@section OpenCORE and VisualOn libraries -Note that OpenCORE is under the Apache License 2.0 (see -@url{http://www.apache.org/licenses/LICENSE-2.0} for details), which is +Spun off Google Android sources, OpenCore and VisualOn libraries provide +encoders for a number of audio codecs. + +@float NOTE +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 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 + +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 +instructions for installing the libraries. +Then pass @code{--enable-libopencore-amrnb} and/or +@code{--enable-libopencore-amrwb} to configure to enable them. + +@subsection VisualOn AAC encoder library + +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. +Then pass @code{--enable-libvo-aacenc} to configure to enable it. + +@subsection VisualOn AMR-WB encoder library + +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. +Then pass @code{--enable-libvo-amrwbenc} to configure to enable it. + +@section LAME + +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. +Then pass @code{--enable-libmp3lame} to configure to enable it. -@chapter Supported File Formats and Codecs +@section libvpx + +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 +enable it. + +@section x264 + +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 +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 FFmpeg's license to GPL in order to use it. +@end float + + + +@chapter Supported File Formats, Codecs or Features You can use the @code{-formats} and @code{-codecs} options to have an exhaustive list. @@ -45,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 @@ -60,17 +126,24 @@ 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 + @tab Used in Z and Z95 games. @item Brute Force & Ignorance @tab @tab X @tab Used in the game Flash Traffic: City of Angels. +@item BWF @tab X @tab X +@item CRI ADX @tab X @tab X + @tab Audio-only format used in console video games. +@item Discworld II BMV @tab @tab X @item Interplay C93 @tab @tab X @tab Used in the game Cyberia from Interplay. @item Delphine Software International CIN @tab @tab X @tab Multimedia format used by Delphine Software games. @item CD+G @tab @tab X @tab Video format used by CD+G karaoke disks -@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 @@ -79,6 +152,8 @@ library: @tab Audio format used in some games by CRYO Interactive Entertainment. @item D-Cinema audio @tab X @tab X @item Deluxe Paint Animation @tab @tab X +@item DFA @tab @tab X + @tab This format is used in Chronomaster game @item DV video @tab X @tab X @item DXA @tab @tab X @tab This format is used in the non-Windows version of the Feeble Files @@ -92,18 +167,24 @@ library: @tab Only embedded audio is decoded. @item FLI/FLC/FLX animation @tab @tab X @tab .fli/.flc files -@item Flash Video (FLV) @tab @tab X +@item Flash Video (FLV) @tab X @tab X @tab Macromedia Flash video files @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 @@ -113,8 +194,11 @@ library: @tab A format generated by IndigoVision 8000 video server. @item IVF (On2) @tab X @tab X @tab A format used by libvpx +@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 @@ -158,6 +242,7 @@ library: @item NUT @tab X @tab X @tab NUT Open Container Format @item Ogg @tab X @tab X +@item Playstation Portable PMP @tab @tab X @item TechnoTrend PVA @tab @tab X @tab Used by TechnoTrend DVB PCI boards. @item QCP @tab @tab X @@ -222,6 +307,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. @@ -231,7 +317,9 @@ library: @tab Used in Sierra CD-ROM games. @item Smacker @tab @tab X @tab Multimedia format used by many games. -@item Sony OpenMG (OMA) @tab @tab X +@item SMJPEG @tab X @tab X + @tab Used in certain Loki game ports. +@item Sony OpenMG (OMA) @tab X @tab X @tab Audio format used in Sony Sonic Stage and Sony Vegas. @item Sony PlayStation STR @tab @tab X @item Sony Wave64 (W64) @tab @tab X @@ -247,13 +335,18 @@ 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 @tab Multimedia format used in Westwood Studios games. @item Westwood Studios VQA @tab @tab X @tab Multimedia format used in Westwood Studios games. +@item XMV @tab @tab X + @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 @end multitable @@ -273,12 +366,11 @@ following image formats are supported: @tab Only uncompressed GIFs are generated. @item BMP @tab X @tab X @tab Microsoft BMP image -@item DPX @tab @tab X +@item DPX @tab X @tab X @tab Digital Picture Exchange @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 @@ -295,7 +387,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 @@ -308,6 +399,8 @@ 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 XWD @tab X @tab X + @tab X Window Dump image format @end multitable @code{X} means that encoding (resp. decoding) is supported. @@ -327,10 +420,11 @@ 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 +@item Apple ProRes @tab X @tab X @item Apple QuickDraw @tab @tab X @tab fourcc: qdrw @item Asus v1 @tab X @tab X @@ -346,13 +440,16 @@ 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 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 - @tab Support for version 'b' is missing. +@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 @@ -365,11 +462,14 @@ following image formats are supported: @tab AVS1-P2, JiZhun profile, encoding through external library libxavs @item Delphine Software International CIN video @tab @tab X @tab Codec used in Delphine Software International games. +@item Discworld II BMV Video @tab @tab X @item Cinepak @tab @tab X -@item Cirrus Logic AccuPak @tab @tab X +@item Cirrus Logic AccuPak @tab X @tab X @tab fourcc: CLJR @item Creative YUV (CYUV) @tab @tab X -@item Dirac @tab E @tab E +@item DFA @tab @tab X + @tab Codec used in Chronomaster game. +@item Dirac @tab E @tab X @tab supported through external libdirac/libschroedinger libraries @item Deluxe Paint Animation @tab @tab X @item DNxHD @tab X @tab X @@ -379,6 +479,7 @@ following image formats are supported: @item Duck TrueMotion 2.0 @tab @tab X @tab fourcc: TM20 @item DV (Digital Video) @tab X @tab X +@item Dxtory capture format @tab @tab X @item Feeble Files/ScummVM DXA @tab @tab X @tab Codec originally used in Feeble Files game. @item Electronic Arts CMV video @tab @tab X @@ -388,10 +489,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) @item Flash Screen Video v1 @tab X @tab X @tab fourcc: FSV1 +@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 Fraps @tab @tab X @@ -410,17 +513,19 @@ following image formats are supported: @item id RoQ video @tab X @tab X @tab Used in Quake III, Jedi Knight 2, other computer games. @item IFF ILBM @tab @tab X - @tab IFF interlaved bitmap + @tab IFF interleaved bitmap @item IFF ByteRun1 @tab @tab X @tab IFF run length encoded bitmap @item Intel H.263 @tab @tab X @item Intel Indeo 2 @tab @tab X @item Intel Indeo 3 @tab @tab X +@item Intel Indeo 4 @tab @tab X @item Intel Indeo 5 @tab @tab X @item Interplay C93 @tab @tab X @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 @@ -437,13 +542,14 @@ following image formats are supported: @item Miro VideoXL @tab @tab X @tab fourcc: VIXL @item MJPEG (Motion JPEG) @tab X @tab X +@item Mobotix MxPEG video @tab @tab X @item Motion Pixels video @tab @tab X @item MPEG-1 video @tab X @tab X @item MPEG-1/2 video XvMC (X-Video Motion Compensation) @tab @tab X @item MPEG-1/2 video (VDPAU acceleration) @tab @tab X @item MPEG-2 video @tab X @tab X @item MPEG-4 part 2 @tab X @tab X - @ libxvidcore can be used alternatively for encoding. + @tab libxvidcore can be used alternatively for encoding. @item MPEG-4 part 2 Microsoft variant version 1 @tab @tab X @item MPEG-4 part 2 Microsoft variant version 2 @tab X @tab X @item MPEG-4 part 2 Microsoft variant version 3 @tab X @tab X @@ -460,6 +566,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 @@ -469,8 +577,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 @@ -501,20 +609,29 @@ following image formats are supported: @tab encoding supported through external library libtheora @item Tiertex Limited SEQ video @tab @tab X @tab Codec used in DOS CD-ROM FlashBack game. -@item V210 Quicktime Uncompressed 4:2:2 10-bit @tab X @tab X +@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 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 @tab Codec used in videos captured by VMware. @item Westwood Studios VQA (Vector Quantized Animation) video @tab @tab X +@item Windows Media Image @tab @tab X @item Windows Media Video 7 @tab X @tab X @item Windows Media Video 8 @tab X @tab X @item Windows Media Video 9 @tab @tab X @tab not completely working @item Wing Commander III / Xan @tab @tab X @tab Used in Wing Commander III .MVE files. +@item Wing Commander IV / Xan @tab @tab X + @tab Used in Wing Commander IV. @item Winnov WNV1 @tab @tab X @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 @@ -530,8 +647,10 @@ 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 + @tab encoding supported through external library libfaac and libvo-aacenc @item AC-3 @tab IX @tab X @item ADPCM 4X Movie @tab @tab X @item ADPCM CDROM XA @tab @tab X @@ -579,20 +698,24 @@ following image formats are supported: @item ADPCM Yamaha @tab X @tab X @item AMR-NB @tab E @tab X @tab encoding supported through external library libopencore-amrnb -@item AMR-WB @tab @tab X +@item AMR-WB @tab E @tab X + @tab encoding supported through external library libvo-amrwbenc @item Apple lossless audio @tab X @tab X @tab QuickTime fourcc 'alac' @item Atrac 1 @tab @tab X @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 @@ -602,8 +725,10 @@ following image formats are supported: @tab Used in Origin's Wing Commander IV AVI files. @item DSP Group TrueSpeech @tab @tab X @item DV audio @tab @tab X -@item Enhanced AC-3 @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 @@ -646,7 +771,7 @@ following image formats are supported: @item PCM unsigned 24-bit little-endian @tab X @tab X @item PCM unsigned 32-bit big-endian @tab X @tab X @item PCM unsigned 32-bit little-endian @tab X @tab X -@item PCM Zork @tab X @tab X +@item PCM Zork @tab @tab X @item QCELP / PureVoice @tab @tab X @item QDesign Music Codec 2 @tab @tab X @tab There are still some distortions. @@ -661,11 +786,12 @@ following image formats are supported: @item Sierra VMD audio @tab @tab X @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 @tab E +@item Speex @tab E @tab E @tab supported through external library libspeex @item True Audio (TTA) @tab @tab X @item TrueHD @tab @tab X @@ -695,8 +821,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 @@ -706,6 +833,7 @@ performance on systems without hardware floating point support). @multitable @columnfractions .4 .1 @item Name @tab Support +@item Apple HTTP Live Streaming @tab X @item file @tab X @item Gopher @tab X @item HTTP @tab X @@ -729,6 +857,7 @@ performance on systems without hardware floating point support). @item JACK @tab X @tab @item LIBDC1394 @tab X @tab @item OSS @tab X @tab X +@item Pulseaudio @tab X @tab @item Video4Linux @tab X @tab @item Video4Linux2 @tab X @tab @item VfW capture @tab X @tab @@ -737,360 +866,15 @@ performance on systems without hardware floating point support). @code{X} means that input/output is supported. +@section Timecode -@chapter Platform Specific information - -@section DOS - -Using a cross-compiler is preferred for various reasons. - -@subsection DJGPP - -FFmpeg cannot be compiled because of broken system headers, add -@code{--extra-cflags=-U__STRICT_ANSI__} to the configure options as a -workaround. - -@section OS/2 - -For information about compiling FFmpeg on OS/2 see -@url{http://www.edm2.com/index.php/FFmpeg}. - -@section Unix-like - -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: - -@example -$(gcc -print-prog-name=as) --version -@end example - -If not, then you should install a different compiler that has no -hard-coded path to gas. In the worst case pass @code{--disable-asm} -to configure. - -@subsection BSD - -BSD make will not build FFmpeg, you need to install and use GNU Make -(@file{gmake}). - -@subsubsection FreeBSD - -FreeBSD will not compile out-of-the-box due to broken system headers. -Passing @code{--extra-cflags=-D__BSD_VISIBLE} to configure will work -around the problem. This may have unexpected sideeffects, so use it at -your own risk. If you care about FreeBSD, please make an attempt at -getting the system headers fixed. - -@subsection (Open)Solaris - -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 -since the libc is not c99-compliant by default. The probes performed by -configure may raise an exception leading to the death of configure itself -due to a bug in the system shell. Simply invoke a different shell such as -bash directly to work around this: - -@example -bash ./configure -@end example - -@subsection Darwin (MacOS X, iPhone) - -MacOS 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, FFmpeg's configure will pick it up automatically. - -@section Windows - -To get help and instructions for building FFmpeg under Windows, check out -the FFmpeg Windows Help Forum at -@url{http://ffmpeg.arrozcru.org/}. - -@subsection Native Windows compilation - -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. - -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: - -@itemize -@item bash 3.1 -@item msys-make 3.81-2 (note: not mingw32-make) -@item w32api 3.13 -@item mingw-runtime 3.15 -@end itemize - -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}). - -Within the MSYS shell, configure and make with: - -@example -./configure --enable-memalign-hack -make -make install -@end example - -This will install @file{ffmpeg.exe} along with many other development files -to @file{/usr/local}. You may specify another install path using the -@code{--prefix} option in @file{configure}. - -Notes: - -@itemize - -@item Building natively using MSYS can be sped up by disabling implicit rules -in the Makefile by calling @code{make -r} instead of plain @code{make}. This -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 FFplay, you must have the MinGW development library -of SDL. Get it from @url{http://www.libsdl.org}. -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 FFmpeg, -you can build libavutil, libavcodec and libavformat as DLLs. - -@end itemize - -@subsection Microsoft Visual C++ compatibility - -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 -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 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. - -@subsubsection Using static libraries - -Assuming you have just built and installed FFmpeg in @file{/usr/local}. - -@enumerate - -@item Create a new console application ("File / New / Project") and then -select "Win32 Console Application". On the appropriate page of the -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 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 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. - -@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 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 -"Linker / Input" from the tree view, and add the files @file{libavformat.a}, -@file{libavcodec.a}, @file{libavutil.a}, @file{libmingwex.a}, -@file{libgcc.a}, and any other libraries you used (i.e. @file{libz.a}) -to the end of "Additional Dependencies". - -@item Now, select "C/C++ / Code Generation" from the tree view. Select -"Debug" in the "Configuration" combo box. Make sure that "Runtime -Library" is set to "Multi-threaded Debug DLL". Then, select "Release" in -the "Configuration" combo box and make sure that "Runtime Library" is -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 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 -FFmpeg, so you must add this line before @code{#include}ing libav*: -@example -#define inline _inline -@end example - -@item Build your application, everything should work. - -@end enumerate - -@subsubsection Using shared libraries - -This is how to create DLL and LIB files that are compatible with MSVC++: - -@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 --enable-memalign-hack -make -make install -@end example - -Your install path (@file{/usr/local/} by default) should now have the -necessary DLL and LIB files under the @file{bin} directory. - -@end enumerate - -To use those files with MSVC++, do the same as you would do with -the static libraries, as described above. But in Step 4, -you should only need to add the directory where the LIB files are installed -(i.e. @file{c:\msys\usr\local\bin}). This is not a typo, the LIB files are -installed in the @file{bin} directory. And instead of adding the static -libraries (@file{libxxx.a} files) you should add the MSVC import libraries -(@file{avcodec.lib}, @file{avformat.lib}, @file{avcore.lib}, and -@file{avutil.lib}). Note that you should not use the GCC import -libraries (@file{libxxx.dll.a} files), as these will give you undefined -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. The @file{bin} directory contains a bunch -of DLL files, but the ones that are actually used to run your application -are the ones with a major version number in their filenames -(i.e. @file{avcodec-51.dll}). - -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 -libavutil/pixdesc.h you should have: -@example -extern __declspec(dllimport) const AVPixFmtDescriptor av_pix_fmt_descriptors[]; -@end example - -@subsection Cross compilation for Windows with Linux - -You must use the MinGW cross compilation tools available at -@url{http://www.mingw.org/}. - -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 FFmpeg with Wine -(@url{http://www.winehq.com/}). - -@subsection Compilation under Cygwin - -Please use Cygwin 1.7.x as the obsolete 1.5.x Cygwin versions lack -llrint() in its C library. - -Install your Cygwin with all the "Base" packages, plus the -following "Devel" ones: -@example -binutils, gcc4-core, make, subversion, mingw-runtime, texi2html -@end example - -And the following "Utils" one: -@example -diffutils -@end example - -Then run - -@example -./configure --enable-static --disable-shared -@end example - -to make a static build. - -The current @code{gcc4-core} package is buggy and needs this flag to build -shared libraries: - -@example -./configure --enable-shared --disable-static --extra-cflags=-fno-reorder-functions -@end example - -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 -@end example - -These library packages are only available from Cygwin Ports -(@url{http://sourceware.org/cygwinports/}) : - -@example -yasm, libSDL-devel, libdirac-devel, libfaac-devel, libgsm-devel, -libmp3lame-devel, libschroedinger1.0-devel, speex-devel, libtheora-devel, -libxvidcore-devel -@end example - -The recommendation for libnut and x264 is to build them from source by -yourself, as they evolve too quickly for Cygwin Ports to be up to date. - -Cygwin 1.7.x has IPv6 support. You can add IPv6 to Cygwin 1.5.x by means -of the @code{libgetaddrinfo-devel} package, available at Cygwin Ports. - -@subsection Crosscompilation for Windows under Cygwin - -With Cygwin you can create Windows binaries that do not need the cygwin1.dll. - -Just install your Cygwin as explained before, plus these additional -"Devel" packages: -@example -gcc-mingw-core, mingw-runtime, mingw-zlib -@end example - -and add some special flags to your configure invocation. - -For a static build run -@example -./configure --target-os=mingw32 --enable-memalign-hack --enable-static --disable-shared --extra-cflags=-mno-cygwin --extra-libs=-mno-cygwin -@end example - -and for a build with shared libraries -@example -./configure --target-os=mingw32 --enable-memalign-hack --enable-shared --disable-static --extra-cflags=-mno-cygwin --extra-libs=-mno-cygwin -@end example +@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 @tab X +@end multitable @bye diff --git a/lib/ffmpeg/doc/git-howto.texi b/lib/ffmpeg/doc/git-howto.texi new file mode 100644 index 0000000000..f15c1cefba --- /dev/null +++ b/lib/ffmpeg/doc/git-howto.texi @@ -0,0 +1,344 @@ +\input texinfo @c -*- texinfo -*- + +@settitle Using git to develop FFmpeg + +@titlepage +@center @titlefont{Using git to develop FFmpeg} +@end titlepage + +@top + +@contents + +@chapter Introduction + +This document aims in giving some quick references on a set of useful git +commands. You should always use the extensive and detailed documentation +provided directly by git: + +@example +git --help +man git +@end example + +shows you the available subcommands, + +@example +git <command> --help +man git-<command> +@end example + +shows information about the subcommand <command>. + +Additional information could be found on the +@url{http://gitref.org, Git Reference} website + +For more information about the Git project, visit the + +@url{http://git-scm.com/, Git website} + +Consult these resources whenever you have problems, they are quite exhaustive. + +What follows now is a basic introduction to Git and some FFmpeg-specific +guidelines to ease the contribution to the project + +@chapter Basics Usage + +@section Get GIT + +You can get git from @url{http://git-scm.com/} +Most distribution and operating system provide a package for it. + + +@section Cloning the source tree + +@example +git clone git://source.ffmpeg.org/ffmpeg <target> +@end example + +This will put the FFmpeg sources into the directory @var{<target>}. + +@example +git clone git@@source.ffmpeg.org:ffmpeg <target> +@end example + +This will put the FFmpeg sources into the directory @var{<target>} and let +you push back your changes to the remote repository. + + +@section Updating the source tree to the latest revision + +@example +git pull (--rebase) +@end example + +pulls in the latest changes from the tracked branch. The tracked branch +can be remote. By default the master branch tracks the branch master in +the remote origin. + +@float IMPORTANT +@command{--rebase} (see below) is recommended. +@end float + +@section Rebasing your local branches + +@example +git pull --rebase +@end example + +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 +FFmpeg's master tree. The master tree will reject pushes with merge commits. + + +@section Adding/removing files/directories + +@example +git add [-A] <filename/dirname> +git rm [-r] <filename/dirname> +@end example + +GIT needs to get notified of all changes you make to your working +directory that makes files appear or disappear. +Line moves across files are automatically tracked. + + +@section Showing modifications + +@example +git diff <filename(s)> +@end example + +will show all local modifications in your working directory as unified diff. + + +@section Inspecting the changelog + +@example +git log <filename(s)> +@end example + +You may also use the graphical tools like gitview or gitk or the web +interface available at http://source.ffmpeg.org/ + +@section Checking source tree status + +@example +git status +@end example + +detects all the changes you made and lists what actions will be taken in case +of a commit (additions, modifications, deletions, etc.). + + +@section Committing + +@example +git diff --check +@end example + +to double check your changes before committing them to avoid trouble later +on. All experienced developers do this on each and every commit, no matter +how small. +Every one of them has been saved from looking like a fool by this many times. +It's very easy for stray debug output or cosmetic modifications to slip in, +please avoid problems through this extra level of scrutiny. + +For cosmetics-only commits you should get (almost) empty output from + +@example +git diff -w -b <filename(s)> +@end example + +Also check the output of + +@example +git status +@end example + +to make sure you don't have untracked files or deletions. + +@example +git add [-i|-p|-A] <filenames/dirnames> +@end example + +Make sure you have told git your name and email address + +@example +git config --global user.name "My Name" +git config --global user.email my@@email.invalid +@end example + +Use @var{--global} to set the global configuration for all your git checkouts. + +Git will select the changes to the files for commit. Optionally you can use +the interactive or the patch mode to select hunk by hunk what should be +added to the commit. + + +@example +git commit +@end example + +Git will commit the selected changes to your current local branch. + +You will be prompted for a log message in an editor, which is either +set in your personal configuration file through + +@example +git config --global core.editor +@end example + +or set by one of the following environment variables: +@var{GIT_EDITOR}, @var{VISUAL} or @var{EDITOR}. + +Log messages should be concise but descriptive. Explain why you made a change, +what you did will be obvious from the changes themselves most of the time. +Saying just "bug fix" or "10l" is bad. Remember that people of varying skill +levels look at and educate themselves while reading through your code. Don't +include filenames in log messages, Git provides that information. + +Possibly make the commit message have a terse, descriptive first line, an +empty line and then a full description. The first line will be used to name +the patch by git format-patch. + +@section Preparing a patchset + +@example +git format-patch <commit> [-o directory] +@end example + +will generate a set of patches for each commit between @var{<commit>} and +current @var{HEAD}. E.g. + +@example +git format-patch origin/master +@end example + +will generate patches for all commits on current branch which are not +present in upstream. +A useful shortcut is also + +@example +git format-patch -n +@end example + +which will generate patches from last @var{n} commits. +By default the patches are created in the current directory. + +@section Sending patches for review + +@example +git send-email <commit list|directory> +@end example + +will send the patches created by @command{git format-patch} or directly +generates them. All the email fields can be configured in the global/local +configuration or overridden by command line. +Note that this tool must often be installed separately (e.g. @var{git-email} +package on Debian-based distros). + + +@section Renaming/moving/copying files or contents of files + +Git automatically tracks such changes, making those normal commits. + +@example +mv/cp path/file otherpath/otherfile +git add [-A] . +git commit +@end example + + +@chapter FFmpeg specific + +@section Reverting broken commits + +@example +git reset <commit> +@end example + +@command{git reset} will uncommit the changes till @var{<commit>} rewriting +the current branch history. + +@example +git commit --amend +@end example + +allows to amend the last commit details quickly. + +@example +git rebase -i origin/master +@end example + +will replay local commits over the main repository allowing to edit, merge +or remove some of them in the process. + +@float NOTE +@command{git reset}, @command{git commit --amend} and @command{git rebase} +rewrite history, so you should use them ONLY on your local or topic branches. +The main repository will reject those changes. +@end float + +@example +git revert <commit> +@end example + +@command{git revert} will generate a revert commit. This will not make the +faulty commit disappear from the history. + +@section Pushing changes to remote trees + +@example +git push +@end example + +Will push the changes to the default remote (@var{origin}). +Git will prevent you from pushing changes if the local and remote trees are +out of sync. Refer to and to sync the local tree. + +@example +git remote add <name> <url> +@end example + +Will add additional remote with a name reference, it is useful if you want +to push your local branch for review on a remote host. + +@example +git push <remote> <refspec> +@end example + +Will push the changes to the @var{<remote>} repository. +Omitting @var{<refspec>} makes @command{git push} update all the remote +branches matching the local ones. + +@section Finding a specific svn revision + +Since version 1.7.1 git supports @var{:/foo} syntax for specifying commits +based on a regular expression. see man gitrevisions + +@example +git show :/'as revision 23456' +@end example + +will show the svn changeset @var{r23456}. With older git versions searching in +the @command{git log} output is the easiest option (especially if a pager with +search capabilities is used). +This commit can be checked out with + +@example +git checkout -b svn_23456 :/'as revision 23456' +@end example + +or for git < 1.7.1 with + +@example +git checkout -b svn_23456 $SHA1 +@end example + +where @var{$SHA1} is the commit hash from the @command{git log} output. + +@chapter Server Issues + +Contact the project admins @email{root@@ffmpeg.org} if you have technical +problems with the GIT server. diff --git a/lib/ffmpeg/doc/git-howto.txt b/lib/ffmpeg/doc/git-howto.txt index 519c8970ef..5ba72eeeb9 100644 --- a/lib/ffmpeg/doc/git-howto.txt +++ b/lib/ffmpeg/doc/git-howto.txt @@ -39,16 +39,17 @@ 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.ffmpeg.org/ffmpeg.git <target> + git clone git://source.ffmpeg.org/ffmpeg <target> This will put the FFmpeg sources into the directory <target>. - git clone git@git.ffmpeg.org:ffmpeg.git <target> + git clone git@source.ffmpeg.org:ffmpeg <target> This will put the FFmpeg sources into the directory <target> and let you push back your changes to the remote repository. @@ -97,7 +98,7 @@ I. BASICS: git log <filename(s)> You may also use the graphical tools like gitview or gitk or the web - interface available at http://git.ffmpeg.org/ + interface available at http://source.ffmpeg.org 6. Checking source tree status: @@ -120,7 +121,7 @@ I. BASICS: For cosmetics-only commits you should get (almost) empty output from - git diff -wb <filename(s)> + git diff -w -b <filename(s)> Also check the output of @@ -205,8 +206,19 @@ I. BASICS: git format-patch <commit> [-o directory] - will generate a set of patches out of the current branch starting from - commit. By default the patches are created in the current directory. + will generate a set of patches for each commit between <commit> and + current HEAD. E.g. + + git format-patch origin/master + + will generate patches for all commits on current branch which are not + present in upstream. + A useful shortcut is also + + git format-patch -n + + which will generate patches from last n commits. + By default the patches are created in the current directory. 11. Sending patches for review @@ -215,6 +227,8 @@ I. BASICS: will send the patches created by git format-patch or directly generates them. All the email fields can be configured in the global/local configuration or overridden by command line. + Note that this tool must often be installed separately (e.g. git-email + package on Debian-based distros). 12. Pushing changes to remote trees @@ -255,5 +269,5 @@ I. BASICS: where $SHA1 is the commit SHA1 from the 'git log' output. -Contact the project admins <git at ffmpeg dot org> if you have technical +Contact the project admins <root at ffmpeg dot org> if you have technical problems with the GIT server. diff --git a/lib/ffmpeg/doc/indevs.texi b/lib/ffmpeg/doc/indevs.texi index 8e862ff6bc..3b2c86290c 100644 --- a/lib/ffmpeg/doc/indevs.texi +++ b/lib/ffmpeg/doc/indevs.texi @@ -42,7 +42,7 @@ 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 @file{ffmpeg} 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 ffmpeg -f alsa -i hw:0 alsaout.wav @@ -55,10 +55,130 @@ For more information see: BSD video input device. +@section dshow + +Windows DirectShow input device. + +DirectShow support is enabled when FFmpeg is built with mingw-w64. +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. +@section fbdev + +Linux framebuffer input device. + +The Linux framebuffer is a graphic hardware-independent abstraction +layer to show graphics on a computer monitor, typically on the +console. It is accessed through a file device node, usually +@file{/dev/fb0}. + +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{ffmpeg}: +@example +ffmpeg -f fbdev -r 10 -i /dev/fb0 out.avi +@end example + +You can take a single screenshot image with the command: +@example +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). + @section jack JACK input device. @@ -76,15 +196,15 @@ 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 @file{ffmpeg}. +with @command{ffmpeg}. @example # Create a JACK writable client with name "ffmpeg". $ ffmpeg -f jack -i ffmpeg -y out.wav @@ -108,10 +228,165 @@ $ jack_connect metro:120_bpm ffmpeg:input_1 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. @@ -120,7 +395,7 @@ 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 @file{ffmpeg} use the +For example to grab from @file{/dev/dsp} using @command{ffmpeg} use the command: @example ffmpeg -f oss -i /dev/dsp /tmp/oss.wav @@ -129,6 +404,106 @@ ffmpeg -f oss -i /dev/dsp /tmp/oss.wav For more information about OSS see: @url{http://manuals.opensound.com/usersguide/dsp.html} +@section pulse + +pulseaudio input device. + +To enable this input device during configuration you need libpulse-simple +installed in your system. + +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 @command{pactl list sources}. + +@example +ffmpeg -f pulse -i default /tmp/pulse.wav +@end example + +@subsection @var{server} AVOption + +The syntax is: +@example +-server @var{server name} +@end example + +Connects to a specific server. + +@subsection @var{name} AVOption + +The syntax is: +@example +-name @var{application name} +@end example + +Specify the application name pulse will use when showing active clients, +by default it is the LIBAVFORMAT_IDENT string + +@subsection @var{stream_name} AVOption + +The syntax is: +@example +-stream_name @var{stream name} +@end example + +Specify the stream name pulse will use when showing active streams, +by default it is "record" + +@subsection @var{sample_rate} AVOption + +The syntax is: +@example +-sample_rate @var{samplerate} +@end example + +Specify the samplerate in Hz, by default 48kHz is used. + +@subsection @var{channels} AVOption + +The syntax is: +@example +-channels @var{N} +@end example + +Specify the channels in use, by default 2 (stereo) is set. + +@subsection @var{frame_size} AVOption + +The syntax is: +@example +-frame_size @var{bytes} +@end example + +Specify the number of byte per frame, by default it is set to 1024. + +@subsection @var{fragment_size} AVOption + +The syntax is: +@example +-fragment_size @var{bytes} +@end example + +Specify the minimal buffering fragment in pulseaudio, it will affect the +audio latency. By default it is unset. + +@section sndio + +sndio input device. + +To enable this input device during configuration you need libsndio +installed on your system. + +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{ffmpeg} use the +command: +@example +ffmpeg -f sndio -i /dev/audio0 /tmp/oss.wav +@end example + @section video4linux and video4linux2 Video4Linux and Video4Linux2 input video devices. @@ -141,17 +516,20 @@ the device. Video4Linux and Video4Linux2 devices only support a limited set of @var{width}x@var{height} sizes and framerates. You can check which are -supported for example with the command @file{dov4l} for Video4Linux -devices and the command @file{v4l-info} for Video4Linux2 devices. +supported for example with the command @command{dov4l} for Video4Linux +devices and using @command{-list_formats all} for Video4Linux2 devices. If the size for the device is set to 0x0, the input device will -try to autodetect the size to use. +try to auto-detect the size to use. Only for the video4linux2 device, if the frame rate is set to 0/0 the input device will use the frame rate value already set in the driver. Video4Linux support is deprecated since Linux 2.6.30, and will be dropped in later versions. +Note that if FFmpeg is build with v4l-utils support ("--enable-libv4l2" +option), it will always be used. + Follow some usage examples of the video4linux devices with the ff* tools. @example @@ -159,15 +537,18 @@ tools. # to the default of 25/1. ffplay -s 320x240 -f video4linux /dev/video0 -# Grab and show the input of a video4linux2 device, autoadjust size. +# Grab and show the input of a video4linux2 device, auto-adjust size. ffplay -f video4linux2 /dev/video0 -# Grab and record the input of a video4linux2 device, autoadjust size, +# Grab and record the input of a video4linux2 device, auto-adjust size, # frame rate value defaults to 0/0 so it is read from the video4linux2 # driver. ffmpeg -f video4linux2 -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. @@ -189,7 +570,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 @@ -198,15 +579,54 @@ 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 @file{ffmpeg}: +For example to grab from @file{:0.0} using @command{ffmpeg}: @example ffmpeg -f x11grab -r 25 -s cif -i :0.0 out.mpg # Grab at position 10,20. -ffmpeg -f x11grab -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 + +The syntax is: +@example +-follow_mouse centered|@var{PIXELS} +@end example + +When it is specified with "centered", the grabbing region follows the mouse +pointer and keeps the pointer at the center of region; otherwise, the region +follows only when the mouse pointer reaches within @var{PIXELS} (greater than +zero) to the edge of region. + +For example: +@example +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 +ffmpeg -f x11grab -follow_mouse 100 -r 25 -s cif -i :0.0 out.mpg +@end example + +@subsection @var{show_region} AVOption + +The syntax is: +@example +-show_region 1 +@end example + +If @var{show_region} AVOption is specified with @var{1}, then the grabbing +region will be indicated on screen. With this option, it's easy to know what is +being grabbed if only a portion of the screen is grabbed. + +For example: +@example +ffmpeg -f x11grab -show_region 1 -r 25 -s cif -i :0.0+10,20 out.mpg + +# With follow_mouse +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/lib/ffmpeg/doc/issue_tracker.txt b/lib/ffmpeg/doc/issue_tracker.txt index e5a74db001..d487f66830 100644 --- a/lib/ffmpeg/doc/issue_tracker.txt +++ b/lib/ffmpeg/doc/issue_tracker.txt @@ -5,49 +5,42 @@ NOTE: This is a draft. Overview: --------- -FFmpeg uses Roundup for tracking issues, new issues and changes to -existing issues can be done through a web interface and through email. + +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 -nosy list or to subscribe to the ffmpeg-issues mailing list which receives -a mail for every change to every issue. Replies to such mails will also -be properly added to the respective issue. +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-issues list is: -http://live.polito/mailman/listinfo/ffmpeg-issues + +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)://roundup.ffmpeg/roundup/ffmpeg/ -Note the URLs in this document are obfuscated, you must append the top level -domain for non-profit organizations to the tracker, and of Italy to the -mailing list. - -Email Interface: ----------------- -There is a mailing list to which all new issues and changes to existing issues -are sent. You can subscribe through -http://live.polito/mailman/listinfo/ffmpeg-issues -Replies to messages there will have their text added to the specific issues. -Attachments will be added as if they had been uploaded via the web interface. -You can change the status, substatus, topic, ... by changing the subject in -your reply like: -Re: [issue94] register_avcodec and allcodecs.h [type=patch;status=open;substatus=approved] -Roundup will then change things as you requested and remove the [...] from -the subject before forwarding the mail to the mailing list. - - -NOTE: issue = (bug report || patch || feature request) +http(s)://ffmpeg.org/trac/ffmpeg Type: ----- -bug +bug / defect An error, flaw, mistake, failure, or fault in FFmpeg or libav* that prevents it from behaving as intended. -feature request +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. @@ -68,6 +61,8 @@ 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 @@ -97,6 +92,17 @@ 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 @@ -124,24 +130,6 @@ Type/Status/Substatus: Issues for which some information has been requested by the developers, but which has not been provided by anyone within reasonable time. -bug/open/reproduced - Bugs which have been reproduced. - -bug/open/analyzed - 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. - -bug/open/needs_more_info - Bug reports which are incomplete and or where more information is needed - from the submitter or another person who can provide it. - This state implicates that the bug has not been analyzed or reproduced. - Note, the idea behind needs_more_info is to offload work from the - developers to the users whenever possible. bug/closed/fixed Bugs which have to the best of our knowledge been fixed. @@ -175,10 +163,6 @@ patch/closed/applied patch/closed/rejected Patches which have been rejected. -feature_request/open/needs_more_info - Feature requests where it is not clear what exactly is wanted - (these also could be closed as invalid ...). - feature_request/closed/implemented Feature requests which have been implemented. @@ -190,12 +174,10 @@ 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 substate. +needs_more_info substatus. -Topic: ------- -A topic is a tag you should add to your issue in order to make grouping them -easier. +Component: +---------- avcodec issues in libavcodec/* @@ -215,6 +197,9 @@ ffmpeg ffplay issues in or related to ffplay.c +ffprobe + issues in or related to ffprobe.c + ffserver issues in or related to ffserver.c @@ -222,7 +207,7 @@ build system issues in or related to configure/Makefile regression - bugs which were working in a past revision + bugs which were not present in a past revision -roundup +trac issues related to our issue tracker diff --git a/lib/ffmpeg/doc/libavfilter.texi b/lib/ffmpeg/doc/libavfilter.texi index f0b448259a..06d9f13324 100644 --- a/lib/ffmpeg/doc/libavfilter.texi +++ b/lib/ffmpeg/doc/libavfilter.texi @@ -14,20 +14,8 @@ 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. -Integrating libavfilter into the main FFmpeg repository is a work in -progress. If you wish to try the unfinished development code of -libavfilter then check it out from the libavfilter repository into -some directory of your choice by: - -@example - svn checkout svn://svn.ffmpeg.org/soc/libavfilter -@end example - -And then read the README file in the top directory to learn how to -integrate it into ffmpeg and ffplay. - -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 @@ -48,21 +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 -./ffmpeg -i in.avi -s 240x320 -vf "[in] split [T1], fifo, [T2] overlay= 0:240 [out]; [T1] fifo, crop=0:0:-1:240, vflip [T2] +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 -where input_video.avi has a vertical resolution of 480 pixels. The -result will be that in output the top half of the video is mirrored +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 -ffmpeg or to 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. +@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 diff --git a/lib/ffmpeg/doc/multithreading.txt b/lib/ffmpeg/doc/multithreading.txt new file mode 100644 index 0000000000..a1068425cd --- /dev/null +++ b/lib/ffmpeg/doc/multithreading.txt @@ -0,0 +1,65 @@ +FFmpeg multithreading methods +============================================== + +FFmpeg provides two methods for multithreading codecs. + +Slice threading decodes multiple parts of a frame at the same time, using +AVCodecContext execute() and execute2(). + +Frame threading decodes multiple frames at the same time. +It accepts N future frames and delays decoded pictures by N-1 frames. +The later frames are decoded in separate threads while the user is +displaying the current one. + +Restrictions on clients +============================================== + +Slice threading - +* The client's draw_horiz_band() must be thread-safe according to the comment + in avcodec.h. + +Frame threading - +* Restrictions with slice threading also apply. +* For best performance, the client should set thread_safe_callbacks if it + provides a thread-safe get_buffer() callback. +* There is one frame of delay added for every thread beyond the first one. + Clients must be able to handle this; the pkt_dts and pkt_pts fields in + AVFrame will work as usual. + +Restrictions on codec implementations +============================================== + +Slice threading - + None except that there must be something worth executing in parallel. + +Frame threading - +* Codecs can only accept entire pictures per packet. +* Codecs similar to ffv1, whose streams don't reset across frames, + will not work because their bitstreams cannot be decoded in parallel. + +* The contents of buffers must not be read before ff_thread_await_progress() + has been called on them. reget_buffer() and buffer age optimizations no longer work. +* The contents of buffers must not be written to after ff_thread_report_progress() + has been called on them. This includes draw_edges(). + +Porting codecs to frame threading +============================================== + +Find all context variables that are needed by the next frame. Move all +code changing them, as well as code calling get_buffer(), up to before +the decode process starts. Call ff_thread_finish_setup() afterwards. If +some code can't be moved, have update_thread_context() run it in the next +thread. + +If the codec allocates writable tables in its init(), add an init_thread_copy() +which re-allocates them for other threads. + +Add CODEC_CAP_FRAME_THREADS to the codec capabilities. There will be very little +speed gain at this point but it should work. + +Call ff_thread_report_progress() after some part of the current picture has decoded. +A good place to put this is where draw_horiz_band() is called - add this if it isn't +called anywhere, as it's useful too and the implementation is trivial when you're +doing this. Note that draw_edges() needs to be called before reporting progress. + +Before accessing a reference frame or its MVs, call ff_thread_await_progress(). diff --git a/lib/ffmpeg/doc/muxers.texi b/lib/ffmpeg/doc/muxers.texi index d98abefda3..d2aa75e818 100644 --- a/lib/ffmpeg/doc/muxers.texi +++ b/lib/ffmpeg/doc/muxers.texi @@ -18,16 +18,90 @@ enabled muxers. A description of some of the currently available muxers follows. +@anchor{crc} +@section crc + +CRC (Cyclic Redundancy Check) testing format. + +This muxer computes and prints the Adler-32 CRC 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 +CRC. + +The output of the muxer consists of a single line of the form: +CRC=0x@var{CRC}, where @var{CRC} is a hexadecimal number 0-padded to +8 digits containing the CRC for all the decoded input frames. + +For example to compute the CRC of the input, and store it in the file +@file{out.crc}: +@example +ffmpeg -i INPUT -f crc out.crc +@end example + +You can print the CRC to stdout with the command: +@example +ffmpeg -i INPUT -f crc - +@end example + +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 +ffmpeg -i INPUT -c:a pcm_u8 -c:v mpeg2video -f crc - +@end example + +See also the @ref{framecrc} muxer. + +@anchor{framecrc} +@section framecrc + +Per-frame 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 +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. + +For example to compute the CRC of each decoded frame in the input, and +store it in the file @file{out.crc}: +@example +ffmpeg -i INPUT -f framecrc out.crc +@end example + +You can print the CRC of each decoded frame to stdout with the command: +@example +ffmpeg -i INPUT -f framecrc - +@end example + +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 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 +ffmpeg -i INPUT -c:a pcm_u8 -c:v mpeg2video -f framecrc - +@end example + +See also the @ref{crc} muxer. + +@anchor{image2} @section image2 Image file muxer. -This muxer writes video frames to multiple image files specified by a -pattern. +The image file muxer writes video frames to image files. -The pattern may contain the string "%d" or "%0@var{N}d", which +The output filenames are specified by a pattern, which can be used to +produce sequentially numbered series of files. +The pattern may contain the string "%d" or "%0@var{N}d", this string specifies the position of the characters representing a numbering in -the filenames. If the form "%d0@var{N}d" is used, the string +the filenames. If the form "%0@var{N}d" is used, the string representing the number in each filename is 0-padded to @var{N} digits. The literal character '%' can be specified in the pattern with the string "%%". @@ -46,28 +120,46 @@ 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 @file{ffmpeg} 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 -ffmpeg -i in.avi -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 @file{ffmpeg}, 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 -ffmpeg -i in.avi -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 -ffmpeg -i in.avi -f image2 -vframes 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. + +@section mov + +MOV / MP4 muxer + +The muxer options are: + +@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. +@end table + @section mpegts MPEG transport stream muxer. @@ -98,7 +190,7 @@ and @code{service_name}. If they are not set the default for @code{service_name} is "Service01". @example -ffmpeg -i file.mpg -acodec copy -vcodec copy \ +ffmpeg -i file.mpg -c copy \ -mpegts_original_network_id 0x1122 \ -mpegts_transport_stream_id 0x3344 \ -mpegts_service_id 0x5566 \ @@ -109,4 +201,120 @@ ffmpeg -i file.mpg -acodec copy -vcodec copy \ -y out.ts @end example +@section null + +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{ffmpeg} you can use the +command: +@example +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{ffmpeg} +syntax. + +Alternatively you can write the command as: +@example +ffmpeg -benchmark -i INPUT -f null - +@end example + +@section matroska + +Matroska container muxer. + +This muxer implements the matroska and webm container specs. + +The recognized metadata settings in this muxer are: + +@table @option + +@item title=@var{title name} +Name provided to a single track +@end table + +@table @option + +@item language=@var{language name} +Specifies the language of the track in the Matroska languages form +@end table + +@table @option + +@item stereo_mode=@var{mode} +Stereo 3D video layout of two views in a single video track +@table @option +@item mono +video is not stereo +@item left_right +Both views are arranged side by side, Left-eye view is on the left +@item bottom_top +Both views are arranged in top-bottom orientation, Left-eye view is at bottom +@item top_bottom +Both views are arranged in top-bottom orientation, Left-eye view is on top +@item checkerboard_rl +Each view is arranged in a checkerboard interleaved pattern, Left-eye view being first +@item checkerboard_lr +Each view is arranged in a checkerboard interleaved pattern, Right-eye view being first +@item row_interleaved_rl +Each view is constituted by a row based interleaving, Right-eye view is first row +@item row_interleaved_lr +Each view is constituted by a row based interleaving, Left-eye view is first row +@item col_interleaved_rl +Both views are arranged in a column based interleaving manner, Right-eye view is first column +@item col_interleaved_lr +Both views are arranged in a column based interleaving manner, Left-eye view is first column +@item anaglyph_cyan_red +All frames are in anaglyph format viewable through red-cyan filters +@item right_left +Both views are arranged side by side, Right-eye view is on the left +@item anaglyph_green_magenta +All frames are in anaglyph format viewable through green-magenta filters +@item block_lr +Both eyes laced in one Block, Left-eye view is first +@item block_rl +Both eyes laced in one Block, Right-eye view is first +@end table +@end table + +For example a 3D WebM clip can be created using the following command line: +@example +ffmpeg -i sample_left_right_clip.mpg -an -c:v libvpx -metadata stereo_mode=left_right -y stereo_clip.webm +@end example + +@section segment + +Basic stream segmenter. + +The segmenter muxer outputs streams to a number of separate files of nearly +fixed duration. Output filename pattern can be set in a fashion similar to +@ref{image2}. + +Every segment starts with a video keyframe, if a video stream is present. +The segment muxer works best with a single constant frame rate video. + +Optionally it can generate a flat list of the created segments, one segment +per line. + +@table @option +@item segment_format @var{format} +Override the inner container format, by default it is guessed by the filename +extension. +@item segment_time @var{t} +Set segment duration to @var{t} seconds. +@item segment_list @var{name} +Generate also a listfile named @var{name}. +@item segment_list_size @var{size} +Overwrite the listfile once it reaches @var{size} entries. +@end table + +@example +ffmpeg -i in.mkv -c copy -map 0 -f segment -list out.list out%03d.nut +@end example + + @c man end MUXERS diff --git a/lib/ffmpeg/doc/optimization.txt b/lib/ffmpeg/doc/optimization.txt index 5d51235983..b027efef2f 100644 --- a/lib/ffmpeg/doc/optimization.txt +++ b/lib/ffmpeg/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 (for a web frontend try ViewVC at -http://svn.ffmpeg.org/ffmpeg/trunk/). +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!!! -(http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel) +(http://lists.ffmpeg.org/mailman/listinfo/ffmpeg-devel) When is an optimization justified? diff --git a/lib/ffmpeg/doc/outdevs.texi b/lib/ffmpeg/doc/outdevs.texi index 3c0acee984..8de4fe6ec4 100644 --- a/lib/ffmpeg/doc/outdevs.texi +++ b/lib/ffmpeg/doc/outdevs.texi @@ -26,4 +26,48 @@ 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. + @c man end OUTPUT DEVICES diff --git a/lib/ffmpeg/doc/platform.texi b/lib/ffmpeg/doc/platform.texi new file mode 100644 index 0000000000..b52e13a94d --- /dev/null +++ b/lib/ffmpeg/doc/platform.texi @@ -0,0 +1,390 @@ +\input texinfo @c -*- texinfo -*- + +@settitle Platform Specific information +@titlepage +@center @titlefont{Platform Specific information} +@end titlepage + +@top + +@contents + +@chapter Unix-like + +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: + +@example +$(gcc -print-prog-name=as) --version +@end example + +If not, then you should install a different compiler that has no +hard-coded path to gas. In the worst case pass @code{--disable-asm} +to configure. + +@section BSD + +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 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 +since the libc is not c99-compliant by default. The probes performed by +configure may raise an exception leading to the death of configure itself +due to a bug in the system shell. Simply invoke a different shell such as +bash directly to work around this: + +@example +bash ./configure +@end example + +@anchor{Darwin} +@section Darwin (Mac OS X, iPhone) + +The toolchain provided with Xcode is sufficient to build the basic +unacelerated code. + +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, FFmpeg's configure will pick it up automatically. + +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 + +Using a cross-compiler is preferred for various reasons. +@url{http://www.delorie.com/howto/djgpp/linux-x-djgpp.html} + + +@chapter OS/2 + +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 + +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. + +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: + +@itemize +@item bash 3.1 +@item msys-make 3.81-2 (note: not mingw32-make) +@item w32api 3.13 +@item mingw-runtime 3.15 +@end itemize + +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: + +@itemize + +@item Building natively using MSYS can be sped up by disabling implicit rules +in the Makefile by calling @code{make -r} instead of plain @code{make}. This +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 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 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, 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 +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 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 FFmpeg in @file{/usr/local}. + +@enumerate + +@item Create a new console application ("File / New / Project") and then +select "Win32 Console Application". On the appropriate page of the +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 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 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. + +@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 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 +"Linker / Input" from the tree view, and add the files @file{libavformat.a}, +@file{libavcodec.a}, @file{libavutil.a}, @file{libmingwex.a}, +@file{libgcc.a}, and any other libraries you used (i.e. @file{libz.a}) +to the end of "Additional Dependencies". + +@item Now, select "C/C++ / Code Generation" from the tree view. Select +"Debug" in the "Configuration" combo box. Make sure that "Runtime +Library" is set to "Multi-threaded Debug DLL". Then, select "Release" in +the "Configuration" combo box and make sure that "Runtime Library" is +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 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 +FFmpeg, so you must add this line before @code{#include}ing libav*: +@example +#define inline _inline +@end example + +@item Build your application, everything should work. + +@end enumerate + +@subsection Using shared libraries + +This is how to create DLL and LIB files that are compatible with MSVC++: + +@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 +make +make install +@end example + +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}. + +To use those files with MSVC++, do the same as you would do with +the static libraries, as described above. But in Step 4, +you should only need to add the directory where the LIB files are installed +(i.e. @file{c:\msys\usr\local\bin}). This is not a typo, the LIB files are +installed in the @file{bin} directory. And instead of adding the static +libraries (@file{libxxx.a} files) you should add the MSVC import libraries +(@file{avcodec.lib}, @file{avformat.lib}, and +@file{avutil.lib}). Note that you should not use the GCC import +libraries (@file{libxxx.dll.a} files), as these will give you undefined +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. + +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 +libavutil/pixdesc.h you should have: +@example +extern __declspec(dllimport) const AVPixFmtDescriptor av_pix_fmt_descriptors[]; +@end example + +Note that using import libraries created by dlltool requires +the linker optimization option to be set to +"References: Keep Unreferenced Data (@code{/OPT:NOREF})", otherwise +the resulting binaries will fail during runtime. This isn't +required when using import libraries generated by lib.exe. +This issue is reported upstream at +@url{http://sourceware.org/bugzilla/show_bug.cgi?id=12633}. + +To create import libraries that work with the @code{/OPT:REF} option +(which is enabled by default in Release mode), follow these steps: + +@enumerate + +@item Open @file{Visual Studio 2005 Command Prompt}. + +Alternatively, in a normal command line prompt, call @file{vcvars32.bat} +which sets up the environment variables for the Visual C++ tools +(the standard location for this file is +@file{C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat}). + +@item Enter the @file{bin} directory where the created LIB and DLL files +are stored. + +@item Generate new import libraries with @file{lib.exe}: + +@example +lib /machine:i386 /def:..\lib\avcodec-53.def /out:avcodec.lib +lib /machine:i386 /def:..\lib\avdevice-53.def /out:avdevice.lib +lib /machine:i386 /def:..\lib\avfilter-2.def /out:avfilter.lib +lib /machine:i386 /def:..\lib\avformat-53.def /out:avformat.lib +lib /machine:i386 /def:..\lib\avutil-51.def /out:avutil.lib +lib /machine:i386 /def:..\lib\swscale-2.def /out:swscale.lib +@end example + +@end enumerate + +@anchor{Cross compilation for Windows with Linux} +@section Cross compilation for Windows with Linux + +You must use the MinGW cross compilation tools available at +@url{http://www.mingw.org/}. + +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 FFmpeg with @uref{http://www.winehq.com/, Wine}. + +@section Compilation under Cygwin + +Please use Cygwin 1.7.x as the obsolete 1.5.x Cygwin versions lack +llrint() in its C library. + +Install your Cygwin with all the "Base" packages, plus the +following "Devel" ones: +@example +binutils, gcc4-core, make, git, mingw-runtime, texi2html +@end example + +And the following "Utils" one: +@example +diffutils +@end example + +Then run + +@example +./configure +@end example + +to make a static build. + +The current @code{gcc4-core} package is buggy and needs this flag to build +shared libraries: + +@example +./configure --enable-shared --disable-static --extra-cflags=-fno-reorder-functions +@end example + +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 +@end example + +These library packages are only available from +@uref{http://sourceware.org/cygwinports/, Cygwin Ports}: + +@example +yasm, libSDL-devel, libdirac-devel, libfaac-devel, libaacplus-devel, libgsm-devel, +libmp3lame-devel, libschroedinger1.0-devel, speex-devel, libtheora-devel, +libxvidcore-devel +@end example + +The recommendation for libnut and x264 is to build them from source by +yourself, as they evolve too quickly for Cygwin Ports to be up to date. + +Cygwin 1.7.x has IPv6 support. You can add IPv6 to Cygwin 1.5.x by means +of the @code{libgetaddrinfo-devel} package, available at Cygwin Ports. + +@section Crosscompilation for Windows under Cygwin + +With Cygwin you can create Windows binaries that do not need the cygwin1.dll. + +Just install your Cygwin as explained before, plus these additional +"Devel" packages: +@example +gcc-mingw-core, mingw-runtime, mingw-zlib +@end example + +and add some special flags to your configure invocation. + +For a static build run +@example +./configure --target-os=mingw32 --extra-cflags=-mno-cygwin --extra-libs=-mno-cygwin +@end example + +and for a build with shared libraries +@example +./configure --target-os=mingw32 --enable-shared --disable-static --extra-cflags=-mno-cygwin --extra-libs=-mno-cygwin +@end example + +@bye diff --git a/lib/ffmpeg/doc/protocols.texi b/lib/ffmpeg/doc/protocols.texi index 29f5c90d81..da0e39f56c 100644 --- a/lib/ffmpeg/doc/protocols.texi +++ b/lib/ffmpeg/doc/protocols.texi @@ -19,6 +19,22 @@ supported protocols. A description of the currently available protocols follows. +@section applehttp + +Read Apple HTTP Live Streaming compliant segmented stream as +a uniform one. The M3U8 playlists describing the segments can be +remote HTTP resources or local files, accessed using the standard +file protocol. +HTTP is default, specific protocol can be declared by specifying +"+@var{proto}" after the applehttp URI scheme name, where @var{proto} +is either "file" or "http". + +@example +applehttp://host/path/to/remote/resource.m3u8 +applehttp+http://host/path/to/remote/resource.m3u8 +applehttp+file://path/to/local/resource.m3u8 +@end example + @section concat Physical concatenation protocol. @@ -36,7 +52,7 @@ 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{ffplay} use the +@file{split2.mpeg}, @file{split3.mpeg} with @command{ffplay} use the command: @example ffplay concat:split1.mpeg\|split2.mpeg\|split3.mpeg @@ -51,7 +67,7 @@ File access protocol. Allow to read from or read to a file. -For example to read from a file @file{input.mpeg} with @file{ffmpeg} +For example to read from a file @file{input.mpeg} with @command{ffmpeg} use the command: @example ffmpeg -i file:input.mpeg output.mpeg @@ -118,14 +134,14 @@ 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 @file{ffmpeg}: +For example to read from stdin with @command{ffmpeg}: @example cat test.wav | ffmpeg -i pipe:0 # ...this is the same as... cat test.wav | ffmpeg -i pipe: @end example -For writing to stdout with @file{ffmpeg}: +For writing to stdout with @command{ffmpeg}: @example ffmpeg -i test.wav -f avi pipe:1 | cat > test.avi # ...this is the same as... @@ -139,8 +155,8 @@ be seekable, so they will fail with the pipe output protocol. Real-Time Messaging Protocol. -The Real-Time Messaging Protocol (RTMP) is used for streaming multimeā -dia content across a TCP/IP network. +The Real-Time Messaging Protocol (RTMP) is used for streaming multimedia +content across a TCP/IP network. The required syntax is: @example @@ -167,7 +183,7 @@ application specified in @var{app}, may be prefixed by "mp4:". @end table -For example to read with @file{ffplay} 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 ffplay rtmp://myserver/vod/sample @@ -179,7 +195,7 @@ Real-Time Messaging Protocol and its variants supported through librtmp. Requires the presence of the librtmp headers and library during -configuration. You need to explicitely configure the build with +configuration. You need to explicitly configure the build with "--enable-librtmp". If enabled this will replace the native RTMP protocol. @@ -203,12 +219,12 @@ 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 -@file{ffmpeg}: +@command{ffmpeg}: @example ffmpeg -re -i myfile -f flv rtmp://myserver/live/mystream @end example -To play the same stream using @file{ffplay}: +To play the same stream using @command{ffplay}: @example ffplay "rtmp://myserver/live/mystream live=1" @end example @@ -226,16 +242,19 @@ data transferred over RDT). The muxer can be used to send a stream using RTSP ANNOUNCE to a server supporting it (currently Darwin Streaming Server and Mischa Spiegelmock's -RTSP server, @url{http://github.com/revmischa/rtsp-server}). +@uref{http://github.com/revmischa/rtsp-server, RTSP server}). The required syntax for a RTSP url is: @example -rtsp://@var{hostname}[:@var{port}]/@var{path}[?@var{options}] +rtsp://@var{hostname}[:@var{port}]/@var{path} @end example -@var{options} is a @code{&}-separated list. The following options +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: +Flags for @code{rtsp_transport}: + @table @option @item udp @@ -245,27 +264,31 @@ Use UDP as lower transport protocol. Use TCP (interleaving within the RTSP control channel) as lower transport protocol. -@item multicast +@item udp_multicast Use UDP multicast as lower transport protocol. @item http Use HTTP tunneling as lower transport protocol, which is useful for passing proxies. - -@item filter_src -Accept packets only from negotiated peer address and port. @end table Multiple lower transport protocols may be specified, in that case they are tried one at a time (if the setup of one fails, the next one is tried). For the muxer, only the @code{tcp} and @code{udp} options are supported. +Flags for @code{rtsp_flags}: + +@table @option +@item filter_src +Accept packets only from negotiated peer address and port. +@end table + When receiving data over UDP, the demuxer tries to reorder received packets (since they may arrive out of order, or packets may get lost totally). In order for this to be enabled, a maximum delay must be specified in the @code{max_delay} field of AVFormatContext. -When watching multi-bitrate Real-RTSP streams with @file{ffplay}, 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}. @@ -275,13 +298,13 @@ Example command lines: To watch a stream over UDP, with a max reordering delay of 0.5 seconds: @example -ffplay -max_delay 500000 rtsp://server/video.mp4?udp +ffplay -max_delay 500000 -rtsp_transport udp rtsp://server/video.mp4 @end example To watch a stream tunneled over HTTP: @example -ffplay rtsp://server/video.mp4?http +ffplay -rtsp_transport http rtsp://server/video.mp4 @end example To send a stream in realtime to a RTSP server, for others to watch: @@ -342,13 +365,13 @@ To broadcast a stream on the local subnet, for watching in VLC: ffmpeg -re -i @var{input} -f sap sap://224.0.0.255?same_port=1 @end example -Similarly, for watching in ffplay: +Similarly, for watching in @command{ffplay}: @example ffmpeg -re -i @var{input} -f sap sap://224.0.0.255 @end example -And for watching in ffplay, over IPv6: +And for watching in @command{ffplay}, over IPv6: @example ffmpeg -re -i @var{input} -f sap sap://[ff0e::1:2:3:4] @@ -386,6 +409,23 @@ ffplay sap://[ff0e::2:7ffe] Trasmission Control Protocol. +The required syntax for a TCP url is: +@example +tcp://@var{hostname}:@var{port}[?@var{options}] +@end example + +@table @option + +@item listen +Listen for an incoming connection + +@example +ffmpeg -i @var{input} -f @var{format} tcp://@var{hostname}:@var{port}?listen +ffplay tcp://@var{hostname}:@var{port} +@end example + +@end table + @section udp User Datagram Protocol. @@ -406,6 +446,11 @@ set the UDP buffer size in bytes @item localport=@var{port} override the local UDP port to bind with +@item localaddr=@var{addr} +Choose the local IP address. This is useful e.g. if sending multicast +and the host has multiple interfaces, where the user can choose +which interface to send on by specifying the IP address of that interface. + @item pkt_size=@var{size} set the size in bytes of UDP packets @@ -417,9 +462,9 @@ set the time to live value (for multicast only) @item connect=@var{1|0} Initialize the UDP socket with @code{connect()}. In this case, the -destination address can't be changed with udp_set_remote_url later. +destination address can't be changed with ff_udp_set_remote_url later. If the destination address isn't known at the start, this option can -be specified in udp_set_remote_url, too. +be specified in ff_udp_set_remote_url, too. This allows finding out the source address for the packets with getsockname, and makes writes return with AVERROR(ECONNREFUSED) if "destination unreachable" is received. @@ -427,7 +472,7 @@ 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 @file{ffmpeg} follow. +Some usage examples of the udp protocol with @command{ffmpeg} follow. To stream over UDP to a remote endpoint: @example diff --git a/lib/ffmpeg/doc/soc.txt b/lib/ffmpeg/doc/soc.txt index 8b4a86db80..2504dba553 100644 --- a/lib/ffmpeg/doc/soc.txt +++ b/lib/ffmpeg/doc/soc.txt @@ -9,16 +9,16 @@ 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 FFmpeg, to reach this goal, code must -* conform to the svn policy and patch submission guidelines +* conform to the development policy and patch submission guidelines * 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 essential that changes to their codebase are publicly visible, clean and easy reviewable that again leads us to: -* use of a revision control system like svn +* use of a revision control system like git * separation of cosmetic from non-cosmetic changes (this is almost entirely - ignored by mentors and students in soc 2006 which might lead to a suprise + 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 FFmpeg, individual changes were generally not reviewable due to cosmetics). * frequent commits, so that comments can be provided early diff --git a/lib/ffmpeg/doc/swresample.txt b/lib/ffmpeg/doc/swresample.txt new file mode 100644 index 0000000000..4daa181b0e --- /dev/null +++ b/lib/ffmpeg/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 skiped 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/lib/ffmpeg/doc/t2h.init b/lib/ffmpeg/doc/t2h.init index cd38a3ec9e..db5536bd88 100644 --- a/lib/ffmpeg/doc/t2h.init +++ b/lib/ffmpeg/doc/t2h.init @@ -1,15 +1,161 @@ # no horiz rules between sections -$end_section = \&FFMPEG_end_section; -sub FFMPEG_end_section($$) +$end_section = \&FFmpeg_end_section; +sub FFmpeg_end_section($$) { } -$print_page_foot = \&FFMPEG_print_page_foot; -sub FFMPEG_print_page_foot($$) +$EXTRA_HEAD = +'<link rel="icon" href="favicon.png" type="image/png" /> +<link rel="stylesheet" type="text/css" href="default.css" /> +'; + +$CSS_LINES = <<EOT; +<style type="text/css"> +<!-- +a.summary-letter { text-decoration: none } +a { color: #2D6198; } +a:visited { color: #884488; } +h1 a, h2 a, h3 a { text-decoration: inherit; color: inherit; } +p { margin-left: 1em; margin-right: 1em; } +table { margin-left: 2em; } +pre { margin-left: 2em; } +#footer { text-align: center; } +#body { margin-left: 1em; margin-right: 1em; } +body { background-color: #313131; margin: 0; } + +#container { + background-color: white; + color: #202020; + margin-left: 1em; + margin-right: 1em; +} + +h1 { + background-color: #7BB37B; + border: 1px solid #6A996A; + color: #151515; + font-size: 1.2em; + padding-bottom: 0.2em; + padding-left: 0.4em; + padding-top: 0.2em; +} + +h2 { + color: #313131; + font-size: 1.2em; +} + +h3 { + color: #313131; + font-size: 0.8em; + margin-bottom: -8px; +} + +.note { + margin: 1em; + border: 1px solid #bbc9d8; + background-color: #dde1e1; +} + +.important { + margin: 1em; + border: 1px solid #d26767; + background-color: #f8e1e1; +} + +--> +</style> +EOT + +my $FFMPEG_NAVBAR = $ENV{"FFMPEG_NAVBAR"} || ''; + +$AFTER_BODY_OPEN = +'<div id="container">' . +"\n$FFMPEG_NAVBAR\n" . +'<div id="body">'; + +$PRE_BODY_CLOSE = '</div></div>'; + +$SMALL_RULE = ''; +$BODYTEXT = ''; + +$print_page_foot = \&FFmpeg_print_page_foot; +sub FFmpeg_print_page_foot($$) { my $fh = shift; - print $fh "$SMALL_RULE\n"; + print $fh '<div id="footer">' . "\n"; T2H_DEFAULT_print_page_foot($fh); + print $fh "</div>\n"; +} + +$float = \&FFmpeg_float; + +sub FFmpeg_float($$$$) +{ + my $text = shift; + my $float = shift; + my $caption = shift; + my $shortcaption = shift; + + my $label = ''; + if (exists($float->{'id'})) + { + $label = &$anchor($float->{'id'}); + } + my $class = ''; + my $subject = ''; + + if ($caption =~ /NOTE/) + { + $class = "note"; + } + elsif ($caption =~ /IMPORTANT/) + { + $class = "important"; + } + + return '<div class="float ' . $class . '">' . "$label\n" . $text . '</div>'; +} + +$print_page_head = \&FFmpeg_print_page_head; +sub FFmpeg_print_page_head($$) +{ + my $fh = shift; + my $longtitle = "$Texi2HTML::THISDOC{'title_no_texi'}"; + $longtitle .= ": $Texi2HTML::NO_TEXI{'This'}" if exists $Texi2HTML::NO_TEXI{'This'}; + my $description = $DOCUMENT_DESCRIPTION; + $description = $longtitle if (!defined($description)); + $description = "<meta name=\"description\" content=\"$description\">" if + ($description ne ''); + $description = $Texi2HTML::THISDOC{'documentdescription'} if (defined($Texi2HTML::THISDOC{'documentdescription'})); + my $encoding = ''; + $encoding = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=$ENCODING\">" if (defined($ENCODING) and ($ENCODING ne '')); + $longtitle =~ s/Documentation.*//g; + $longtitle = "FFmpeg documentation : " . $longtitle; + + print $fh <<EOT; +$DOCTYPE +<html> +$Texi2HTML::THISDOC{'copying'}<!-- Created on $Texi2HTML::THISDOC{today} by $Texi2HTML::THISDOC{program} --> +<!-- +$Texi2HTML::THISDOC{program_authors} +--> +<head> +<title>$longtitle</title> + +$description +<meta name="keywords" content="$longtitle"> +<meta name="resource-type" content="document"> +<meta name="distribution" content="global"> +<meta name="Generator" content="$Texi2HTML::THISDOC{program}"> +$encoding +$CSS_LINES +$EXTRA_HEAD +</head> + +<body $BODYTEXT> +$AFTER_BODY_OPEN +EOT } # no navigation elements diff --git a/lib/ffmpeg/doc/texi2pod.pl b/lib/ffmpeg/doc/texi2pod.pl index aa3273ec1a..0eb5e8d9fe 100755 --- a/lib/ffmpeg/doc/texi2pod.pl +++ b/lib/ffmpeg/doc/texi2pod.pl @@ -231,10 +231,12 @@ while(<$inf>) { # Single line command handlers. - /^\@(?:section|unnumbered|unnumberedsec|center)\s+(.+)$/ + /^\@(?:section|unnumbered|unnumberedsec|center|heading)\s+(.+)$/ and $_ = "\n=head2 $1\n"; - /^\@subsection\s+(.+)$/ + /^\@(?:subsection|subheading)\s+(.+)$/ and $_ = "\n=head3 $1\n"; + /^\@(?:subsubsection|subsubheading)\s+(.+)$/ + and $_ = "\n=head4 $1\n"; # Block command handlers: /^\@itemize\s*(\@[a-z]+|\*|-)?/ and do { @@ -350,6 +352,7 @@ sub postprocess s/\(?\@xref\{(?:[^\}]*)\}(?:[^.<]|(?:<[^<>]*>))*\.\)?//g; s/\s+\(\@pxref\{(?:[^\}]*)\}\)//g; s/;\s+\@pxref\{(?:[^\}]*)\}//g; + s/\@ref\{([^\}]*)\}/$1/g; s/\@noindent\s*//g; s/\@refill//g; s/\@gol//g; |