xat / castnow

commandline chromecast player
MIT License
3.81k stars 243 forks source link

multi-language audio track support #211

Open memob0x opened 6 years ago

memob0x commented 6 years ago

how do i switch audio track? i tried some --ffmpeg-metatadata commands with no luck...

Not too sure about it, but i think --tomp4 choose english by default, without --tomp4 it choose the first in the list.

ai commented 6 years ago

@smblott-github the same question

smblott-github commented 6 years ago

I seem to remember that you can use the -map flag to ffmpeg to control which tracks are in the output.

ai commented 6 years ago

Awesome! Thanks.

Should we add it to find or --help>

pfrenssen commented 6 years ago

Here is the command using ffmpeg. It uses the -map option to select the streams to copy. -map 0:v selects all video streams. -map 0:a:0 selects the first audio stream, -map 0:a:1 the second audio stream etc.

So if you want the second audio stream you would use this:

$ ffmpeg -i inputfile.mkv -c copy -map 0:v -map 0:a:1 outputfile.mkv
talisein commented 5 years ago

the library castnow uses, stream-transcoder, saves custom parameters (e.g. those passed by castnow --ffmpeg) into a map keyed on the key name. This means that trying to pass a key with the same name will be overwritten; you can't pass -map twice.

I was able to hack it by editing plugins/transcode.js as follows

    for (var key in opts) {
      trans.custom(key, opts[key]);
    }
    trans.custom('map', '0:2');
    trans.custom('map\0', '0:0');
    var args = trans._compileArguments();

I'm not really a js guy so I can't make a decent patch to properly support this, but I figured I'd let others know the nature of the problem.