Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
11-30-2009, 04:19 AM
|
#1
|
LQ Newbie
Registered: Mar 2008
Location: West Coast
Distribution: Slack13
Posts: 20
Rep:
|
Converting 6 channel audio to 2 channel audio in a MKV file
How would I go about demuxing a 6 channel audio from a mkv, down mix it to 2 channel, then mux the video and sound back together?
My computer has trouble downmixing on the fly as it causes major lag and stuttering during playback.
Here's the relevent data from "ffmpeg -i file.mkv"
Code:
Stream #0.0(eng): Video: h264, yuv420p, 1920x1080, PAR 1:1 DAR 16:9, 23.98 tbr, 1k tbn, 47.95 tbc
Stream #0.1(eng): Audio: ac3, 48000 Hz, 6 channels, s16
Oh, and I'd prefer it to be on command line, but if theres a gui app that makes it much easier, I'd be willing to use that too.
Thanks
|
|
|
11-30-2009, 05:35 AM
|
#2
|
LQ Guru
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
|
Newer versions of ffmpeg should have no problem with it. I remember older versions failed with an error if you tried 6 -> 2 channel downmix.
So, you still want to use ac3 in the output ? I wouldn't, it's a waste of space.
Anyway I recommend:
Code:
ffmpeg -i file.mkv -vcodec copy -acodec libmp3lame -ab 160k -ar 48000 -async 48000 -ac 2 output.mkv
You can also use mencoder:
Code:
mencoder input.mkv -oac mp3lame -lameopts q=2 -ovc copy -o output.mkv
or
Code:
mencoder input.mkv -oac faac -faacopts quality=500 -ovc copy -o output.mkv
|
|
|
01-16-2010, 10:38 AM
|
#3
|
LQ Guru
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
|
Just to be more complete, it can also be done this way (recently tested this, and it works, in case ffmpeg doesn't want to do it):
Code:
mkvextract tracks input.mkv 2:sixchannel.aac
faad -d -a twochannel.aac sixchannel.aac
mkvmerge -o output.mkv -A input.mkv twochannel.aac
Check using mkvinfo to see which track is the audio track, because it might not be 2.
|
|
|
01-16-2010, 12:03 PM
|
#4
|
Senior Member
Registered: Feb 2003
Distribution: debian
Posts: 4,137
|
ffmpeg -vn -i input.mkv -acodec copy -y audio_original.format
sox audio_original.format -c 2 stereo.format
and remux. I've found ffmpeg to be a little wonky with audio. i.e. If I use ffmpeg to trim / extract a particular time segment of audio, it'll differ from other more accurate applications. It'll do it, and it'll be close. But when I was trying to use ffmpeg to extract an element to sync with an external audio source, I had real issues with lining up that external audio +/- 1/1000th of second with ffmpeg. With sox, it's spot on everytime, shift the cut points and it stays linear. Shift it with ffmpeg and your sync point changes. Fractions of a second, but still annoying(+/- 0.050 aka 1/2 of 1/10th of a second but noticeable drumming at 60p in HD). </rant>
ffmpeg does decent with audio ONLY.
ffmpeg does decent with video ONLY.
ffmpeg is not that decent when doing both video and audio at the same time. IMHO
Basically -acodec copy and/or -vcodec copy the original content, then handle individually until the last possible moment.
|
|
|
01-16-2010, 12:27 PM
|
#5
|
LQ Guru
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
|
Well, for a/v sync issues make sure to use the '-async' option with ffmpeg (with the sample rate of the audio as the parameter), that should prevent any kind of a/v desync. I've tested it, and I don't notice any a/v desync if you use this option.
|
|
|
01-25-2011, 12:40 PM
|
#6
|
LQ Newbie
Registered: Jan 2011
Posts: 2
Rep:
|
Using this command line:
ffmpeg -i file.mkv -vcodec copy -acodec libmp3lame -ab 160k -ar 48000 -async 48000 -ac 2 output.mkv
I get the error:
Resampling with input channels greater than 2 unsupported.
Can not resample 6 channels @ 48000 Hz to 2 channels @ 48000 Hz
This works fine:
mencoder input.mkv -oac mp3lame -lameopts q=2 -ovc copy -o output.mkv
but the issue is I need to use ffmpeg because it is what the program is using to transcode.
I know this is an old post, but hopfully someone will see activity.
|
|
|
01-25-2011, 01:08 PM
|
#7
|
LQ Guru
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
|
|
|
|
01-26-2011, 08:04 AM
|
#8
|
LQ Newbie
Registered: Jan 2011
Posts: 2
Rep:
|
Thank you for the information and direction. Would these work for on the fly transcoding?
|
|
|
01-26-2011, 01:37 PM
|
#9
|
LQ Guru
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
|
On the fly ? Like how ? Piping stuff ? Yeah, just use '-'.
|
|
|
10-21-2013, 05:27 AM
|
#10
|
LQ Newbie
Registered: Oct 2013
Posts: 1
Rep:
|
To change 6 channel audio to 2 channel audio in a MKV file, I know a very nice guide. Google search "Convert between 6/5.1Channel, 2 Channel/Stereo and Mono" to get it.
|
|
|
All times are GMT -5. The time now is 09:45 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|