Skip to content

Instantly share code, notes, and snippets.

@l1x

l1x/convert.sh

Last active Apr 25, 2020
Embed
What would you like to do?
Converting MKV or AVI to MP4 (h264, aac)
# with handbrake cli
for i in *.mkv; do
handbrake --preset-import-file fast.json --ab 192 -i "$i" -o "${i%.mkv}".mp4;
done
# or with ffmpeg
for f in *.avi; do
ffmpeg -i "$f" -c:v libx264 -c:a aac "${f%.avi}".mp4;
done
{
"PresetList" : [
{
"AlignAVStart" : true,
"AudioCopyMask" : [
"copy:aac"
],
"AudioEncoderFallback" : "ca_aac",
"AudioLanguageList" : [
],
"AudioList" : [
{
"AudioBitrate" : 160,
"AudioCompressionLevel" : -1,
"AudioDitherMethod" : "auto",
"AudioEncoder" : "ca_aac",
"AudioMixdown" : "stereo",
"AudioNormalizeMixLevel" : false,
"AudioSamplerate" : "auto",
"AudioTrackDRCSlider" : 0,
"AudioTrackGainSlider" : 0,
"AudioTrackQuality" : -1,
"AudioTrackQualityEnable" : false
}
],
"AudioSecondaryEncoderMode" : true,
"AudioTrackSelectionBehavior" : "first",
"ChapterMarkers" : true,
"ChildrenArray" : [
],
"Default" : false,
"FileFormat" : "av_mp4",
"Folder" : false,
"FolderOpen" : false,
"InlineParameterSets" : false,
"Mp4HttpOptimize" : false,
"Mp4iPodCompatible" : false,
"PictureAutoCrop" : true,
"PictureBottomCrop" : 0,
"PictureChromaSmoothCustom" : "",
"PictureChromaSmoothPreset" : "off",
"PictureChromaSmoothTune" : "none",
"PictureCombDetectCustom" : "",
"PictureCombDetectPreset" : "default",
"PictureDARWidth" : 0,
"PictureDeblockCustom" : "strength=strong:thresh=20:blocksize=8",
"PictureDeblockPreset" : "off",
"PictureDeblockTune" : "medium",
"PictureDeinterlaceCustom" : "",
"PictureDeinterlaceFilter" : "decomb",
"PictureDeinterlacePreset" : "default",
"PictureDenoiseCustom" : "",
"PictureDenoiseFilter" : "off",
"PictureDenoisePreset" : "light",
"PictureDenoiseTune" : "none",
"PictureDetelecine" : "off",
"PictureDetelecineCustom" : "",
"PictureForceHeight" : 0,
"PictureForceWidth" : 0,
"PictureHeight" : 1080,
"PictureItuPAR" : false,
"PictureKeepRatio" : true,
"PictureLeftCrop" : 0,
"PictureLooseCrop" : false,
"PictureModulus" : 2,
"PicturePAR" : "auto",
"PicturePARHeight" : 720,
"PicturePARWidth" : 853,
"PictureRightCrop" : 0,
"PictureRotate" : "angle=0:hflip=0",
"PictureSharpenCustom" : "",
"PictureSharpenFilter" : "off",
"PictureSharpenPreset" : "medium",
"PictureSharpenTune" : "none",
"PictureTopCrop" : 0,
"PictureWidth" : 1920,
"PresetDescription" : "H.264 video (up to 1080p30) and AAC stereo audio, in an MP4 container.",
"PresetName" : "Fast 1080p30",
"SubtitleAddCC" : false,
"SubtitleAddForeignAudioSearch" : true,
"SubtitleAddForeignAudioSubtitle" : false,
"SubtitleBurnBDSub" : true,
"SubtitleBurnBehavior" : "foreign",
"SubtitleBurnDVDSub" : true,
"SubtitleLanguageList" : [
],
"SubtitleTrackSelectionBehavior" : "none",
"Type" : 1,
"UsesPictureFilters" : true,
"UsesPictureSettings" : 1,
"VideoAvgBitrate" : 6000,
"VideoColorMatrixCodeOverride" : 0,
"VideoEncoder" : "x264",
"VideoFramerate" : "30",
"VideoFramerateMode" : "pfr",
"VideoGrayScale" : false,
"VideoLevel" : "4.0",
"VideoOptionExtra" : "",
"VideoPreset" : "fast",
"VideoProfile" : "main",
"VideoQSVAsyncDepth" : 4,
"VideoQSVDecode" : false,
"VideoQualitySlider" : 22,
"VideoQualityType" : 2,
"VideoScaler" : "swscale",
"VideoTune" : "",
"VideoTurboTwoPass" : true,
"VideoTwoPass" : true,
"x264Option" : "",
"x264UseAdvancedOptions" : false
}
],
"VersionMajor" : 42,
"VersionMicro" : 0,
"VersionMinor" : 0
}
➜  02 du -ach *.mp4 | tail -1
 24G    total
➜  02 du -ach *.mkv | tail -1
 43G    total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.