- Notifications
You must be signed in to change notification settings - Fork3
Convert BDrip(mkv) to mp4 to make it importable in FCPX. [shell scripts]
License
Yang-Xijie/mkv2mp4_fcp
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This repository provides kinds of shell scrips to help you convert media that may be not well-supported onmacOS
. The most important one ismkv_to_mp4.sh
, converting mkv files with HEVC/AVC and FLAC codec.
Author: Yang-Xijiehttps://github.com/Yang-Xijie
If you want to figure out how to use this script and how to create MAD with the best quality, check serial tutorials onBilibili (Chinese).
Sometimes we want to create our own MAD using great clips in some animation. We download the resources (oftenBDrip
because it's rather smaller thanBDMV
and with great quality) from BT or PT sites or somewhere else. But these files have a containermkv
(often withHEVC
(video) andFLAC
(audio) codec) which is unable to import into FCP (because mkv is not an official container format).
To convertBDrip
, one way is to transcode it. However, toextrat and re-package them into a compatitable continer ismuch more efficient andkeep the original quality. This script is to realize it.
Convert animeBDrip
(withmkv
container format,track 0HEVC
,track 1FLAC
) tomp4
in order to make it importable inFCP
without transcoding (justextract and re-package). (Note: also importable inCompressor
so that you can further convert it to other codecs that are well-supported onmacOS
such asApple Prores
.)
- (Once) Get the script
mkv_to_mp4.sh
: download the zip of this repo / clone this repo / open the script on GitHub and copy the content to a newly created text file and rename it - (Once) Make the script executable: run command
chmod +x mkv_to_mp4.sh
. - (Once) Install the required tools: run command
brew install mkvtoolnix ffmpeg mp4box
. (brew, one of the best package managers for macOS, should be installed before. Run commandbrew update
before installing new packages.) - Change the shell working directory to the folder with mkv files: run command
cd <folder>
. Check the codec of mkv tracks -- this script only supportstrack 0HEVC(h265)
,track 1FLAC
. To convert mkv files withAVC(h264)
codec, change allh265
toh264
in this script.) - Copy the script to the current directory.
- Run the script: run command
./mkv_to_mp4.sh
.
Theoretically commandffmpeg -i <input>.mkv -vcodec copy -acodec alac <output>.mp4
works. But FCP cannot import the<output>.mp4
for its restriction on the description of video codec. (checkStackExchange | Reason for -vtag andApple Developer Documentation | HLS Authoring Specification for Apple Devices | Video 1.10 for more information).
Moreover, if you use commandffmpeg -i <input>.mkv -map 0:0 -map 0:1 -vcodec copy -acodec alac -vtag hvc1 "<output>.mov"
, the frame-rate goes wrong (from 23.98 to 23.81, CFR to VFR). (checkreddit | Framerate issue in fcp (23.98-23.81 FPS) for more information). That ffmpeg doesn't obey standard mp4 boxing might be the reason.
You shouldmake slight adjustment in the script if your media has a codec different frommkv format, track 0 HEVC, track 1 FLAC
.
(after importing mp4 files into FCP) For editing inFCP
, it's better to useApple Prores
to make rendering faster. Chooseproxy
inFCP
if yourMac
lacks performance, or transcode the media toApple Prores 422
.
Notice Import output files (.mp4
) directly intoFCP
because they have the original quality.Don't transcode them using other apps which may decrease the quality. (converting toApple Prores 422 HQ / 422
just slightly decrease quality and it's convenient if you have a workflow with large storage. To learn more, checkApple Prores White Paper.)
Here are some other scripts that convert specific kinds of media.
BDMV
owns the best quality of anime. Convert them to mov in order to import them intoFCP
with the best quality.
ConvertBDMV
anime (with m2ts format, track 0H264/AVC
, track 1PCM
) tomov
in order to make it importable inFCP
without transcoding.
FLAC
is a codec for lossless audio. However,FCP
orCompressor
(and alsoMusic.app
) doesn't support that not-for-industry audio codec.
ALAC
is a codec for lossless audio designed byApple
. So it has a great support inmacOS
.
The function of this script is to convertFLAC
file (with a suffix.flac
) toALAC
(with a suffix.m4a
).
You may think commandffmpeg -i song.flac -acodec alac song.m4a
orffmpeg -i song.flac song.m4a
is enough. But unfortunately sometimes it fails. CheckStack Overflow for details.
- English is not my native language; please excuse typing errors. Suggestions on my expression is welcome!
- Any advice or discussion will be appreciated!
About
Convert BDrip(mkv) to mp4 to make it importable in FCPX. [shell scripts]