Advertisement
gadgeteerza

Convert MP4 to MOV for DaVinci

Sep 30th, 2024
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.78 KB | Source Code | 0 0
  1. #!/bin/bash
  2.  
  3. # Check if an input file is provided
  4. if [[ $# -eq 0 ]]; then
  5.   echo "Usage: $0 <input_mp4_file> [framerate]"
  6.   exit 1
  7. fi
  8.  
  9. # Get the input file name
  10. input_file=$1
  11.  
  12. # Get the framerate (default to 30 if not provided)
  13. framerate=${2:-30}
  14.  
  15. # Validate the framerate
  16. if [[ "$framerate" != "30" && "$framerate" != "60" ]]; then
  17.   echo "Invalid framerate. Must be 30 or 60."
  18.   exit 1
  19. fi
  20.  
  21. # Get the output file name (same as input but with .mov extension)
  22. output_file="${input_file%.mp4}.mov"
  23.  
  24. # Use ffmpeg to convert the MP4 file to MOV with the specified framerate
  25. ffmpeg -i "$input_file" -vcodec dnxhd -acodec pcm_s16le \
  26.   -s 1920x1080 -r "$framerate" -b:v 36M -pix_fmt yuv422p \
  27.   -f mov "$output_file"
  28.  
  29. echo "Conversion completed. Output file: $output_file"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement