[FFmpeg-devel] [PATCH 1/2] Add option -movflags write_track_title which will write track title metadata. This is useful in conjunction with the metadata flag to specify track title, especially for workflows that are including multiple audio tracks in the same file.
Courtland Idstrom
cidstrom at telltalegames.com
Sat Mar 17 04:26:36 EET 2018
Example:
ffmpeg -i in.mov -movflags write_track_title -metadata:s:a:0 title="Eng-FullMix"
---
libavformat/movenc.c | 3 ++-
libavformat/movenc.h | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 5b1e66c897..3b1a734a0a 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -79,6 +79,7 @@ static const AVOption options[] = {
{ "use_metadata_tags", "Use mdta atom for metadata.", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_USE_MDTA}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
{ "skip_trailer", "Skip writing the mfra/tfra/mfro trailer for fragmented files", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_SKIP_TRAILER}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
{ "negative_cts_offsets", "Use negative CTS offsets (reducing the need for edit lists)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_NEGATIVE_CTS_OFFSETS}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
+ { "write_track_title", "Include track title metadata, even for MOV containers", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_TRACK_TITLE}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
FF_RTP_FLAG_OPTS(MOVMuxContext, rtp_flags),
{ "skip_iods", "Skip writing iods atom.", offsetof(MOVMuxContext, iods_skip), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
{ "iods_audio_profile", "iods audio profile atom.", offsetof(MOVMuxContext, iods_audio_profile), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 255, AV_OPT_FLAG_ENCODING_PARAM},
@@ -3027,7 +3028,7 @@ static int mov_write_track_udta_tag(AVIOContext *pb, MOVMuxContext *mov,
if (ret < 0)
return ret;
- if (mov->mode & MODE_MP4)
+ if (mov->mode & MODE_MP4 || mov->flags & FF_MOV_FLAG_TRACK_TITLE)
mov_write_track_metadata(pb_buf, st, "name", "title");
if ((size = avio_close_dyn_buf(pb_buf, &buf)) > 0) {
diff --git a/libavformat/movenc.h b/libavformat/movenc.h
index ca2a9c9722..72dd7a958b 100644
--- a/libavformat/movenc.h
+++ b/libavformat/movenc.h
@@ -246,6 +246,7 @@ typedef struct MOVMuxContext {
#define FF_MOV_FLAG_SKIP_TRAILER (1 << 18)
#define FF_MOV_FLAG_NEGATIVE_CTS_OFFSETS (1 << 19)
#define FF_MOV_FLAG_FRAG_EVERY_FRAME (1 << 20)
+#define FF_MOV_FLAG_TRACK_TITLE (1 << 21)
int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt);
--
2.14.3 (Apple Git-98)
More information about the ffmpeg-devel
mailing list