Last active
October 18, 2024 16:51
-
-
Save kevinwright/24baf2470d4fbd1d12b5cd1118e7d680 to your computer and use it in GitHub Desktop.
Use ffmpeg to build prores proxies for Premiere Pro
This file contains 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
#!/usr/bin/env bash | |
# Usage notes | |
# =========== | |
# | |
# proxy_watermark.png needs to be in the same directory as the script | |
# download from here: http://whoismatt.com/images/2016/7-july/adobe_proxy_logo.png | |
# | |
# on OSX, both pv and ffmpeg will need to be installed via homebrew | |
scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
inputfile=$1 | |
nakedname="${inputfile%.*}" | |
ext="${inputfile##*.}" | |
outputfile="Proxies/${nakedname}-proxy.${ext}" | |
echo "outputfile = $outputfile" | |
mkdir -p Proxies | |
# find input resolution | |
# ===================== | |
# input aspects: | |
# cine 4K = 4096:2160 (1.9:1 = 1.896) - proxy at 1024:540 | |
# UHD(4K) = 3840:2160 (16:9 = 1.777) - proxy at 720p | |
# 1080p = 1920:1080 (16:9 = 1.777) - proxy at 720p | |
# 720p = 1280:720 (16:9 = 1.777) | |
# | |
# proxy aspects: | |
# 1024x540 = 1.9:1 | |
# 1280x720 = 16:9 | |
# 1536x790 = ??? (1.944) | |
eval $(ffprobe -v error -of flat=s=_ -select_streams v:0 -show_entries stream=height,width $inputfile) | |
inputres=${streams_stream_0_width}:${streams_stream_0_height} | |
#TODO: make this 1024:540 if source is C4K | |
outputres="1280:720" | |
echo "inputres = $inputres" | |
echo "outputres = $outputres" | |
# EXPLANATION | |
# =========== | |
# | |
# pv = pipeview, shows progress and estimated time | |
# | |
# -v warning turn down verbosity to only warnings | |
# | |
# -profile:v N | |
# where N = 0 -> proxy 1 -> lt 2 -> std 3 -> hq | |
# | |
# -i logo.png = a SECOND input file, with an overlay image | |
# -filter_complex "overlay=W-w-5:H-h-5/2" = make an overlay, position 5px from bottom-right | |
# | |
pv $inputfile | ffmpeg \ | |
-loglevel warning \ | |
-i pipe:0 \ | |
-i "$scriptdir/proxy_watermark.png" \ | |
-filter_complex "[0:v]scale=$outputres, overlay=W-w-5:H-h-5/2" \ | |
-codec:a copy \ | |
-codec:v prores \ | |
-profile:v 0 \ | |
"$outputfile" | |
Hi @kevinwright
I have problem with run script on MacStudio
I install ffmpeg and pv with homebrew.
I try run script in specify folder sudo /Volumes/6TB\ HDD\ Venom/ResilioSync/prores/proresproxy.sh
but it says:
sudo: /Volumes/6TB HDD Venom/ResilioSync/prores/proresproxy.sh: command not found
Hi @anjszulc
If you copy/pasted the file then you probably haven't flagged it as being executable.
You can do that with
chmod +x /Volumes/6TB\ HDD\ Venom/ResilioSync/prores/proresproxy.sh
I've also updated the gist to quote filenames in a couple of places where it would have got confused by spaces in the script path
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Oops, sorry I didn't catch that! And also, thanks for making this script-- an excellent idea IMO. For my use case I'm having to make a few modifications:
[mp4 @ 0x7fa645812200] Could not find tag for codec prores in stream #0, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:0 --
Conversion failed!
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fe14f806800] stream 1, offset 0x24: partial file
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fe14f806800] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none(bt709), 1280x720, 7392 kb/s): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fe14f806800] stream 1, offset 0x24: partial file
pipe:0: Invalid data found when processing input
Cannot determine format of input stream 0:0 after EOF
Error marking filters as finished