Source to my personal site: https://denshi.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

36 lines
2.2 KiB

<!DOCTYPE html>
<html lang="en">
<head>
<title>cvrt: FFMPEG, made slightly easier</title>
<link rel='stylesheet' type='text/css' href='../style.css'>
<meta charset='utf-8'/>
</head>
<body>
<h1>cvrt: FFMPEG, made slightly easier</h1>
<p class='date'>Mon, 22 Nov 2021 08:29:06 +0400</p>
<p>If you've been using Linux for a few days now, you're probably already aware of the swiss-army knife of media conversion and compression: <a href="https://ffmpeg.org">FFMPEG.</a> It's often pre-installed on most Linux distros, and it offers a simple command-line way of converting between all (most) media formats.</p>
<p><b>However,</b> despite its compatibility and ubiquity, I've always felt FFMPEG doesn't do enough to handle repetitive, batch-like conversions using regular expressions. <b>For example:</b> imagine you had a file full of <b>mp4</b> files, and you wanted to convert each of them to <b>mov.</b> With cvrt, you can run the following command:</p>
<pre><code>cvrt *.mp4 mov</code></pre>
<p>All this script does is take two arguments: the input files (*.mp4), and the last argument passed, which is the output format/file (mov). Another useful feature of cvrt is the fact you can specify cases for outputs. <b>For example:</b> if I wanted each mov file to be in a specific audio and video codec (ie. for DaVinci Resolve), then you can specify it in the script:</p>
<pre><code># Exception options for specific formats
case "$ext" in
*flac) OPT=$OPT:" -vn" ;;
*mov) OPT=$OPT:" -c:v mpeg4 -q:v 0 -pix_fmt yuv420p -c:a pcm_s16le" ;;
*mp4) OPT=$OPT:" -c:v libx264 -crf 21 -c:a libopus -b:a 320k" ;;
esac</code></pre>
<p>In this case, there are cases for <b>flac, mov</b> and <b>mp4</b> output files, to ensure the resulting files always come out with specific codecs, using FFMPEG flags.</p>
<h3><a href="https://gitlab.com/diamondop1234/DenshiDots/-/blob/master/user/.local/bin/cvrt">Download cvrt from my dotfiles.</a></h3>
<small><i>*the script is still a WIP, not every bug has been fixed yet. If you have any suggestions, feel free to contact me or open an issue on GitLab!</i></small>
<footer>by <strong><a href='https://denshi.org/'>Denshi</a> <a href="mailto:alex@denshi.org?subject=cvrt: FFMPEG, made slightly easier">(Reply-to)</a></strong></footer>
</body>
</html>