diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-08-22 14:06:08 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-08-22 15:00:53 +0200 |
commit | 124deea1a0ccc4296cc6021231a7e6fbf336ff3a (patch) | |
tree | 95db44e4e9ed969674f9dbb194a999c8150a1e03 /libavcodec | |
parent | aeba058340ec47a10049c9cefb7ca8d500047b31 (diff) | |
parent | ae60927aefe7a9debc285451b2badf1b8eb5ab22 (diff) | |
download | ffmpeg-124deea1a0ccc4296cc6021231a7e6fbf336ff3a.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
libx264: only use ABR mode when the user explicitly set bitrate.
libx264: use medium preset by default.
mp2 encoder: make 128k the default bitrate.
movenc: use libx264 by default when possible for mov, mp4 and psp
avienc: saner default audio codec.
matroskaenc: saner default codecs.
avplay: add examples of how to specify size/pixel format through private options
lavc: add A|E|D flags to "ac" and "ar" options
Conflicts:
doc/ffplay.texi
libavcodec/libx264.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/libx264.c | 19 | ||||
-rw-r--r-- | libavcodec/mpegaudioenc.c | 7 | ||||
-rw-r--r-- | libavcodec/options.c | 4 |
3 files changed, 21 insertions, 9 deletions
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index 2804598464..33372f3c26 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -21,6 +21,7 @@ #include "libavutil/opt.h" #include "avcodec.h" +#include "internal.h" #include <x264.h> #include <math.h> #include <stdio.h> @@ -318,7 +319,10 @@ static av_cold int X264_init(AVCodecContext *avctx) OPT_STR("weightp", x4->weightp); x4->params.b_intra_refresh = avctx->flags2 & CODEC_FLAG2_INTRA_REFRESH; - x4->params.rc.i_bitrate = avctx->bit_rate / 1000; + if (avctx->bit_rate) { + x4->params.rc.i_bitrate = avctx->bit_rate / 1000; + x4->params.rc.i_rc_method = X264_RC_ABR; + } x4->params.rc.i_vbv_buffer_size = avctx->rc_buffer_size / 1000; x4->params.rc.i_vbv_max_bitrate = avctx->rc_max_rate / 1000; x4->params.rc.b_stat_write = avctx->flags & CODEC_FLAG_PASS1; @@ -337,11 +341,6 @@ static av_cold int X264_init(AVCodecContext *avctx) OPT_STR("stats", x4->stats); - // if neither crf nor cqp modes are selected we have to enable the RC - // we do it this way because we cannot check if the bitrate has been set - if (!(avctx->crf || (avctx->cqp > -1))) - x4->params.rc.i_rc_method = X264_RC_ABR; - if (avctx->rc_buffer_size && avctx->rc_initial_buffer_occupancy && (avctx->rc_initial_buffer_occupancy <= avctx->rc_buffer_size)) { x4->params.rc.f_vbv_buffer_init = @@ -428,7 +427,7 @@ static av_cold int X264_init(AVCodecContext *avctx) #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { - { "preset", "Set the encoding preset (cf. x264 --fullhelp)", OFFSET(preset), FF_OPT_TYPE_STRING, { 0 }, 0, 0, VE}, + { "preset", "Set the encoding preset (cf. x264 --fullhelp)", OFFSET(preset), FF_OPT_TYPE_STRING, { .str = "medium" }, 0, 0, VE}, { "tune", "Tune the encoding params (cf. x264 --fullhelp)", OFFSET(tune), FF_OPT_TYPE_STRING, { 0 }, 0, 0, VE}, { "profile", "Set profile restrictions (cf. x264 --fullhelp) ", OFFSET(profile), FF_OPT_TYPE_STRING, { 0 }, 0, 0, VE}, { "fastfirstpass", "Use fast settings when encoding first pass", OFFSET(fastfirstpass), FF_OPT_TYPE_INT, { 1 }, 0, 1, VE}, @@ -446,6 +445,11 @@ static const AVClass class = { .version = LIBAVUTIL_VERSION_INT, }; +static const AVCodecDefault x264_defaults[] = { + { "b", "0" }, + { NULL }, +}; + AVCodec ff_libx264_encoder = { .name = "libx264", .type = AVMEDIA_TYPE_VIDEO, @@ -458,4 +462,5 @@ AVCodec ff_libx264_encoder = { .pix_fmts = (const enum PixelFormat[]) { PIX_FMT_YUV420P, PIX_FMT_YUVJ420P, PIX_FMT_NONE }, .long_name = NULL_IF_CONFIG_SMALL("libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"), .priv_class = &class, + .defaults = x264_defaults, }; diff --git a/libavcodec/mpegaudioenc.c b/libavcodec/mpegaudioenc.c index 0ca99bac15..cc4dee9636 100644 --- a/libavcodec/mpegaudioenc.c +++ b/libavcodec/mpegaudioenc.c @@ -25,6 +25,7 @@ */ #include "avcodec.h" +#include "internal.h" #include "put_bits.h" #define FRAC_BITS 15 /* fractional bits for sb_samples and dct */ @@ -763,6 +764,11 @@ static av_cold int MPA_encode_close(AVCodecContext *avctx) return 0; } +static const AVCodecDefault mp2_defaults[] = { + { "b", "128k" }, + { NULL }, +}; + AVCodec ff_mp2_encoder = { .name = "mp2", .type = AVMEDIA_TYPE_AUDIO, @@ -774,4 +780,5 @@ AVCodec ff_mp2_encoder = { .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, .supported_samplerates= (const int[]){44100, 48000, 32000, 22050, 24000, 16000, 0}, .long_name = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"), + .defaults = mp2_defaults, }; diff --git a/libavcodec/options.c b/libavcodec/options.c index cb2cd7decb..99deac2f41 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -126,8 +126,8 @@ static const AVOption options[]={ {"extradata_size", NULL, OFFSET(extradata_size), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, {"time_base", NULL, OFFSET(time_base), FF_OPT_TYPE_RATIONAL, {.dbl = 0}, INT_MIN, INT_MAX}, {"g", "set the group of picture size", OFFSET(gop_size), FF_OPT_TYPE_INT, {.dbl = 12 }, INT_MIN, INT_MAX, V|E}, -{"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, -{"ac", "set number of audio channels", OFFSET(channels), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, +{"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, A|D|E}, +{"ac", "set number of audio channels", OFFSET(channels), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, A|D|E}, {"cutoff", "set cutoff bandwidth", OFFSET(cutoff), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, A|E}, {"frame_size", NULL, OFFSET(frame_size), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, A|E}, {"frame_number", NULL, OFFSET(frame_number), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, |