[FFmpeg-cvslog] avconv: support forcing codec tags for input streams

Anton Khirnov git at videolan.org
Mon Feb 24 09:20:14 CET 2014


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sun Feb 23 08:05:52 2014 +0100| [746dca483a2f0f2639265f6e1c0085c8861875a1] | committer: Anton Khirnov

avconv: support forcing codec tags for input streams

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=746dca483a2f0f2639265f6e1c0085c8861875a1
---

 avconv_opt.c    |   12 +++++++++++-
 doc/avconv.texi |    2 +-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/avconv_opt.c b/avconv_opt.c
index d62d11f..7bc41c9 100644
--- a/avconv_opt.c
+++ b/avconv_opt.c
@@ -463,6 +463,8 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
         AVCodecContext *dec = st->codec;
         InputStream *ist = av_mallocz(sizeof(*ist));
         char *framerate = NULL, *hwaccel = NULL, *hwaccel_device = NULL;
+        char *codec_tag = NULL;
+        char *next;
 
         if (!ist)
             exit_program(1);
@@ -478,6 +480,14 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
         ist->ts_scale = 1.0;
         MATCH_PER_STREAM_OPT(ts_scale, dbl, ist->ts_scale, ic, st);
 
+        MATCH_PER_STREAM_OPT(codec_tags, str, codec_tag, ic, st);
+        if (codec_tag) {
+            uint32_t tag = strtol(codec_tag, &next, 0);
+            if (*next)
+                tag = AV_RL32(codec_tag);
+            st->codec->codec_tag = tag;
+        }
+
         ist->dec = choose_decoder(o, ic, st);
         ist->opts = filter_codec_opts(o->g->codec_opts, ist->st->codec->codec_id, ic, st, ist->dec);
 
@@ -2238,7 +2248,7 @@ const OptionDef options[] = {
     { "frames",         OPT_INT64 | HAS_ARG | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(max_frames) },
         "set the number of frames to record", "number" },
     { "tag",            OPT_STRING | HAS_ARG | OPT_SPEC |
-                        OPT_EXPERT | OPT_OUTPUT,                     { .off = OFFSET(codec_tags) },
+                        OPT_EXPERT | OPT_OUTPUT | OPT_INPUT,         { .off = OFFSET(codec_tags) },
         "force codec tag/fourcc", "fourcc/tag" },
     { "q",              HAS_ARG | OPT_EXPERT | OPT_DOUBLE |
                         OPT_SPEC | OPT_OUTPUT,                       { .off = OFFSET(qscale) },
diff --git a/doc/avconv.texi b/doc/avconv.texi
index 7ef415f..0c17eb9 100644
--- a/doc/avconv.texi
+++ b/doc/avconv.texi
@@ -821,7 +821,7 @@ avconv -i h264.mp4 -c:v copy -bsf:v h264_mp4toannexb -an out.h264
 avconv -i file.mov -an -vn -bsf:s mov2textsub -c:s copy -f rawvideo sub.txt
 @end example
 
- at item -tag[:@var{stream_specifier}] @var{codec_tag} (@emph{output,per-stream})
+ at item -tag[:@var{stream_specifier}] @var{codec_tag} (@emph{input/output,per-stream})
 Force a tag/fourcc for matching streams.
 
 @item -filter_complex @var{filtergraph} (@emph{global})



More information about the ffmpeg-cvslog mailing list