Created
September 4, 2025 14:26
-
-
Save victorlhlam/787b91547497155de83ed9a45d049b8e to your computer and use it in GitHub Desktop.
Shell Script to Encode DJI Mavic 4 Pro ALL-I 6K video to ProRes
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
| #!/bin/bash | |
| # Create Exported directory if it doesn't exist | |
| mkdir -p Exported | |
| # Check if --file parameter is provided | |
| if [[ "$1" == "--file" && -n "$2" ]]; then | |
| # Use only the specified file | |
| mp4_files=("$2") | |
| single_file_mode=true | |
| else | |
| shopt -s nullglob nocaseglob | |
| mp4_files=(*.mp4) | |
| shopt -u nocaseglob | |
| single_file_mode=false | |
| fi | |
| if [ ${#mp4_files[@]} -eq 0 ]; then | |
| if [ "$single_file_mode" = true ]; then | |
| echo "File not found: $2" | |
| else | |
| echo "No MP4 files found." | |
| fi | |
| exit 0 | |
| fi | |
| for file in "${mp4_files[@]}"; do | |
| if [ ! -f "$file" ]; then | |
| echo "File not found: $file" | |
| continue | |
| fi | |
| # ffprobe: get profile and pix_fmt, one per line | |
| ffprobe_output=$(ffprobe -v error -select_streams v:0 -show_entries stream=profile,pix_fmt -of default=noprint_wrappers=1:nokey=1 "$file") | |
| # Check if BOTH keywords exist in the output | |
| if echo "$ffprobe_output" | grep -q "High 4:2:2 Intra" && echo "$ffprobe_output" | grep -q "yuv422p10le"; then | |
| echo "Converting $file (ALL-I, High 4:2:2 Intra, yuv422p10le)..." | |
| out="Exported/${file%.*}_prores422hq.mov" | |
| ffmpeg -y -i "$file" -c:v prores_ks -profile:v 3 -pix_fmt yuv422p10le -c:a pcm_s16le -map_metadata 0 "$out" | |
| echo "Saved: $out" | |
| else | |
| echo "Skipping $file (Not ALL-I or different format)" | |
| fi | |
| done | |
| echo "All done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment