From 26122145559f55b6061281bd96a66cebdc5ac33f Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Wed, 29 Oct 2014 01:31:06 +0100 Subject: [PATCH 1/4] Do not set the lame quality if the user didn't request it. This makes FFmpeg's mp3 output more similar to lame's output. --- libavcodec/libmp3lame.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c index 661d1c05e4..d8a444dc98 100644 --- a/libavcodec/libmp3lame.c +++ b/libavcodec/libmp3lame.c @@ -106,9 +106,7 @@ static av_cold int mp3lame_encode_init(AVCodecContext *avctx) lame_set_out_samplerate(s->gfp, avctx->sample_rate); /* algorithmic quality */ - if (avctx->compression_level == FF_COMPRESSION_DEFAULT) - lame_set_quality(s->gfp, 5); - else + if (avctx->compression_level != FF_COMPRESSION_DEFAULT) lame_set_quality(s->gfp, avctx->compression_level); /* rate control */ From 19a6431ec247e4842236292cc5f8cfc8f87da11e Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Wed, 29 Oct 2014 01:32:44 +0100 Subject: [PATCH 2/4] Print a warning if a subtitle demuxer changes utf16 to utf8. This does not fix anything but gives users a chance to know that they must not pass -sub_charenc UTF-16 to ffmpeg. Fixes ticket #4059. --- libavformat/assdec.c | 2 +- libavformat/realtextdec.c | 2 +- libavformat/samidec.c | 2 +- libavformat/srtdec.c | 2 +- libavformat/subtitles.c | 7 +++++-- libavformat/subtitles.h | 4 +++- 6 files changed, 12 insertions(+), 7 deletions(-) diff --git a/libavformat/assdec.c b/libavformat/assdec.c index ccbf4c00cd..c62e76f0dd 100644 --- a/libavformat/assdec.c +++ b/libavformat/assdec.c @@ -112,7 +112,7 @@ static int ass_read_header(AVFormatContext *s) int res = 0; AVStream *st; FFTextReader tr; - ff_text_init_avio(&tr, s->pb); + ff_text_init_avio(s, &tr, s->pb); st = avformat_new_stream(s, NULL); if (!st) diff --git a/libavformat/realtextdec.c b/libavformat/realtextdec.c index 19af10830b..fff85d6ba9 100644 --- a/libavformat/realtextdec.c +++ b/libavformat/realtextdec.c @@ -65,7 +65,7 @@ static int realtext_read_header(AVFormatContext *s) char c = 0; int res = 0, duration = read_ts("60"); // default duration is 60 seconds FFTextReader tr; - ff_text_init_avio(&tr, s->pb); + ff_text_init_avio(s, &tr, s->pb); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/samidec.c b/libavformat/samidec.c index 4dbf2cf945..948e1ed8b1 100644 --- a/libavformat/samidec.c +++ b/libavformat/samidec.c @@ -54,7 +54,7 @@ static int sami_read_header(AVFormatContext *s) char c = 0; int res = 0, got_first_sync_point = 0; FFTextReader tr; - ff_text_init_avio(&tr, s->pb); + ff_text_init_avio(s, &tr, s->pb); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/srtdec.c b/libavformat/srtdec.c index 02d75f1bf1..b35e50fc36 100644 --- a/libavformat/srtdec.c +++ b/libavformat/srtdec.c @@ -87,7 +87,7 @@ static int srt_read_header(AVFormatContext *s) AVStream *st = avformat_new_stream(s, NULL); int res = 0; FFTextReader tr; - ff_text_init_avio(&tr, s->pb); + ff_text_init_avio(s, &tr, s->pb); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c index 95faca6e48..7f4bdef45e 100644 --- a/libavformat/subtitles.c +++ b/libavformat/subtitles.c @@ -24,7 +24,7 @@ #include "libavutil/avassert.h" #include "libavutil/avstring.h" -void ff_text_init_avio(FFTextReader *r, AVIOContext *pb) +void ff_text_init_avio(void *s, FFTextReader *r, AVIOContext *pb) { int i; r->pb = pb; @@ -45,13 +45,16 @@ void ff_text_init_avio(FFTextReader *r, AVIOContext *pb) r->buf_pos += 3; } } + if (s && (r->type == FF_UTF16LE || r->type == FF_UTF16BE)) + av_log(s, AV_LOG_WARNING, + "UTF16 is automatically converted to UTF8, do not specify a character encoding\n"); } void ff_text_init_buf(FFTextReader *r, void *buf, size_t size) { memset(&r->buf_pb, 0, sizeof(r->buf_pb)); ffio_init_context(&r->buf_pb, buf, size, 0, NULL, NULL, NULL, NULL); - ff_text_init_avio(r, &r->buf_pb); + ff_text_init_avio(NULL, r, &r->buf_pb); } int64_t ff_text_pos(FFTextReader *r) diff --git a/libavformat/subtitles.h b/libavformat/subtitles.h index 903c24d9df..eb719ea770 100644 --- a/libavformat/subtitles.h +++ b/libavformat/subtitles.h @@ -49,14 +49,16 @@ typedef struct { * Initialize the FFTextReader from the given AVIOContext. This function will * read some bytes from pb, and test for UTF-8 or UTF-16 BOMs. Further accesses * to FFTextReader will read more data from pb. + * If s is not NULL, the user will be warned if a UTF-16 conversion takes place. * * The purpose of FFTextReader is to transparently convert read data to UTF-8 * if the stream had a UTF-16 BOM. * + * @param s Pointer to provide av_log context * @param r object which will be initialized * @param pb stream to read from (referenced as long as FFTextReader is in use) */ -void ff_text_init_avio(FFTextReader *r, AVIOContext *pb); +void ff_text_init_avio(void *s, FFTextReader *r, AVIOContext *pb); /** * Similar to ff_text_init_avio(), but sets it up to read from a bounded buffer. From b608fba67265eae1d46d043793073afae80f4b42 Mon Sep 17 00:00:00 2001 From: Andrey Utkin Date: Wed, 29 Oct 2014 01:59:25 +0100 Subject: [PATCH 3/4] Use v4l2 input format automatically if filename starts with "/dev/video" Signed-off-by: Carl Eugen Hoyos --- libavdevice/v4l2.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index cf7a92cdd4..59bb78b13c 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -806,6 +806,13 @@ static int device_try_init(AVFormatContext *ctx, return ret; } +static int v4l2_read_probe(AVProbeData *p) +{ + if (av_strstart(p->filename, "/dev/video", NULL)) + return AVPROBE_SCORE_MAX - 1; + return 0; +} + static int v4l2_read_header(AVFormatContext *ctx) { struct video_data *s = ctx->priv_data; @@ -1033,6 +1040,7 @@ AVInputFormat ff_v4l2_demuxer = { .name = "video4linux2,v4l2", .long_name = NULL_IF_CONFIG_SMALL("Video4Linux2 device grab"), .priv_data_size = sizeof(struct video_data), + .read_probe = v4l2_read_probe, .read_header = v4l2_read_header, .read_packet = v4l2_read_packet, .read_close = v4l2_read_close, From 238ed47faeadf4ed0008da774cf61d6b224e4254 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Wed, 29 Oct 2014 01:59:52 +0100 Subject: [PATCH 4/4] Mention in the documentation that fieldmatch needs cfr input. This can be improved in the decimate filter but for the moment explicitely mentioning that mixed telecined and progressive content is unsupported is an improvement. Fixes ticket #3968. --- doc/filters.texi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/filters.texi b/doc/filters.texi index c70ddf3b50..01eb8935b8 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -4447,6 +4447,10 @@ and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from which @code{fieldmatch} is based on. While the semantic and usage are very close, some behaviour and options names can differ. +The filter currently only works for constant frame rate input. Do not use it +if your input has mixed telecined and progressive content with changing +framerate. + The filter accepts the following options: @table @option