[FFmpeg-cvslog] Allow to overwrite input stream tags.

Carl Eugen Hoyos git at videolan.org
Sun Oct 16 19:05:37 CEST 2011


ffmpeg | branch: master | Carl Eugen Hoyos <cehoyos at ag.or.at> | Sun Oct 16 19:05:11 2011 +0200| [6bca574a98ba604459f6ee92538b19d25bba0973] | committer: Carl Eugen Hoyos

Allow to overwrite input stream tags.

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

 doc/ffmpeg.texi |    2 +-
 ffmpeg.c        |    9 +++++++++
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 8d3e59e..39fb27c 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -864,7 +864,7 @@ ffmpeg -i h264.mp4 -c:v copy -vbsf h264_mp4toannexb -an out.h264
 ffmpeg -i file.mov -an -vn -sbsf 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{per-stream})
 Force a tag/fourcc for matching streams.
 @end table
 
diff --git a/ffmpeg.c b/ffmpeg.c
index 4eb7ac4..a8fc82f 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2988,6 +2988,7 @@ static AVCodec *choose_codec(OptionsContext *o, AVFormatContext *s, AVStream *st
 static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
 {
     int i, rfps, rfps_base;
+    char *next, *codec_tag = NULL;
 
     for (i = 0; i < ic->nb_streams; i++) {
         AVStream *st = ic->streams[i];
@@ -3005,6 +3006,14 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
         MATCH_PER_STREAM_OPT(ts_scale, dbl, scale, ic, st);
         ist->ts_scale = scale;
 
+        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_codec(o, ic, st, dec->codec_type);
         if (!ist->dec)
             ist->dec = avcodec_find_decoder(dec->codec_id);



More information about the ffmpeg-cvslog mailing list