[avconv] Video Passthrough + Multiple Audio Tracks

Random chit-chat and anything that doesn't belong elsewhere
Post Reply
plittlefield
Posts: 38
Joined: Wed Nov 18, 2009 10:03 am

[avconv] Video Passthrough + Multiple Audio Tracks

Post by plittlefield »

Hi Folks,

I would like to change a few DVD rips, so that they have multiple audio tracks.

This is the original command:-

HandBrakeCLI --input /dev/dvd --main-feature --audio-lang-list eng --aencoder copy:ac3 --output "movie.mp4"

Instead of ripping the original DVD again, I would like to run HandBrakeCLI with some sort of video passthrough which keeps the video track untouched and then just encode the single original DVD surround audio track in to 2 audio tracks... AAC + AC-3 Passthrough.

Stream #0.0(und): Video: h264 (Main), yuv420p, 720x424 [PAR 64:45 DAR 128:53], 903 kb/s, 25 fps, 25 tbr, 90k tbn, 180k tbc
Stream #0.1(eng): Audio: aac, 48000 Hz, stereo, fltp, 159 kb/s
Stream #0.2(eng): Audio: ac3, 48000 Hz, 5.1, fltp, 384 kb/s

However, I cannot see a video passthrough option on the command line help.

If HandBrakeCLI cannot do this, what is the best ffmpeg alternative?

Thanks for your help.

Regards,

Paully

HandBrake 20160611220333-44a359d-master
Ubuntu 14.04.4 LTS
rollin_eng
Veteran User
Posts: 4840
Joined: Wed May 04, 2011 11:06 pm

Re: Video Passthrough + Multiple Audio Tracks

Post by rollin_eng »

HB cannot do video passthrough, I'm not sure of alternatives on linux.
Deleted User 11865

Re: Video Passthrough + Multiple Audio Tracks

Post by Deleted User 11865 »

plittlefield wrote:If HandBrakeCLI cannot do this, what is the best ffmpeg alternative?
avconv :P

What's wrong with using ffmpeg?
plittlefield
Posts: 38
Joined: Wed Nov 18, 2009 10:03 am

Re: Video Passthrough + Multiple Audio Tracks

Post by plittlefield »

OK, now I know HB cannot do video passthrough (although it kind of goes against "what it does", IMHO I think it would be neat to have "--encoder copy" as an option, why not? :-)

OK, so I have used ffmpeg or avconv before, I was not sure of the specific command line options.

So far, I have built this command line up, but wanted to check with you experts on the "multiple audio tracks" part, so that it creates a libaac and a copied ac-3 stream.

avconv -i input.mp4 -vcodec copy -acodec libfaac -ac 2 -ar 48000 -ab 160k -acodec copy output.mp4

I am not familiar with the 'map' option, but basically, I just need to encode the existing ac-3 audio as an aac track, then copy that same ac-3 track as the second audio track.

From this...

Stream #0.0(und): Video: h264 (Main), yuv420p, 720x424 [PAR 64:45 DAR 128:53], 911 kb/s, 25 fps, 25 tbr, 90k tbn, 180k tbc
Stream #0.1(eng): Audio: ac3, 48000 Hz, 5.1, fltp, 448 kb/s

...to this...

Stream #0.0(und): Video: h264 (Main), yuv420p, 720x424 [PAR 64:45 DAR 128:53], 911 kb/s, 25 fps, 25 tbr, 90k tbn, 180k tbc
Stream #0.1(eng): Audio: aac, 48000 Hz, stereo, fltp, 160 kb/s
Stream #0.2(eng): Audio: ac3, 48000 Hz, 5.1, fltp, 448 kb/s

Is this possible, and can you show me the correct full ffmpeg / avconv command line please?

Thank you!

:-)

Paully
Deleted User 11865

Re: Video Passthrough + Multiple Audio Tracks

Post by Deleted User 11865 »

https://libav.org/avconv.html#Main-options
https://libav.org/avconv.html#Advanced-options

It should be noted that -vcodec and -acodec are aliases to legacy option names that don't always work well in my experience. I recommend using -codec instead.

I would try this:

Code: Select all

avconv -i INPUT -map 0:0 -map 0:1 -map 0:1 -codec:0 copy -codec:1 libfdk_aac -b:1 160k -ar:1 48k -ac:1 2 -codec:2 copy OUTPUT

Code: Select all

-map 0:0 -map 0:1 -map 0:1
select input stream 0:0, input stream 0:1 and input stream 0:1 again

Code: Select all

-codec:0 copy
set encoder to passthgrough for output stream 0 (video track)

Code: Select all

-codec:1 libfdk_aac
set encoder to passthgrough for output stream 1 (first audio track) (you should build avconv with libfdk_aac, it's better than libfaac)

Code: Select all

-b:1 160k -ar:1 48k -ac:1 2
set bitrate to 160 Kbps, sample rate to 48 kHz and number of channels to 2 (Stereo) for output stream 1 (first audfio track)

Code: Select all

-codec:2 copy
set encoder to passthgrough for output stream 2 (second audio track)
plittlefield
Posts: 38
Joined: Wed Nov 18, 2009 10:03 am

Re: [avconv] Video Passthrough + Multiple Audio Tracks

Post by plittlefield »

Amazing, thank you for being so quick and so detailed with your reply.

Much appreciated.

Regards,

Paully
mduell
Veteran User
Posts: 8187
Joined: Sat Apr 21, 2007 8:54 pm

Re: Video Passthrough + Multiple Audio Tracks

Post by mduell »

plittlefield wrote:OK, now I know HB cannot do video passthrough (although it kind of goes against "what it does", IMHO I think it would be neat to have "--encoder copy" as an option, why not? :-)
Would merely require a full rearchitecting of the entire program.

There are plenty of tools on all platforms for remuxing with audio changes. HB is not one of them.
Deleted User 13735

Re: [avconv] Video Passthrough + Multiple Audio Tracks

Post by Deleted User 13735 »

If you need to automate the process, all you need to do is figure out a script to run Handbrake and MP4Box interdependently, I would think.
Deleted User 11865

Re: [avconv] Video Passthrough + Multiple Audio Tracks

Post by Deleted User 11865 »

Moved to Tiki Bar.
plittlefield
Posts: 38
Joined: Wed Nov 18, 2009 10:03 am

Re: [avconv] Video Passthrough + Multiple Audio Tracks

Post by plittlefield »

Firstly, thank you to everyone for replying to this thread.

Rodeo's command line works a treat.

How would I also include the 'chapter' metadata information in the finished MP4 file?

Here is a sample source MP4 file that I would like to copy the video, convert and add 2 audio tracks, drop the subtitles track, but add the Chapters information...

http://pastebin.com/3PD8KTiJ

Many thanks,

Paully
Deleted User 11865

Re: [avconv] Video Passthrough + Multiple Audio Tracks

Post by Deleted User 11865 »

No clue about that, sorry.
Deleted User 13735

Re: [avconv] Video Passthrough + Multiple Audio Tracks

Post by Deleted User 13735 »

You should be able to do that straightaway in mp4Box.
--=BJ=--
Posts: 6
Joined: Fri Jun 30, 2017 9:26 pm

Re: [avconv] Video Passthrough + Multiple Audio Tracks

Post by --=BJ=-- »

Well, i must say... it would be nice to have an option for video-pass through in handbrake. Just for making new .ssa files or audio conversions only.

You have my vote for a future update :)
Woodstock
Veteran User
Posts: 4614
Joined: Tue Aug 27, 2013 6:39 am

Re: [avconv] Video Passthrough + Multiple Audio Tracks

Post by Woodstock »

With dozens of free programs out there to do remuxing (which is what you're asking for), why would it be "nice" to add to a program that was never intended to be "just" a remuxer?
User avatar
BradleyS
Moderator
Posts: 1860
Joined: Thu Aug 09, 2007 12:16 pm

Re: [avconv] Video Passthrough + Multiple Audio Tracks

Post by BradleyS »

--=BJ=-- Let's try to avoid resurrecting 7 month old threads.
Post Reply