ginjaninja 539 Posted February 24, 2015 Share Posted February 24, 2015 (edited) Can any one advise please how do inject the aac audio track into the mkv... I have an original MKV with 1 Video track, 1 or More Audio Tracks, 0 or more Subtitle tracks, 0 or more chapters called movie.mkv I have an aac encoded version of the original MKV's dts track called movie.aac I would like to end up with.... (i need the command to work in a script with multiple different files with different numbers of tracks) Originals Video Track AAC Track Originals Audio Tracks Originals Subtitle Tracks Originals Chapters or even more generically...Keep the MKV exactly the same except inject the aac as the primary audio track. I found this command on the internet but it doesnt work ffmpeg -v quiet -i %%~nF.mkv -i %%~nF.aac -vcodec copy -map 0:v:0 -acodec copy -map 1:a:0 -scodec copy -map 0:s:0 %%~nF.AAC.mkv Also, is it possible to stop ffmpeg injecting additional garbadge streams into mkv...like tags .....so its identical just with an extra audio track.? thanks Edited February 24, 2015 by ginjaninja Link to comment Share on other sites More sharing options...
thefirstofthe300 291 Posted February 24, 2015 Share Posted February 24, 2015 Are you using Windows or Linux or Mac? That would make a difference as the windows ffmpeg command is ffmpeg.exe. Depending on the above, here is what I would use: ffmpeg -i movie.mkv movie.aac -map 0:0 -map 1:0 -map 0:{stream_number_for_subtitle_stream} -v:c copy -a:c copy -s:c copy movie.AAC.mkv Change what is in brackets to the appropriate number base on the output of ffprobe (the number of the stream in the video file. Link to comment Share on other sites More sharing options...
ginjaninja 539 Posted February 24, 2015 Author Share Posted February 24, 2015 Are you using Windows or Linux or Mac? That would make a difference as the windows ffmpeg command is ffmpeg.exe. Depending on the above, here is what I would use: ffmpeg -i movie.mkv movie.aac -map 0:0 -map 1:0 -map 0:{stream_number_for_subtitle_stream} -v:c copy -a:c copy -s:c copy movie.AAC.mkv Change what is in brackets to the appropriate number base on the output of ffprobe (the number of the stream in the video file.Thanks its windowsPs i cant hardcode eg subtitle steam numbers as it needs to work accross multiple files...is there a solution? Link to comment Share on other sites More sharing options...
thefirstofthe300 291 Posted February 24, 2015 Share Posted February 24, 2015 I think I saw somewhere that doing ffmpeg -i movie.mkv movie.aac -map 0 -map 1 -map 0 -v:c copy -a:c copy -s:c copy movie.AAC.mkv would work. I haven't tried it myself though. You should test it on something that isn't important to you. Link to comment Share on other sites More sharing options...
ginjaninja 539 Posted February 25, 2015 Author Share Posted February 25, 2015 thanks you pointed me in the right direction ffmpeg -v verbose -i filmname.mkv -i filmname.aac -map 0:0 -map 1 -map 0:a -map 0:s -vcodec copy -acodec copy -scodec copy filmname.AAC.mkv as long as the first stream is the one and only video stream (which it always is)..this command works problem is it creates loads of tags which im keen to remove...but also it seems to alter the dts track rather than copy it (not that it has an adverse affect) [matroska @ 00000000003def60] Non-monotonous DTS in output stream 0:2; previous: 7294762, current: 7294751; changing to 7294762. This may result in incorrect ti mestamps in the output file. Link to comment Share on other sites More sharing options...
jabbera 23 Posted February 25, 2015 Share Posted February 25, 2015 This would be great for rifftrax! I wish MBS support side audio streams out of the box: http://www.rifftrax.com/ Link to comment Share on other sites More sharing options...
ginjaninja 539 Posted February 25, 2015 Author Share Posted February 25, 2015 (edited) mkvmerge.exe --disable-track-statistics-tags --track-order 0:0,1:0 -o filmname.aac.mkv --no-global-tags --no-track-tags filmname.mkv --no-global-tags --no-track-tags filmname.aac its simpler (and quicker) with mkv merge....and no alteration of dts track... turns out mkvmerge also generates the tags... but --disable-track-statistics-tags disables... https://github.com/mbunkus/mkvtoolnix/wiki/Automatic-tag-generation seems to suggest the tags are a good thing though...still i wanted to keep the file the same (apart from the aac track) Edited February 25, 2015 by ginjaninja Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now