-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
default config and gitignore dry run added
- Loading branch information
Showing
4 changed files
with
36 additions
and
7 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
data | ||
config | ||
processed_files |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,9 @@ UNSUPPORTED_GFORMATS=('BDAV' 'AVI' 'Flash Video' 'DivX') | |
SUPPORTED_VCODECS=('AVC' 'VP8') | ||
UNSUPPORTED_VCODECS=('MPEG-4 Visual' 'xvid' 'MPEG Video' 'HEVC') | ||
|
||
SUPPORTED_VFPROFILE=('[email protected]' 'High@L4' '[email protected]') | ||
UNSUPPORTED_VFPROFILE=('High 10@L5') | ||
|
||
SUPPORTED_ACODECS=('AAC' 'MPEG Audio' 'Vorbis' 'Ogg' 'Opus') | ||
UNSUPPORTED_ACODECS=('AC-3' 'DTS' 'E-AC-3' 'PCM' 'TrueHD' 'FLAC') | ||
|
||
|
@@ -44,7 +47,7 @@ in_array() { | |
} | ||
|
||
print_help() { | ||
echo "Usage: chromecastize.sh [--mp4 | --mkv | --stereo | --force-vencode | --force-aencode | --config=/path/to/config/] <videofile1> [videofile2 ...]" | ||
echo "Usage: chromecastize.sh [--mp4 | --mkv | --stereo | --force-vencode | --force-aencode | --dry-run | --config=/path/to/config/] <videofile1> [videofile2 ...]" | ||
} | ||
|
||
unknown_codec() { | ||
|
@@ -78,6 +81,17 @@ is_supported_vcodec() { | |
fi | ||
} | ||
|
||
is_supported_vfprofile() { | ||
if in_array "$1" "${SUPPORTED_VFPROFILE[@]}"; then | ||
return 0 | ||
elif in_array "$1" "${UNSUPPORTED_VFPROFILE[@]}"; then | ||
return 1 | ||
else | ||
unknown_codec "$1" | ||
exit 1 | ||
fi | ||
} | ||
|
||
is_supported_acodec() { | ||
# Support for multichannel AAC audio has been removed in firmware 1.28. | ||
# Ref. https://issuetracker.google.com/issues/69112577#comment4 | ||
|
@@ -168,7 +182,7 @@ process_file() { | |
|
||
INPUT_VCODEC=`$MEDIAINFO --Inform="Video;%Format%\n" "$FILENAME" 2> /dev/null | head -n1` | ||
ENCODER_OPTIONS="" | ||
if is_supported_vcodec "$INPUT_VCODEC" && [ -z "$FORCE_VENCODE" ]; then | ||
if is_supported_vcodec "$INPUT_VCODEC" && is_supported_vfprofile "$INPUT_VCODEC_PROFILE" [ -z "$FORCE_VENCODE" ]; then | ||
OUTPUT_VCODEC="copy" | ||
else | ||
OUTPUT_VCODEC="$DEFAULT_VCODEC" | ||
|
@@ -205,7 +219,13 @@ process_file() { | |
# Make sure the encoder options are not escaped with quotes. | ||
IFS=' ' read -r -a ENCODER_OPTIONS_ARRAY <<< "$ENCODER_OPTIONS" | ||
|
||
$FFMPEG -loglevel error -stats -i "$FILENAME" -map 0 -scodec copy -vcodec "$OUTPUT_VCODEC" -acodec "$OUTPUT_ACODEC" ${ENCODER_OPTIONS_ARRAY[@]} "$FILENAME.$OUTPUT_GFORMAT" && on_success "$FILENAME" "$DESTINATION_FILENAME" || on_failure "$FILENAME" | ||
COMMAND="$FFMPEG -loglevel error -stats -i "$FILENAME" -map 0 -scodec copy -vcodec "$OUTPUT_VCODEC" -acodec "$OUTPUT_ACODEC" ${ENCODER_OPTIONS_ARRAY[@]} "$FILENAME.$OUTPUT_GFORMAT" && on_success "$FILENAME" "$DESTINATION_FILENAME" || on_failure "$FILENAME"" | ||
|
||
if [ -z $DRY_RUN ]; then | ||
eval $COMMAND | ||
else | ||
echo $COMMAND | ||
fi | ||
echo "" | ||
fi | ||
} | ||
|
@@ -263,6 +283,9 @@ while :; do | |
--stereo) | ||
STEREO=1 | ||
;; | ||
--dry-run) | ||
DRY_RUN=1 | ||
;; | ||
--config=?*) | ||
CONFIG_DIRECTORY=${1#*=} | ||
;; | ||
|
@@ -315,8 +338,8 @@ if ! [ -w "$CONFIG_DIRECTORY" ]; then | |
fi | ||
|
||
# Load default configuration if it exists. | ||
if [ -f "$CONFIG_DIRECTORY/config.sh" ]; then | ||
. "$CONFIG_DIRECTORY/config.sh" | ||
if [ -f "$CONFIG_DIRECTORY/config" ]; then | ||
. "$CONFIG_DIRECTORY/config" | ||
fi | ||
|
||
# Ensure that the processed file list exists and is writeable. | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,7 +106,7 @@ | |
# Option to recode multichannel audio to stereo. Use this if you have problems | ||
# playing multichannel audio on your device, or if you do not have a surround | ||
# setup. | ||
# STEREO=1 | ||
#STEREO=1 | ||
|
||
# What to do on successful conversion? | ||
# Options are: | ||
|
@@ -128,6 +128,7 @@ | |
#SUPPORTED_GFORMATS=('MPEG-4' 'Matroska' 'WebM') | ||
#DEFAULT_GFORMAT=mkv | ||
#SUPPORTED_VCODECS=('AVC' 'VP8') | ||
#SUPPORTED_VFPROFILE=('[email protected]' 'High@L4' '[email protected]') | ||
#DEFAULT_VCODEC=h264 | ||
#DEFAULT_VCODEC_OPTS="-preset fast -profile:v high -level 4.2 -crf 17 -pix_fmt yuv420p" | ||
#SUPPORTED_ACODECS=('AAC' 'MPEG Audio' 'Vorbis' 'Ogg' 'Opus') | ||
|