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?
+ Reply to Thread
Results 1 to 7 of 7
FFmpeg -i xxxx.mkv -map 0 -c:v libx264 -crf 20 -pix_fmt yuv420p -c:a aac -b:a 160k xxxx.mp4
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.
ffmpeg -y -i %1 -map 0 -c copy -movflags faststart -f mp4 %~n1.mp4
Alternatively you can map selected video and audio tracks explicitly.
ffmpeg -y -i %1 -map 0:0 -map 0:1 -map 0:2 -c copy -movflags faststart -f mp4 %~n1.mp4
Last edited by pandy; 24th Nov 2016 at 13:29.
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.
I've opened a new terminal window and typed 'man ffmpeg' but it states No manual entry for ffmpeg.
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
FFmpeg -i xxxx.mkv -map 0 -c copy xxxx.mp4
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.
ffmpeg -i xxxx.mkv
ffmpeg -y -i xxxx.mkv -map 0:0 -map 0:2 -map 0:1 -c copy -movflags faststart xxxx.mp4
-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.