Skip to content

Instantly share code, notes, and snippets.

@mslinn
Last active July 6, 2020 02:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mslinn/5d53c4ab21fe2fe6e5b8a66621502320 to your computer and use it in GitHub Desktop.
Save mslinn/5d53c4ab21fe2fe6e5b8a66621502320 to your computer and use it in GitHub Desktop.
Convert later versions of Adobe Premiere Pro .prproj files to CS6
#!/bin/bash
# Not tested on MacOS, only tested on Ubuntu (& WSL) converting to CS6
# See https://forums.adobe.com/thread/2553496?red=a
# .prproj files are actually gzips.
#
# 1 - If converting from PPro CC, extract contents (just one file, without a filetype).
# 2 - For converting to PPro CS6, MUST change this line to read Version="25"; for converting to earlier versions the value could be Version="1":
# <Project ObjectID="1" ClassID="62ad66dd-0dcd-42da-a660-6d8fbde94876" Version="35">
# 3 - If converting to PPro CC, Create a new .prproj gzip file from the modified file.
# PPro version numbers:
# CS5 - 23
# CS5.5 - 24
# CS6 - 25
# CC - 26
# CC 2014 - 27
# CC 2015.1 - 29
# CC 2015.2 - 30
# CC 2017 - 32
# CC 2018.1 - 33
# CC 2018.2 - 34
# TODO convert from/to older versions (.ppro filetype)
function help {
echo 'Convert Premiere Pro project files between versions of Adobe Premiere Pro
Converts all .prproj or files in current directory.
The original .prproj and .ppro files are not modified
The file name of the new converted files ends with "_CS6.prproj".
'
exit -1
}
# Updates $1 to $PP_TO_VERSION_NUMBER
function updateVersionNumber {
sed -E -i'' "/$GUID/{s/Version=\"[0-9]\+\"/Version=\"$PP_TO_VERSION_NUMBER\"/}" "$1"
}
# Work with an uncompressed file
function fromCS {
PRPROJ_NEW="${PRPROJ_FN}_${PP_TO_VERSION}.prproj"
cp "$1" "$PRPROJ_NEW" # Make a copy of the prproj file
updateVersionNumber "$PRPROJ_NEW"
}
# Work with gzipped file
function fromCC {
cp "$1" "$TMP/${PRPROJ_FN}.gz" # Work on a copy of the prproj file in /tmp with .gz filetype
cd "$TMP"
gunzip -d "${PRPROJ_FN}.gz" # Extracted file name has no file type
updateVersionNumber "$PRPROJ_FN" # Update version number
}
# Return true if PPro version of $1 is >=26 (First version of CC)
function FROM_IS_COMPRESSED {
if [ "$( file "$1" | grep gzip )" ]; then
echo true
else
echo false
fi
}
# Work with gzipped file
# $COMPRESSED is true if converting from CC
function toCC {
gzip -S _${PP_TO_VERSION}.${PP_TYPE} "$PRPROJ_FN"
if "$COMPRESSED"; then cd -; fi
mv "$TMP/${PRPROJ_FN}_${PP_TO_VERSION}.${PP_TYPE}" .
}
export PP_TO_VERSION=CS6
export PP_TO_VERSION_NUMBER=25
export TMP=/tmp
export PP_TYPE=prproj
export GUID="62ad66dd-0dcd-42da-a660-6d8fbde94876"
set -xv
for PRPROJ in *.$PP_TYPE; do
export PRPROJ_FN="${PRPROJ%.*}" # Get file name without file type
export COMPRESSED="$( FROM_IS_COMPRESSED "PRPROJ" )"
if "$COMPRESSED"; then
fromCC "$PRPROJ"
toCC
else
fromCS "$PRPROJ"
# No need to compress so we are done
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment