Add ACC audio track to existing mp4 with AC3

Discussion of the HandBrake command line interface (CLI)
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
AndrewW
New User
Posts: 1
Joined: Thu Nov 17, 2016 5:03 pm

Add ACC audio track to existing mp4 with AC3

Post by AndrewW »

I have a number of files which were encoded with ffmpeg and only have AC3 audio tracks

the details are
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 1567 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(eng): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, stereo, fltp, 192 kb/s (default)
Metadata:
handler_name : SoundHandler

This gives issues with playback with Roku, i.e silent playbacks as Roku just passes though AC3 but this should be ok,although it does not work in practice (may be a firmware issues on Roku).

I tried converting an mp4 with ffmpeg to have an acc track, and while it works it gives gives poor audio with the standard acc converter, and the enhanced converter in not included by default and needs recompiling to enable.

I also have mp4 files which were converted with Handbrake and the details are below these work fine.

Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt470bg/bt709), 718x568 [SAR 16:15 DAR 1436:1065], 2122 kb/s, 25 fps, 25 tbr, 90k tbn, 180k tbc (default)
Metadata:
creation_time : 2016-04-04 09:04:13
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s (default)
Metadata:
creation_time : 2016-04-04 09:04:13
handler_name : Stereo
Stream #0:2(eng): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, stereo, fltp, 192 kb/s


Is there any way especially with the command line to take an existing mp4 as shown in the first example and add an acc audio track, and set it as the default sound track, so it looks like the 2nd example ?
Ideally i don't want to retranscode the video or original sound track simple add another.
I also need to do this with the command line as there are a lot of affected files


Tell us about your environment. What version of HandBrake? What operating system are you running. etc.

latest version on ubuntu

Many Thanks
Andrew
rollin_eng
Veteran User
Posts: 4853
Joined: Wed May 04, 2011 11:06 pm

Re: Add ACC audio track to existing mp4 with AC3

Post by rollin_eng »

You have to convert your video with HB.

You might be able to do this with xmedia recode.
kpflugshaupt
Novice
Posts: 63
Joined: Sat Feb 06, 2010 8:00 pm

Re: Add ACC audio track to existing mp4 with AC3

Post by kpflugshaupt »

AndrewW wrote:Is there any way especially with the command line to take an existing mp4 as shown in the first example and add an acc audio track, and set it as the default sound track, so it looks like the 2nd example ?
Ideally i don't want to retranscode the video or original sound track simple add another.
I also need to do this with the command line as there are a lot of affected files
I've done this with Handbrake (GUI) using a two-part workflow:

1) Encode the mp4 to a new movie, choosing throwaway quality for video (lowest resolution and quality possible, the MPEG codec used to work well for this), and the AAC codec with the desired target quality for sound. This will finish quickly, as converting the audio is not very taxing, and we minimized the effort for the video conversion.
2) Use a muxing tool (e.g. Subler on MacOS) to extract the AAC audio track from the resulting movie and merge it into the original mp4 container. The tool will also let you choose the default audio track.

Of course, you will have to find a scriptable mp4 muxing tool to achieve this on the command line (cannot help you there), but the results have always been fine for me.

Kaspar
Post Reply