Projects
Multimedia
ffx264
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 15
View file
ffx264.changes
Changed
@@ -1,4 +1,20 @@ ------------------------------------------------------------------- +Thu Nov 10 21:15:00 UTC 2016 - neutrino8@opensuse.org + +- Update to version 3.1.4 + * Check if name of input file matches that of output file and warn + and exit. Requires the realpath utility + * Added support for the m2ts, mts, ts and flv containers + * Merged the code that checks if an audio codec is supported by a + container with that that checks for additional output containers. + Removes code duplication and maintainability + * Update to the audio sample rates. Sync them with + ffmpeg -h encoder=<encoder> + * Restrict TrueHD channels to 2, 5 and 6 as that's what the encoder + currently supports + * Updated the README file + +------------------------------------------------------------------- Wed Nov 09 07:00:00 UTC 2016 - neutrino8@opensuse.org - Update to version 3.1.3
View file
ffx264.spec
Changed
@@ -17,7 +17,7 @@ Name: ffx264 -Version: 3.1.3 +Version: 3.1.4 Release: 0 Summary: A small shell script for encoding to H.264 with ffmpeg License: GPL-2.0+
View file
ffx264-3.1.3.tar.gz/ChangeLog -> ffx264-3.1.4.tar.gz/ChangeLog
Changed
@@ -1,3 +1,15 @@ +2016-11-10 - ffx264 3.1.4 + * Check if name of input file matches that of output file and warn + and exit. Requires the realpath utility + * Added support for the m2ts, mts, ts and flv containers + * Merged the code that checks if an audio codec is supported by a + container with that that checks for additional output containers. + Removes code duplication and maintainability + * Update to the audio sample rates. Sync them with ffmpeg -h encoder=<encoder> + * Restrict TrueHD channels to 2, 5 and 6 as that's what the encoder + currently supports + * Updated the README file + 2016-11-09 - ffx264 3.1.3 * Renamed config var CON to CONFMT. Updates config file version to 25 * Reduced some duplication in the audio codec checks for the container
View file
ffx264-3.1.3.tar.gz/README -> ffx264-3.1.4.tar.gz/README
Changed
@@ -27,7 +27,7 @@ - it supports cover art for the MKV container. - it supports the x264 presets and tune profiles. - it supports custom written preset files. -- it can output to more than one container. +- it can output to more than one container format. Parameters:
View file
ffx264-3.1.3.tar.gz/ffx264 -> ffx264-3.1.4.tar.gz/ffx264
Changed
@@ -2,8 +2,8 @@ # # Small script to encode to H.264/AVC video using FFmpeg and libx264. # Author: Grozdan "microchip" Nikolov <neutrino8@opensuse.org> -# Version: 3.1.3 -# Date: 2016-11-09 +# Version: 3.1.4 +# Date: 2016-11-10 # # ffx264 is free software ; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -23,7 +23,7 @@ brown() { echo -e "\e[0;33m$1\e[0;39;49m"; } error() { echo -e "\e[1;31m$1\e[0;39;49m"; } -version="3.1.3" +version="3.1.4" CFG="$HOME/.ffx264" cfgversion="25" @@ -372,13 +372,29 @@ CONFMT="$(echo "$CONFMT" | tr '[:upper:]' '[:lower:]')" + OUTPUT="$OUTPUT.$CONFMT" + + if [ -x "$(which realpath 2>/dev/null)" ]; then + if [ "$(realpath -s "$input")" = "$(realpath -s "$OUTPUT")" ]; then + error "-> Input file matches output file!" + exit 1 + fi + fi + + if [ -e "$OUTPUT" ]; then + echo + error "-> Renaming existing file to '$OUTPUT.old'" + echo + mv -f "$OUTPUT" "$OUTPUT.old" + fi + case "$CONFMT" in - mp4|m4v|mov) movflags="-movflags +faststart" ;; - avi) annexb="-bsf:v h264_mp4toannexb" ;; - mkv) true ;; + mp4|m4v|mov) movflags="-movflags +faststart" ;; + avi|m2ts|mts|ts) annexb="-bsf:v h264_mp4toannexb" ;; + mkv|flv) true ;; *) error "-> H.264 video not supported by chosen container!" - error "-> Supported containers are: mkv, mp4, mov, m4v and avi" + error "-> Supported containers are: mkv, mp4, mov, m4v, m2ts, mts, ts, flv and avi" error "-> Check your config file, if needed, in '$CFG'" exit 1 ;; @@ -387,24 +403,25 @@ printf "Output to Additional Container Formats? [y/N]: " read acf if [ "$acf" = "y" -o "$acf" = "Y" ]; then - printf "Specify the Container Formats [example: mp4,mov,avi - press 'Enter' to skip]: " + printf "Specify the Container Formats [example: mp4,m2ts,mov - press 'Enter' to skip]: " read econ test ! -z "$econ" && extracon="$(echo "$econ" | sed 's|,| |g' | tr '[:upper:]' '[:lower:]')" if [ ! -z "$extracon" ]; then container_func() { case "$1" in - mp4|mov|m4v|avi) + mp4|mov|m4v|avi|flv) green "-> Note: additional container $i supports the following audio codecs:" ;; esac case "$1" in - mp4) green "-> ac3|eac3|dts|aac|fdk-aac|mp3|vorbis|copy|nosound" ;; - mov) green "-> ac3|eac3|dts|aac|fdk-aac|mp3|vorbis|flac|copy|nosound" ;; - m4v) green "-> ac3|aac|fdk-aac|copy|nosound" ;; - avi) green "-> ac3|eac3|dts|aac|fdk-aac|mp3|vorbis|pcm|flac|copy|nosound" ;; + mp4) green "-> ac3|eac3|dts|aac|fdk-aac|mp3|vorbis|copy|nosound" ;; + mov) green "-> ac3|eac3|dts|aac|fdk-aac|mp3|vorbis|flac|copy|nosound" ;; + m4v) green "-> ac3|aac|fdk-aac|copy|nosound" ;; + avi) green "-> ac3|eac3|dts|aac|fdk-aac|mp3|vorbis|pcm|flac|copy|nosound" ;; + flv) green "-> aac|fdk-aac|mp3|copy|nosound" ;; other) error "-> H.264 video not supported by the $i container!" - error "-> Supported containers are: mkv, mp4, mov, m4v and avi" + error "-> Supported containers are: mkv, mp4, mov, m4v, m2ts, mts, ts, flv and avi" echo exit 1 ;; @@ -418,7 +435,13 @@ fi echo case "$i" in - mkv) green "-> Note: additional container $i supports all the audio codecs" ;; + mkv|m2ts|mts|ts) + green "-> Note: additional container $i supports all the audio codecs" + ;; + flv) + container_func flv + error "-> Note: you may need to resample the audio to 44100, 22050 or 11025 Hz!" + ;; mp4) container_func mp4 ;; mov) container_func mov ;; m4v) container_func m4v ;; @@ -430,10 +453,6 @@ fi fi - OUTPUT="$OUTPUT.$CONFMT" - - test -e "$OUTPUT" && mv -f "$OUTPUT" "$OUTPUT.old" - METATITLE="-metadata title=\"$(basename "${OUTPUT%.*}")\" -metadata:s:v:0 title=\"$(basename "${OUTPUT%.*}")\"" fi @@ -1197,34 +1216,49 @@ ;; esac - case "$CONFMT" in - mp4) - case "${acodec[i]}" in - pcm|opus|flac|truehd) asupport[i]="0" ;; - esac - ;; - mov) - case "${acodec[i]}" in - pcm|opus|truehd) asupport[i]="0" ;; - esac - ;; - m4v) - case "${acodec[i]}" in - eac3|dts|vorbis|flac|pcm|opus|truehd) asupport[i]="0" ;; - esac - ;; - avi) - case "${acodec[i]}" in - opus|truehd) asupport[i]="0" ;; - esac - ;; - esac - - if [ ! -z "${asupport[i]}" ]; then - error "-> ${acodec[i]} audio is not supported by the $CONFMT container!" - error "-> Check your config file, if needed, in '$CFG'" + conerror_func() { + test -z "${acodec[i]}" && audcodec[i]="ac3" || audcodec[i]="${acodec[i]}" + if [ ! -z "$extracon" ]; then + error "-> Additional container $c does not support ${audcodec[i]} audio!" + else + error "-> The $c container does not support ${audcodec[i]} audio!" + error "-> Check your config file, if needed, in '$CFG'" + fi + error "-> See: https://en.wikipedia.org/wiki/Comparison_of_video_container_formats" exit 1 - fi + } + + # mkv/m2ts/mts/ts are missing from the list since they + # support all the audio codecs supported by the script + for c in $CONFMT $extracon; do + case "$c" in + mp4) + case "${acodec[i]}" in + pcm|opus|flac|truehd) conerror_func ;; + esac + ;; + mov) + case "${acodec[i]}" in + pcm|opus|truehd) conerror_func ;; + esac + ;; + m4v) + case "${acodec[i]}" in + eac3|dts|vorbis|flac|pcm|opus|truehd) conerror_func ;; + esac + ;; + avi) + case "${acodec[i]}" in + opus|truehd) conerror_func ;; + esac + ;; + flv) + case "${acodec[i]}" in + ac3|eac3|dts|vorbis|flac|opus|truehd|"") conerror_func ;; + esac + ;; + esac + done if [ "${acodec[i]}" != "copy" ]; then case "${acodec[i]}" in @@ -1275,9 +1309,11 @@ esac case "${acodec[i]}" in - ac3|eac3|truehd|dts|"") chanrange[i]="1-6"; defchan[i]="6" ;; + ac3|eac3|"") chanrange[i]="1-6"; defchan[i]="6" ;; aac|opus|vorbis|flac|pcm) chanrange[i]="1-8"; defchan[i]="8" ;; mp3) chanrange[i]="1-2"; defchan[i]="2" ;; + truehd) chanrange[i]="2/5/6"; defchan[i]="6" ;; + dts) chanrange[i]="1/2/4/5/6"; defchan[i]="6" ;; fdk*) case "${aacprof[i]}" in aac_low|aac_he) chanrange[i]="1-8"; defchan[i]="8" ;; @@ -1305,19 +1341,27 @@ esac case "${acodec[i]}" in - ac3|eac3|truehd|"") + ac3|eac3|"") case "${ach[i]}" in [1-6]) true ;; *) case "${acodec[i]}" in ac3|"") error "-> AC-3 supports only 1-6 channels!" ;; eac3) error "-> E-AC-3 encoder in ffmpeg supports only 1-6 channels!" ;; - truehd) error "-> TrueHD encoder in ffmpeg supports only 1-6 channels!" ;; esac exit 1 ;; esac ;; + truehd) + case "${ach[i]}" in + 2|5|6) true ;; + *) + error "-> TrueHD encoder in ffmpeg supports only 2, 5 and 6 channels!" + exit 1 + ;; + esac + ;; dts) case "${ach[i]}" in 1|2|4|5|6) true ;; @@ -1388,10 +1432,10 @@ error "-> Track $i: could not detect the audio sample rate!" fi echo + brown " Supported Sample Rates" + brown " ~~~~~~~~~~~~~~~~~~~~~~" case "${acodec[i]}" in - mp3|ac3|eac3|dts|"") - brown " Supported Sample Rates" - brown " ~~~~~~~~~~~~~~~~~~~~~~" + ac3|eac3|"") echo " 0 -> 32000 Hz" echo " 1 -> 44100 Hz" echo " 2 -> 48000 Hz" @@ -1408,14 +1452,12 @@ ;; esac ;; - aac|fdk*|flac) - brown " Supported Sample Rates" - brown " ~~~~~~~~~~~~~~~~~~~~~~" - echo " 0 -> 8000 Hz 5 -> 24000 Hz 10 -> 88200 Hz" - echo " 1 -> 11025 Hz 6 -> 32000 Hz 11 -> 96000 Hz" + mp3|dts) + echo " 0 -> 8000 Hz 5 -> 24000 Hz" + echo " 1 -> 11025 Hz 6 -> 32000 Hz" echo " 2 -> 12000 Hz 7 -> 44100 Hz" echo " 3 -> 16000 Hz 8 -> 48000 Hz" - echo " 4 -> 22050 Hz 9 -> 64000 Hz" + echo " 4 -> 22050 Hz" echo printf "Track $i: Specify the Audio Sample Rate option [default is 8]: " read arate[i] @@ -1429,9 +1471,61 @@ 6) audhz[i]="32000" ;; 7) audhz[i]="44100" ;; 8|"") audhz[i]="48000" ;; - 9) audhz[i]="64000" ;; - 10) audhz[i]="88200" ;; - 11) audhz[i]="96000" ;; + *) + error "-> Invalid option!" + exit 1 + ;; + esac + ;; + aac|fdk*) + echo " 0 -> 7350 Hz 5 -> 22050 Hz 10 -> 64000 Hz" + echo " 1 -> 8000 Hz 6 -> 24000 Hz 11 -> 88200 Hz" + echo " 2 -> 11025 Hz 7 -> 32000 Hz 12 -> 96000 Hz" + echo " 3 -> 12000 Hz 8 -> 44100 Hz" + echo " 4 -> 16000 Hz 9 -> 48000 Hz" + echo + printf "Track $i: Specify the Audio Sample Rate option [default is 9]: " + read arate[i] + case "${arate[i]}" in + 0) audhz[i]="7350" ;; + 1) audhz[i]="8000" ;; + 2) audhz[i]="11025" ;; + 3) audhz[i]="12000" ;; + 4) audhz[i]="16000" ;; + 5) audhz[i]="22050" ;; + 6) audhz[i]="24000" ;; + 7) audhz[i]="32000" ;; + 8) audhz[i]="44100" ;; + 9|"") audhz[i]="48000" ;; + 10) audhz[i]="64000" ;; + 11) audhz[i]="88200" ;; + 12) audhz[i]="96000" ;; + *) + error "-> Invalid option!" + exit 1 + ;; + esac + ;; + flac) + echo " 0 -> 8000 Hz 4 -> 32000 Hz 8 -> 96000 Hz" + echo " 1 -> 16000 Hz 5 -> 44100 Hz 9 -> 176400 Hz" + echo " 2 -> 22050 Hz 6 -> 48000 Hz 10 -> 192000 Hz" + echo " 3 -> 24000 Hz 7 -> 88200 Hz" + echo + printf "Track $i: Specify the Audio Sample Rate option [default is 6]: " + read arate[i] + case "${arate[i]}" in + 0) audhz[i]="8000" ;; + 1) audhz[i]="16000" ;; + 2) audhz[i]="22050" ;; + 3) audhz[i]="24000" ;; + 4) audhz[i]="32000" ;; + 5) audhz[i]="44100" ;; + 6|"") audhz[i]="48000" ;; + 7) audhz[i]="88200" ;; + 8) audhz[i]="96000" ;; + 9) audhz[i]="176400" ;; + 10) audhz[i]="192000" ;; *) error "-> Invalid option!" exit 1 @@ -1439,35 +1533,47 @@ esac ;; opus) - brown " Supported Sample Rates" - brown " ~~~~~~~~~~~~~~~~~~~~~~" - echo " 0 -> 8000 Hz 5 -> 24000 Hz" - echo " 1 -> 11025 Hz 6 -> 32000 Hz" - echo " 2 -> 12000 Hz 7 -> 44100 Hz" - echo " 3 -> 16000 Hz 8 -> 48000 Hz" - echo " 4 -> 22050 Hz " + echo " 0 -> 8000 Hz" + echo " 1 -> 12000 Hz" + echo " 2 -> 16000 Hz" + echo " 3 -> 24000 Hz " + echo " 4 -> 48000 Hz" echo - printf "Track $i: Specify the Audio Sample Rate option [default is 8]: " + printf "Track $i: Specify the Audio Sample Rate option [default is 4]: " read arate[i] case "${arate[i]}" in 0) audhz[i]="8000" ;; - 1) audhz[i]="11025" ;; - 2) audhz[i]="12000" ;; - 3) audhz[i]="16000" ;; - 4) audhz[i]="22050" ;; - 5) audhz[i]="24000" ;; - 6) audhz[i]="32000" ;; - 7) audhz[i]="44100" ;; - 8|"") audhz[i]="48000" ;; + 1) audhz[i]="12000" ;; + 2) audhz[i]="16000" ;; + 3) audhz[i]="24000" ;; + 4|"") audhz[i]="48000" ;; + *) + error "-> Invalid option!" + exit 1 + ;; + esac + ;; + truehd) + echo " 0 -> 44100 Hz 3 -> 96000 Hz " + echo " 1 -> 48000 Hz 4 -> 176400 Hz" + echo " 2 -> 88200 Hz 5 -> 192000 Hz" + echo + printf "Track $i: Specify the Audio Sample Rate option [default is 1]: " + read arate[i] + case "${arate[i]}" in + 0) audhz[i]="44100" ;; + 1|"") audhz[i]="48000" ;; + 2) audhz[i]="88200" ;; + 3) audhz[i]="96000" ;; + 4) audhz[i]="176400" ;; + 5) audhz[i]="192000" ;; *) error "-> Invalid option!" exit 1 ;; esac ;; - vorbis|pcm|truehd) - brown " Supported Sample Rates" - brown " ~~~~~~~~~~~~~~~~~~~~~~" + vorbis|pcm) echo " 0 -> 8000 Hz 5 -> 24000 Hz 10 -> 88200 Hz" echo " 1 -> 11025 Hz 6 -> 32000 Hz 11 -> 96000 Hz" echo " 2 -> 12000 Hz 7 -> 44100 Hz 12 -> 176400 Hz" @@ -1512,48 +1618,6 @@ fi done -if [ ! -z "$extracon" ]; then - conerror_func() { - error "-> Additional container $i does not support ${acodec[a]} audio!" - error "-> See: https://en.wikipedia.org/wiki/Comparison_of_video_container_formats#Formats_supported" - exit 1 - } - for i in $extracon; do - case "$i" in - # MKV is missing from the list since it supports - # all the supported audio codecs by the script - mp4) - for a in $(eval echo "{1..$MAX_AUD_TRACKS}"); do - case "${acodec[a]}" in - pcm|opus|flac|truehd) conerror_func ;; - esac - done - ;; - mov) - for a in $(eval echo "{1..$MAX_AUD_TRACKS}"); do - case "${acodec[a]}" in - pcm|opus|truehd) conerror_func ;; - esac - done - ;; - m4v) - for a in $(eval echo "{1..$MAX_AUD_TRACKS}"); do - case "${acodec[a]}" in - eac3|dts|vorbis|flac|pcm|opus|truehd) conerror_func ;; - esac - done - ;; - avi) - for a in $(eval echo "{1..$MAX_AUD_TRACKS}"); do - case "${acodec[a]}" in - opus|truehd) conerror_func ;; - esac - done - ;; - esac - done -fi - if [ ! -z "$skipsetpts" ]; then echo error "-> FPS conversion with the 'setpts' and 'atempo' filters has" @@ -1693,8 +1757,8 @@ echo "grn \"-> Converting to $i...\"" >> "$OUTFILE.sh" echo "" >> "$OUTFILE.sh" case "$i" in - avi) echo "$FFMPEG -i \"$OUTPUT\" -map 0 -c copy -bsf:v h264_mp4toannexb \"${OUTPUT%.*}.$i\" >/dev/null 2>&1" >> "$OUTFILE.sh" ;; - *) echo "$FFMPEG -i \"$OUTPUT\" -map 0 -c copy \"${OUTPUT%.*}.$i\" >/dev/null 2>&1" >> "$OUTFILE.sh" ;; + avi|m2ts|mts|ts) echo "$FFMPEG -i \"$OUTPUT\" -map 0 -c copy -bsf:v h264_mp4toannexb \"${OUTPUT%.*}.$i\" >/dev/null 2>&1" >> "$OUTFILE.sh" ;; + *) echo "$FFMPEG -i \"$OUTPUT\" -map 0 -c copy \"${OUTPUT%.*}.$i\" >/dev/null 2>&1" >> "$OUTFILE.sh" ;; esac echo "test \"\$?\" = \"0\" && grn \"-> Done\" || red \"-> Failed!\"" >> "$OUTFILE.sh" done
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.