[FFmpeg-devel] [PATCH v2 04/18] avformat/movenc: deal with AVMEDIA_TYPE_DATA by using AV_CODEC_ID_META

Erkki Seppälä erkki.seppala.ext at nokia.com
Tue Sep 6 16:07:21 EEST 2016

On 09/06/2016 02:37 PM, Carl Eugen Hoyos wrote:
> I meant that for the same ffmpeg command line and the same
> input file, I believe that with your patch, the output file (suddenly)
> has one track more than before (because the data codec is now
> listed in AVOutputFormat, the ffmpeg cli will try to add this track
> if the input file provides such a codec).

Ok, so now I finally understood the case and indeed if I have a file 
with video+data, converting it to a .mov without any particular mapping 
options results in a video+data track, instead of just video as what 
would happen if the .data_codecs are not defined. (I used ffmpeg -i 
foo.mp4 -codec copy bar.mp4 (or .mov) for testing where foo.mp4 has a 
data track.)

A curiosity: if I copy a file with two video tracks and two data tracks 
I end up with a file with one video track and two data tracks (unless I 
use -map : to copy all).

Would it be even better to not copy the data tracks at all by default, 
so not set the .data_codec field for any format?

Or another view is that it would seem useful though that all the data 
tracks would be copied (but so does copying all video tracks). Or it 
could copy all the tracks that have track references to tracks copied by 

> Can you just remove the additional ".data_codec=" lines or is
> it intended that they are now default codecs?
> (Or am I simply wrong and they either do not lead to a new
> track and / or ffmpeg simply ignores them because it only fills
> video, audio and subtitle tracks?)

This seems the correct solution. My next patch set will remove the 
.data_codec at least from output formats other than the .mp4.


More information about the ffmpeg-devel mailing list