[FFmpeg-devel] [PATCH]lavf/mov: Export vendor metadata
Carl Eugen Hoyos
cehoyos at ag.or.at
Mon Dec 12 13:12:37 EET 2016
Hi!
I saw only after writing this patch that a Google employee has sent
a more complicated variant of this patch in November (searching for
a description of the vendor field showed the patch).
Please comment, Carl Eugen
-------------- next part --------------
From 182ee7b3dca51a49a606c4d11758819ec29fc181 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <cehoyos at ag.or.at>
Date: Mon, 12 Dec 2016 12:05:38 +0100
Subject: [PATCH 1/2] ffmpeg: Do not copy vendor metadata on reencoding.
---
ffmpeg.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/ffmpeg.c b/ffmpeg.c
index e4890a4..f58e9b1 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3014,6 +3014,7 @@ static void set_encoder_id(OutputFile *of, OutputStream *ost)
av_strlcat(encoder_string, ost->enc->name, encoder_string_len);
av_dict_set(&ost->st->metadata, "encoder", encoder_string,
AV_DICT_DONT_STRDUP_VAL | AV_DICT_DONT_OVERWRITE);
+ av_dict_set(&ost->st->metadata, "vendor", NULL, 0);
}
static void parse_forced_key_frames(char *kf, OutputStream *ost,
--
1.7.10.4
-------------- next part --------------
From 7c26220a8734fe7dc293efe6c13e3baf91defc7e Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <cehoyos at ag.or.at>
Date: Mon, 12 Dec 2016 12:07:27 +0100
Subject: [PATCH 2/2] lavf/mov: Export vendor metadata.
---
libavformat/mov.c | 5 ++++-
tests/ref/fate/mov-zombie | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 0b1c182..a19ebbf 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1842,6 +1842,7 @@ static void mov_parse_stsd_video(MOVContext *c, AVIOContext *pb,
AVStream *st, MOVStreamContext *sc)
{
uint8_t codec_name[32] = { 0 };
+ uint8_t vendor[5] = { 0 };
int64_t stsd_start;
unsigned int len;
@@ -1851,7 +1852,9 @@ static void mov_parse_stsd_video(MOVContext *c, AVIOContext *pb,
avio_rb16(pb); /* version */
avio_rb16(pb); /* revision level */
- avio_rb32(pb); /* vendor */
+ avio_read(pb, vendor, 4);
+ if (vendor[0])
+ av_dict_set(&st->metadata, "vendor", vendor, 0);
avio_rb32(pb); /* temporal quality */
avio_rb32(pb); /* spatial quality */
diff --git a/tests/ref/fate/mov-zombie b/tests/ref/fate/mov-zombie
index 42e3a6f..ec6903f 100644
--- a/tests/ref/fate/mov-zombie
+++ b/tests/ref/fate/mov-zombie
@@ -129,5 +129,5 @@ packet|codec_type=video|stream_index=0|pts=188623|pts_time=2.095811|dts=188622|d
frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=188623|pkt_pts_time=2.095811|pkt_dts=188622|pkt_dts_time=2.095800|best_effort_timestamp=188623|best_effort_timestamp_time=2.095811|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=100846|pkt_size=974|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=64|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0
packet|codec_type=video|stream_index=0|pts=197632|pts_time=2.195911|dts=191625|dts_time=2.129167|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=580|pos=101820|flags=__
frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=191626|pkt_pts_time=2.129178|pkt_dts=N/A|pkt_dts_time=N/A|best_effort_timestamp=191626|best_effort_timestamp_time=2.129178|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=99180|pkt_size=1666|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=63|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0
-stream|index=0|codec_name=h264|profile=77|codec_type=video|codec_time_base=212521/12744000|codec_tag_string=avc1|codec_tag=0x31637661|width=160|height=240|coded_width=160|coded_height=240|has_b_frames=0|sample_aspect_ratio=2:1|display_aspect_ratio=4:3|pix_fmt=yuv420p|level=12|color_range=tv|color_space=smpte170m|color_transfer=bt709|color_primaries=smpte170m|chroma_location=topleft|field_order=unknown|timecode=N/A|refs=2|is_avc=true|nal_length_size=4|id=N/A|r_frame_rate=30000/1001|avg_frame_rate=6372000/212521|time_base=1/90000|start_pts=0|start_time=0.000000|duration_ts=2125200|duration=23.613333|bit_rate=333874|max_bit_rate=N/A|bits_per_raw_sample=8|nb_frames=708|nb_read_frames=65|nb_read_packets=66|disposition:default=1|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|tag:rotate=0|tag:creation_time=2008-05-12T20:59:27.000000Z|tag:language=eng|tag:handler_name=Apple Alias Data Handler|tag:encoder=H.264
+stream|index=0|codec_name=h264|profile=77|codec_type=video|codec_time_base=212521/12744000|codec_tag_string=avc1|codec_tag=0x31637661|width=160|height=240|coded_width=160|coded_height=240|has_b_frames=0|sample_aspect_ratio=2:1|display_aspect_ratio=4:3|pix_fmt=yuv420p|level=12|color_range=tv|color_space=smpte170m|color_transfer=bt709|color_primaries=smpte170m|chroma_location=topleft|field_order=unknown|timecode=N/A|refs=2|is_avc=true|nal_length_size=4|id=N/A|r_frame_rate=30000/1001|avg_frame_rate=6372000/212521|time_base=1/90000|start_pts=0|start_time=0.000000|duration_ts=2125200|duration=23.613333|bit_rate=333874|max_bit_rate=N/A|bits_per_raw_sample=8|nb_frames=708|nb_read_frames=65|nb_read_packets=66|disposition:default=1|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|tag:rotate=0|tag:creation_time=2008-05-12T20:59:27.000000Z|tag:language=eng|tag:handler_name=Apple Alias Data Handler|tag:vendor=appl|tag:encoder=H.264
side_data|side_data_type=Display Matrix|side_data_size=36|displaymatrix=\n00000000: 131072 0 0\n00000001: 0 65536 0\n00000002: 0 0 1073741824\n|rotation=0
--
1.7.10.4
More information about the ffmpeg-devel
mailing list