How to disable non-1 audio streams / tracks in FFmpeg for mp4 files

My ultimate goal is to create a single FFmpeg team that converts my h264.DTS.mkv files into a format compatible with my AppleTV, while maintaining the original quality.

I am almost there, but I was not able to figure out how to disable streams / tracks.

So far I have received:

ffmpeg -i FILE \ -y -strict experimental \ -map 0:0 -map 0:1 -map 0:1 -map 0:1 -map 0:2 \ -c:0 copy -c:1 aac -ac:a 2 -c:2 ac3 -ac:a 6 -c:3 copy -c:4 mov_text \ OUTPUT 

This creates an output file that looks like this:

  • H264 video card (included) [copied from original]
  • AAC 2-channel audio track (included)
  • AC3 6-channel audio track (included)
  • DTS 6-channel audio track (included) [copied from the original]
  • subtitle track (on)

The problem is that I need it to look like this:

  • 1 H264 video track (copied from the original) (included)
  • 1 AAC 2-channel audio track (included)
  • 1 AC3 6-channel audio track (disabled)
  • 1 DTS soundtrack 6 channels (copied from the original) (disabled)
  • 1 subtitle track (included)

Therefore, I need to know how I can turn off non-1 audio streams / tracks.

From what I read, this is the atom part of the track header at the location "tkhd.flags". But I was not able to figure out how to set this using command line arguments.

Any help would be greatly appreciated.

+4
source share
3 answers

You checked this: http://ffmpeg.org/trac/ffmpeg/wiki/How%20to%20use%20-map%20option Just don't copy the streams you don't need for output.

 ffmpeg -i FILE \ -y -strict experimental \ -map 0:0 -map 0:1 -map 0:4 \ -c:0 copy -c:1 aac -ac:a 2 -c:4 mov_text \ OUTPUT 

I hope I asked the question correctly!

+2
source

Hello Dipesh, this will solve your problem.

Problem

What you are trying to accomplish is to indicate which audio stream will be used by default, while negating this flag in all unwanted audio streams. This solution will be similar when trying to choose which (if any) subtitle track will be default and / or, possibly, forced.

Common decision

FFmpeg automatically puts all threads in default without user intervention. Therefore, for all flags, this flag should be set to -default , except for the one that was selected by default. The problem can be solved with the following command: value = -default .

 -disposition[:stream_specifier] value (output,per-stream) 

Details on its use can be found in the FFmpeg Documentation in Section 5.4 General Settings .

Specific solution

 ffmpeg -i FILE \ -y -strict experimental \ -map 0:0 -map 0:1 -map 0:1 -map 0:1 -map 0:2 \ -c:0 copy -c:1 aac -ac:a 2 -c:2 ac3 -ac:a 6 -c:3 copy -c:4 mov_text \ -disposition:a -default -disposition:a:0 default \ OUTPUT 

In the -disposition:a -default all audio streams in the output file are flagged to non -default. So far, -disposition:a:0 default puts the first audio stream in the default output file.

+2
source

Turning off the sound track does not mean completely deleting it.

see image

enter image description here

0
source

All Articles