VideoHelp Forum




+ Reply to Thread
Results 1 to 7 of 7
  1. Member
    Join Date
    Nov 2016
    Location
    Greece
    Search Comp PM
    I'm a Mac user. I have VLC, QuickTime 7 Pro, Video Monkey and MPEG Streamclip.

    I have a file xxxx.mkv which I can open in VLC, which gives me a choice of two [English] audio tracks. The second track is a review of the video.

    I have tried various ways to resave the video but there is no option to save it with audio track 2. It always saves with track 1 only. I would like it in MP4 format.

    Is there a way to achieve this on a Mac?

    Many thanks.
    Quote Quote  
  2. Member
    Join Date
    Aug 2010
    Location
    San Francisco, California
    Search PM
    Code:
    FFmpeg -i xxxx.mkv -map 0 -c:v libx264 -crf 20 -pix_fmt yuv420p -c:a aac -b:a 160k xxxx.mp4
    Quote Quote  
  3. You can use ffmpeg and copy all video and audio tracks (i assume it is h.264 so no need to recode video) and change container from mkv to mp4.

    Code:
    ffmpeg -y -i %1 -map 0 -c copy -movflags faststart -f mp4 %~n1.mp4
    - this example works on Windows commandline without problem. I assume it should work similarly on Mac.

    Alternatively you can map selected video and audio tracks explicitly.

    Code:
    ffmpeg -y -i %1 -map 0:0 -map 0:1 -map 0:2 -c copy -movflags faststart -f mp4 %~n1.mp4
    Detailed explanation for map option: https://trac.ffmpeg.org/wiki/Map
    Last edited by pandy; 24th Nov 2016 at 13:29.
    Quote Quote  
  4. Member
    Join Date
    Nov 2016
    Location
    Greece
    Search Comp PM
    Hi, and thanks for your replies which, unfortunately, I don't understand.
    To be honest, I was hoping for "launch such & such App then select x parameter and click Export" type of instruction.

    I have downloaded FFmpeg for Mac. I've unzipped the folder and dragged it to my Applications folder.
    When I double-click the file labelled "ffmpeg" it launches "Terminal" and opens a window with code and a highlighted instruction to get the manual but it doesn't do anything and nor can I type anything into the window. Key presses are ignored.

    Later:
    I've opened a new terminal window and typed 'man ffmpeg' but it states No manual entry for ffmpeg.

    Quote Quote  
  5. Member
    Join Date
    Aug 2010
    Location
    San Francisco, California
    Search PM
    FFmpeg has no graphical user interface; it is meant to be run only on the command line with all options and parameters supplied. Documentation is here. You can just copy-paste the code I posted above into Terminal, overwrite with the actual filenames you want, and hit ENTER. Or if your MKV already contains h.264/AVC video and AAC audio, then copy-paste
    Code:
    FFmpeg -i xxxx.mkv -map 0 -c copy xxxx.mp4
    Quote Quote  
  6. You could use a two step process:

    1) Use MKVToolnix (there's a GUI version for the Mac) to remux the video and only the audio track you want into a new MKV file (it lets you pick which tracks you want to keep).

    2) Use VLC to remux the tracks from the new MKV to MP4.
    Quote Quote  
  7. Explorer Case's Avatar
    Join Date
    Feb 2004
    Location
    Middle Earth
    Search Comp PM
    ffmpeg is quite powerful tool, but it does require some basic knowledge of using command line tools. And on Mac OS that means using Terminal.app.

    1/ Binaries (the compiled command line tools) on Mac OS can reside anywhere, but if you put it them where Terminal will look for them, then you'll never have to specify the path to the app anymore, which is easier and saves time. A good place is /usr/local/bin/ as the designated repository for 3rd party binaries. ‘usr’ in not visible in the Finder to avoid accidental changes, so open it by using the Go menu in the Finder, then Go to folder, then paste /usr/local/bin/ . Now you can copy the ffmpeg binary there.
    2/ You may specify a working directory in Terminal, like a default folder. Meaning: whenever you specify just a filename (without a path), it will look for it in this working directory. This makes life much easier, as you may be tinkering with one file for multiple operations, or multiple files in the same folder. The command is: cd (for change directory). (Example in combination with #3.)
    3/ Terminal supports drag-and-drop. If you do need to specify a file (or folder) with complete path, then you can drag-and-drop the file (or folder) onto the Terminal window, and Terminal with translate that into the path to that file (or folder). E.g. Type “cd ” (without the quotes, include the trailing space), then drag-and-drop the parent folder for a video file onto the Terminal window. Enter. (Type “ls”. Enter. You should get a listing of the directory contents.)
    4/ Command parameters need to be separated with spaces. Options often are preceded by a dash. If you forget the space separator, then usually it will fail because it became nonsensical. Be sure to be aware of the need for a leading space when you combine drag-and-drop in the commands. As the space is used as a separator, it also means filenames with spaces have to be escaped (e.g. sintel\ 1280\ surround.mp4).
    5/ Mac OS comes a with a set of basic commands. Specialty tools, like video converters, have to be installed separately. Each has their own set of commands, sometimes similar, sometimes not.

    Code:
    ffmpeg -i xxxx.mkv
    This will specify xxxx.mkv as input file for ffmpeg. It will error, because no output is specified, but first ffmpeg will look at it and try to find multimedia characteristics, possibly including a lot of meta data. What you want to know is the stream numbers. Look for “Stream #0:0”, “Stream #0:1”, “Stream #0:2”, etc. Check that #0:0 is video, #0:1 is audio, #0:2 is audio. Look for which tracks have “(default)” on their line. [MKV allows to make certain streams default.]

    Code:
    ffmpeg -y -i xxxx.mkv -map 0:0 -map 0:2 -map 0:1 -c copy -movflags faststart xxxx.mp4
    -y will overwrite the output file (if it exists with the same name), instead of erroring out when a file already exists there.
    -i xxxx.mkv specifies the input file
    -map 0:0 -map 0:2 -map 0:1 specifies the mapping of streams, from input to output. The 0 before the colon (:) points to the first input file. The number after the colon is the stream number. The re-arranged order means the second audio in the source will be the first audio in the output.
    -c copy specifies the same codecs (no transcoding) for output as input
    -movflags faststart runs a second pass to write the index at the beginning of the file (instead of the end)
    -f mp4 specifies the format as MP4. If your output file already has the .mp4 suffix, then this part may be omitted.
    xxxx.mp4 specifies the output. Your user home directory is default, unless otherwise specified previously in that session. Output may optionally include a path.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!