LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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

Reply
 
Search this Thread
Old 07-16-2012, 02:03 AM   #1
bloodstreetboy
Member
 
Registered: May 2012
Posts: 195
Blog Entries: 3

Rep: Reputation: 37
FFMPEG : While converting a video how to select second audio stream


I have a dual audio .mkv video file. .
ffmpeg -i "/media/sda8/movie_name.mkv"
Here is the output of above command.
Code:
Seems stream 0 codec frame rate differs from container frame rate: 47.95 (5000000/104271) -> 23.98 (24000/1001)
Input #0, matroska,webm, from '/media/sda8/movie_name.mkv':
  Duration: 02:08:25.33, start: 0.000000, bitrate: 825 kb/s
    Stream #0:0(eng): Video: h264 (High), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Metadata:
      title           : scOrp @ 300mbunited.com
    Stream #0:1(eng): Audio: aac, 48000 Hz, stereo, s16 (default)
    Stream #0:2(ita): Audio: mp3, 24000 Hz, stereo, s16, 64 kb/s
When I convert it to mp4 using ffmpeg. it selects the default audio for .mp4 file
that is english. I want the second audio stream (0:2) should be selected for the converted video.
I have tried all combinations but it selects english audio for converted file always, I want "ita" audio.
MY COMMAND:-
Code:
ffmpeg -i "path of input file.mkv" -f mp4 -vcodec mpeg4 -b 512k -r 30 -s 640x360 -acodec libfaac -ar 32000 -ab 128k -ac 2 -threads 8 "path of output file.mp4"
Please help.
If you want any other detail, feel free to ask.

Last edited by bloodstreetboy; 07-16-2012 at 02:44 AM.
 
Old 07-16-2012, 04:31 AM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949
Use the -map option to redirect input streams to their desired output positions.
 
Old 07-16-2012, 05:03 AM   #3
bloodstreetboy
Member
 
Registered: May 2012
Posts: 195
Blog Entries: 3

Original Poster
Rep: Reputation: 37
Thanks for response.
Can you please edit above ffmpeg command and make it according to desired output?
 
Old 07-16-2012, 06:05 AM   #4
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949
Why don't you try to figure it out for yourself first?

Besides, I don't happen to have any multi-audio files available to test on at the moment, so I can't ensure that I'd give you a correct answer.
 
Old 07-16-2012, 07:11 AM   #5
bloodstreetboy
Member
 
Registered: May 2012
Posts: 195
Blog Entries: 3

Original Poster
Rep: Reputation: 37
I have tried ur solution Its like I know what to do to solve this problem but don't know how to do it. Just like You told me to use 'sed' to edit text editor but do not tell me what is the exact syntax.
I have tried following command but it gives me audio-video mismatch problem.
Code:
ffmpeg -i "/media/sda8/U1/movie_name.mkv" -map 0:0 -map 0:2 -c:v copy -c:a:0 libmp3lame -b:a:0 128k -c:a:1 libfaac -b:a:1 96k -c:s copy "/media/sda8/U1/SH.mkv"

Last edited by bloodstreetboy; 07-16-2012 at 07:18 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ffmpeg mixing audio/video - trying to end vid after video stream completes joejoe99 Linux - Software 2 06-21-2012 11:44 PM
ffmpeg converting video jake20x Linux - General 8 04-10-2011 02:58 AM
[SOLVED] FFMPEG video converting, VERY pixelated Helstedxd Linux - Newbie 4 01-20-2011 01:49 PM
LXer: Converting video & audio files using ffmpeg in GNU/Linux LXer Syndicated Linux News 0 05-30-2009 04:31 AM
Converting flv to Mpg with Audio and ffmpeg btbx Linux - Software 7 06-12-2008 02:41 PM


All times are GMT -5. The time now is 10:26 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration