for file in *.mkv; do ffmpeg -i "$file" -c:v libx264 -crf 20 -preset medium -c:a aac -b:a 192k "$file%.*.mp4"; done Use code with caution. 3. Best Practices for Media Compression and Quality