Last active
February 3, 2026 20:21
-
-
Save dacr/c33bfc163943371d9b662e8be026d0e3 to your computer and use it in GitHub Desktop.
Converts CANON 5D mark IV 4K mov (yuvj422p) files in the current directory to MP4 (yuv420p) / published by https://github.com/dacr/code-examples-manager #2da6b78e-ae05-4460-853a-e4abf0e245dd/799e19961e49a5377619bad2d18db7be78b56df7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## summary : Converts CANON 5D mark IV 4K mov (yuvj422p) files in the current directory to MP4 (yuv420p) | |
| ## keywords : bash, ffmpeg, canon, 5DMarkIV, yuvj422p | |
| ## publish : gist | |
| ## authors : David Crosson | |
| ## license : Apache License Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) | |
| ## id : 2da6b78e-ae05-4460-853a-e4abf0e245dd | |
| ## created-on : 2025-05-11T10:08:56+02:00 | |
| ## managed-by : https://github.com/dacr/code-examples-manager | |
| ## run-with : sh $file | |
| # FFmpeg conversion options: | |
| # -c:v libx264 : Use H.264 video codec for video stream | |
| # -c:a copy : Copy audio stream without re-encoding | |
| # -vf format=yuv420p : Convert to YUV420P color space (better compatibility) | |
| # -movflags +faststart : Optimize for web streaming by moving metadata to front | |
| # Enable case-insensitive globbing | |
| shopt -s nocaseglob | |
| for INPUT in *.mov; do | |
| # Extract the extension with its original case | |
| EXT="${INPUT##*.}" | |
| # Create output filename by replacing the original extension | |
| OUTPUT=$(basename "$INPUT" ".$EXT").mp4 | |
| echo "=====================================================================" | |
| echo "-- converting '$INPUT' to '$OUTPUT'" | |
| echo "---------------------------------------------------------------------" | |
| if [ ! -f "$OUTPUT" ]; then | |
| ffmpeg \ | |
| -i "$INPUT" \ | |
| -c:v libx264 -c:a copy \ | |
| -vf format=yuv420p \ | |
| -movflags +faststart \ | |
| "$OUTPUT" | |
| else | |
| echo "Output file '$OUTPUT' already exists, skipping." | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment