[FFmpeg-devel] [PATCH] libavformat > matroskaenc : Enable manual setting of disposition:default tag
Michael Niedermayer
michaelni at gmx.at
Thu Jan 8 23:04:37 CET 2015
On Thu, Jan 08, 2015 at 03:02:15PM +0100, Elian FARAJ wrote:
> Hi folks,
>
> In Matroska specifications you can set a stream as default stream using the metadata tag disposition:default. If there is no value, default value is 1, implying the stream is default (...by default). Ffmpeg currently supports this but only when there are default/non default streams in input file, user has no way to set himself what should be default and what shouldn't be. When we're outside of this case (often happens) this causes unwanted behavior : when you have 2 audio streams nothing will be written in disposition:default so according to Matroska standards the 2 streams will be default. If you want to set an audio stream as default (because it's in the language you want as default for example) you cannot - and by the way "two default streams" doesn't make any sense. It's worse if you got subtitles and if you want none as default because your player will show subtitles by default, as subtitles streams are default streams too.
>
> Sorry if this description is pure mess, here are few links with relevant information :
> http://thread.gmane.org/gmane.comp.video.ffmpeg.devel/158229
> http://article.gmane.org/gmane.comp.video.ffmpeg.devel/158353
> http://ffmpeg.org/pipermail/ffmpeg-user/2012-October/010845.html
>
> As stated in the last link users can try to set a metadata tag disposition:default but it will be considered as "extra" metadata and not real default tag. My patch aims to support this tag so default stream status is actually written. My patch doesn't change default (sorry) behavior of Ffmpeg, it only enables users set a default stream tag which overrides automatic choices of Ffmpeg.
>
> Please note that I'm an extreme beginner in all those topics. I have near no experience in multimedia, I have poor programming skills ("skilled" only with PHP and very general knowledge in true programming languages, you couldn't even state that I'm "programming !") and I never used Git nor mailing lists before, I quickly Googled those topics. I simply wanted to enable something in Ffmpeg and I don't like begging for others to work for me so I tried it by myself. Sorry if I did anything wrong.
>
> I'll use a simple example to show you how my patch works. We'll take a file, Video.avi, with 1 video and 1 audio streams. We'll convert it to Video.mkv, with 1 video stream and 2 duplicated audio streams. We'll set the video stream and the first audio stream as default.
>
> Original Ffmpeg behavior :
> ffmpeg -i Video.avi -map 0:0 -map 0:1 -map 0:1 -metadata:s:v:0 disposition:default=1 -metadata:s:a:0 disposition:default=1 -metadata:s:a:1 disposition:default=0 Video.mkv
> The disposition:default tag is not actually written in those 3 cases. Therefore any video player compliant with Matroska specs reads those 3 streams as default.
>
> With my patch :
> ffmpeg -i Video.avi -map 0:0 -map 0:1 -map 0:1 -metadata:s:v:0 disposition:default=1 -metadata:s:a:0 disposition:default=1 -metadata:s:a:1 disposition:default=0 Video.mkv
> Video stream (#0) : disposition:default=1 : The video stream is set as default so it is read as default (doesn't change with the case above)
> Audio stream #0 : disposition:default=1 : This audio stream is set as default so it is read as default
> Audio stream #1 : disposition:default=0 : This audio stream is set as not default so it is not read as default (this changes with the case above)
>
> Thanks for reviewing
See "[PATCH] ffmpeg: allow overriding and amending AVStream->disposition"
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up
some war or other, in order that the people may require a leader. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150108/dd96efc1/attachment.asc>
More information about the ffmpeg-devel
mailing list