LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 12-21-2014, 03:31 PM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Rep: Reputation: 76
ffmpeg 0.11.1: how do I set the audio to English?


Hi: 'mplayer -alang eng The_Fountainhead.mkv' plays the movie with the English audio. I did 'ffmpeg -i The_Fountainhead.mkv -target ntsc-dvd ffmpeg/1.mpg' and then 'mplayer -alang eng 1.mpg' no longer played it in English but in Spanish. From the ffmpeg man page:
Code:
       -metadata[:metadata_specifier] key=value (output,per-metadata)
           Set a metadata key/value pair.

           An optional metadata_specifier may be given to set metadata on
           streams or chapters. See "-map_metadata" documentation for details.

           This option overrides metadata set with "-map_metadata". It is also
           possible to delete metadata by using an empty value.

           For example, for setting the title in the output file:

                   ffmpeg -i in.avi -metadata title="my title" out.flv

           To set the language of the first audio stream:

                   ffmpeg -i INPUT -metadata:s:a:1 language=eng OUTPUT
But I'm not sure about this. Can I tell ffmpeg to choose the English language for audio? Or even better, to preserve both languages so I can choose among them in the output file?

Last edited by stf92; 12-21-2014 at 03:35 PM.
 
Old 12-22-2014, 05:04 AM   #2
pchristy
Senior Member
 
Registered: Oct 2012
Location: South Devon, UK
Distribution: Slackware
Posts: 1,119

Rep: Reputation: Disabled
If there is more than one audio track, ffmpeg usually uses the first one it finds by default. If you just input, say

Code:
ffmpeg -i MyVideo.flv
then it should list all the tracks available. One of them should be identified as English. You need to make sure that this is the one mapped to your output file.

I've had this problem in the past with "off-air" recordings, where a narrative track (for the visually impaired) is often track 1, whilst the "proper" track may be 15 or similar! Ffmpeg by default only transfers the narrative track, and I have to use the "map" function to get the right audio.

I've always used the numeric form of map - never tried the metadata way of doing it - but you need to identify which track contains which language to do it this way. It does mean that you can preserve both language tracks though, once you've identified which is which.

For example, if track 15 contains the English track, and track 8 is Spanish (and assuming track 0 is the video), you should be able to do something like

Code:
-map 0:0 -map 0:15 -map 0:8
This should put the English track on track 1 of the output video and Spanish on track 2. Note that you have to specify the video track, even if to humans that is obvious!

--
Pete
 
1 members found this post helpful.
Old 12-22-2014, 01:10 PM   #3
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
Thank you very much. I did
Code:
$ ffmpeg -i TheFountainhead.mkv -map 0 -target ntsc-dvd 2.mpg
which gave
Code:
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> mpeg2video)
  Stream #0:1 -> #0:1 (ac3 -> ac3)
  Stream #0:2 -> #0:2 (ac3 -> ac3)
  Stream #0:3 -> #0:3 (? -> ?)
  Stream #0:4 -> #0:4 (? -> ?)
  Stream #0:5 -> #0:5 (? -> ?)
  Stream #0:6 -> #0:6 (copy)
  Stream #0:7 -> #0:7 (copy)
  Stream #0:8 -> #0:8 (copy)
  Stream #0:9 -> #0:9 (copy)
  Stream #0:10 -> #0:10 (copy)
Encoder (codec none) not found for output stream #0:3
Doing 'ffmpeg -i TheFountainhead.mkv' I get, for stream 0:5 for instance,
Code:
   Stream #0:5(eng): Subtitle: text
    Metadata:
      BPS             : 88
      BPS-eng         : 88
      DURATION        : 01:49:54.786000000
      DURATION-eng    : 01:49:54.786000000
      NUMBER_OF_FRAMES: 1647
      NUMBER_OF_FRAMES-eng: 1647
      NUMBER_OF_BYTES : 72723
      NUMBER_OF_BYTES-eng: 72723
      _STATISTICS_WRITING_APP: mkvmerge v7.0.0 ('Where We Going') 64bit built on Jun  9 2014 15:16:27
      _STATISTICS_WRITING_APP-eng: mkvmerge v7.0.0 ('Where We Going') 64bit built on Jun  9 2014 15:16:27
      _STATISTICS_WRITING_DATE_UTC: 2014-06-14 14:07:48
      _STATISTICS_WRITING_DATE_UTC-eng: 2014-06-14 14:07:48
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Is there any way to get the subtitles into the output?

P.S.: Well, perhaps this is not so important, for mplayer sees only the Spanish subtitles and these, badly synchronized.

Last edited by stf92; 12-22-2014 at 01:29 PM.
 
Old 12-22-2014, 01:40 PM   #4
pchristy
Senior Member
 
Registered: Oct 2012
Location: South Devon, UK
Distribution: Slackware
Posts: 1,119

Rep: Reputation: Disabled
To determine what tracks are available in the container, you don't need to specify an output file - simply
Code:
ffmpeg -i MyFile.flv
should do the trick. It will produce an error "no output specified", but that doesn't matter. This just saves time coding the file to find out what's in it!

It should give you a list of tracks, with some indication of what each one is. This is missing in your case, because you've told it to produce an output file, so its told you how its mapping them instead!

If a simple "ffmpeg -i MyFile.flv" doesn't help, then you have to be a bit more devious. You have two files with ac3 soundtracks. I would guess one is Spanish, the other English. From what happened when you tried it the first time, I would guess that 0:1 is Spanish and 0:2 is English, but to confirm this, just do a test:
Code:
$ ffmpeg -i TheFountainhead.mkv -map 0:0 -map 0:1 -target ntsc-dvd test.mpg
and quit via the "q" key once it has converted enough for you to tell. Play back the "test.mpg" file and see which you have. Then you can map accordingly.

Yes, you can map subtitle tracks, but this is a bit more complex, as different containers use different subtitle formats. Ffmpeg can do the translations from one format to another, but you need to know which format your destination container supports. I have done this, but it was a while back, and I usually just omit the subtitles when I do this anyway. Maybe someone else can give you some more detailed help here, but the documentation does cover this, although you have to wade through quite a bit to find it!

However, it looks as if your English subtitles are on track 5 (according to the listing you've got), so assuming track 2 is English and track one Spanish, then:
Code:
ffmpeg -i TheFountainhead.mkv -map 0:0 -map 0:2 -map 0:1 -map 0:5 -target ntsc-dvd 2.mpg
should give you a NTSC mpeg file with English on track1, Spanish on track2 and English subtitles on track3.

Don't be surprised if this throws up an error about incompatible formats, though since it worked after a fashion on your original attempt, you might be lucky!

--
Pete

Last edited by pchristy; 12-22-2014 at 01:49 PM.
 
Old 12-22-2014, 02:29 PM   #5
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
Alright, I did
Code:
ffmpeg -i TheFountainhead.mkv -map 0:0 -map 0:2 -map 0:1 -target ntsc-dvd 2.mpg
discarding all other streams (I don't remember now if I put -map 0:5, the English subtitles, too; I'll see when it finishes transcoding). I guess ffmpeg guesses the output format from the extension, .mpg, and so it formats an MPEG-1 file. What I finally want to do is to get a DVD-Video compliant file, and so I was told to use the output from ffmpeg as input to dvdauthor. But can't ffmpeg produce DVD-Video directly? Reading the ffmpeg man page it says nothing about it.
 
Old 12-22-2014, 04:27 PM   #6
pchristy
Senior Member
 
Registered: Oct 2012
Location: South Devon, UK
Distribution: Slackware
Posts: 1,119

Rep: Reputation: Disabled
-target ntsc-dvd tells it to make a dvd compliant mpeg file. But that does not "author" it onto a dvd. You could just burn the file onto a dvd, and most modern dvd players - and certainly blu-ray players - should play it. However, if you want to make a "proper" dvd, you will need to use dvdauthor to create it. Dvdauthor is a command-line program, and something of a pain to use at anything more than a very simple level. However, that may suffice for your needs. There are a couple of graphical front ends that help. Qdvdauthor is the most comprehensive, but not the simplest to use. For most stuff, I find devede a simpler option.

http://www.rastersoft.com/programas/devede.html

You will still need dvdauthor, mplayer, mencoder, ffmpeg and their dependencies, but devede will take a lot of the pain of actually authoring a dvd away!

P.S. You can stop ffmpeg at any time with the "q" key (quit) and it will stop and leave you with a playable file. Handy for doing short test runs to see if you have the syntax right!

--
Pete

Last edited by pchristy; 12-22-2014 at 04:28 PM.
 
Old 12-22-2014, 05:07 PM   #7
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
Thanks. I already have the output from the cli line in post #5, but I am missing the division into chapters the original .mkv had. Is there a way that ffmpeg preserves the chapters? I have just submited this same question in the ffmpeg.gusari.org forum.

Last edited by stf92; 12-22-2014 at 05:09 PM.
 
Old 12-23-2014, 11:12 AM   #8
pchristy
Senior Member
 
Registered: Oct 2012
Location: South Devon, UK
Distribution: Slackware
Posts: 1,119

Rep: Reputation: Disabled
'Fraid I don't know the answer to that one! I'm not a ffmpeg guru, I just know the commands I use on a semi-regular basis. For in-depth ffmpeg help, you really need to talk to the ffmpeg forum guys.

--
Pete
 
Old 12-23-2014, 11:44 PM   #9
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
The original .mkv file had 28 chapters. Now, neither MPEG-1 nor MPEG-2 supports chapters. So I forced chapters at 15m intervals in the XML file for dvdauthor. I guess the original marks were cleverly chosen (i.e., making them mark transitions from one scene to the following one, but it doesn't matter. I now have the DVD-Video DVD and am happy with it. I used ffmpeg, dvdauthor, mkisofs and growisofs. Thanks for your help, pchristy.
 
Old 12-24-2014, 02:53 AM   #10
pchristy
Senior Member
 
Registered: Oct 2012
Location: South Devon, UK
Distribution: Slackware
Posts: 1,119

Rep: Reputation: Disabled
Not a problem! Glad you found a solution!



--
Pete
 
  


Reply



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 - Replace Audio With Audio From Another Video golmschenk Linux - Software 1 10-17-2012 02:10 PM
[SOLVED] Keyboard set as English UK but layout still English US. Boardwriter Linux - Newbie 9 04-20-2012 03:20 AM
How to set up the keyboard for English with accents. stf92 Slackware 2 12-14-2010 08:14 PM
[SOLVED] Set english language konzo Linux - Newbie 4 02-22-2010 03:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:14 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration