Projects
Multimedia
ffhevc
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 9
View file
ffhevc.changes
Changed
@@ -1,4 +1,25 @@ ------------------------------------------------------------------- +Sun Nov 06 09:52:00 UTC 2016 - neutrino8@opensuse.org + +- Update to version 2.9.4 + * Bugfix: resampling wasn't working for fdk-aac due to missing + value in the case statement + * Check if output file exists and if so, move it to $file.old + * Use test directly instead of an if condition to set the audio + filters + * Support bitrate calculations for target file size when doing + audio copy + * Use fdk* in the case statements for easier typing + * Renamed variable astrm to astream for clarity + * Use 1-2p in the case statements for passmodes instead of 1p|2p + * New function, video_field_parity_func(), to detect and report the + interlace field order. Used by motion-compensation deinterlacing + and interlaced encoding + * Detect and display audio sample rate in case resampling is chosen + * Improvements to the video_fps_func() function. Get the FPS value + directly instead of outputting to a file and reading it + +------------------------------------------------------------------- Sat Nov 05 10:56:00 UTC 2016 - neutrino8@opensuse.org - Update to version 2.9.3
View file
ffhevc.spec
Changed
@@ -17,7 +17,7 @@ Name: ffhevc -Version: 2.9.3 +Version: 2.9.4 Release: 0 Summary: A small shell script for encoding to H.265/HEVC with ffmpeg License: GPL-2.0+
View file
ffhevc-2.9.3.tar.gz/AUTHORS -> ffhevc-2.9.4.tar.gz/AUTHORS
Changed
@@ -1,3 +1,3 @@ -- Grozdan Nikolov aka microchip <neutrino8@gmail.com> +- Grozdan Nikolov aka microchip <neutrino8@opensuse.org> Author/maintainer/developer/packager
View file
ffhevc-2.9.3.tar.gz/ChangeLog -> ffhevc-2.9.4.tar.gz/ChangeLog
Changed
@@ -1,3 +1,21 @@ +2016-11-06 - ffhevc 2.9.4 + * Bugfix: resampling wasn't working for fdk-aac due to missing + value in the case statement + * Check if output file exists and if so, move it to $file.old + * Use test directly instead of an if condition to set the audio + filters + * Support bitrate calculations for target file size when doing + audio copy + * Use fdk* in the case statements for easier typing + * Renamed variable astrm to astream for clarity + * Use 1-2p in the case statements for passmodes instead of 1p|2p + * New function, video_field_parity_func(), to detect and report the + interlace field order. Used by motion-compensation deinterlacing + and interlaced encoding + * Detect and display audio sample rate in case resampling is chosen + * Improvements to the video_fps_func() function. Get the FPS value + directly instead of outputting to a file and reading it + 2016-11-05 - ffhevc 2.9.3 * Use a single var, $ofps, to set the output FPS for both deinterlace bobbing and FPS conversion
View file
ffhevc-2.9.3.tar.gz/ffhevc -> ffhevc-2.9.4.tar.gz/ffhevc
Changed
@@ -1,16 +1,16 @@ #!/usr/bin/env bash # # Small script to encode to H.265/HEVC video using FFmpeg and libx265. -# Author: Grozdan "microchip" Nikolov <neutrino8@gmail.com> -# Version: 2.9.3 -# Date: 2016-11-05 +# Author: Grozdan "microchip" Nikolov <neutrino8@opensuse.org> +# Version: 2.9.4 +# Date: 2016-11-06 # License: GNU GPLv2+ green() { echo -e "\e1;32m$1\e0;39;49m"; } brown() { echo -e "\e0;33m$1\e0;39;49m"; } error() { echo -e "\e1;31m$1\e0;39;49m"; } -version="2.9.3" +version="2.9.4" CFG="$HOME/.ffhevc" cfgversion="28" @@ -126,7 +126,7 @@ ;; m) case "$OPTARG" in - 1p|2p|crf) true ;; + 1-2p|crf) true ;; *) error "-> Invalid mode!" error "-> Use: $(basename $0) -h" @@ -362,6 +362,8 @@ OUTPUT="$OUTPUT.$CON" + test -e "$OUTPUT" && mv -f "$OUTPUT" "$OUTPUT.old" + METATITLE="-metadata title=\"$(basename "${OUTPUT%.*}")\" -metadata:s:v:0 title=\"$(basename "${OUTPUT%.*}")\"" fi @@ -401,7 +403,7 @@ fi case "$mode" in - 1p|2p) + 1-2p) printf "Specify the desired Video Bitrate in kbps default is 5000: " read vbtr test -z "$vbtr" && vbitrate="5000" || vbitrate="$vbtr" @@ -510,8 +512,32 @@ # Used by mc deinterlace and FPS conversion video_fps_func() { - FPSOUT="$(dirname "$OUTPUT")/.ff_fps$$" - $FFPROBE -i "$input" -select_streams v:0 -show_entries stream=r_frame_rate > "$FPSOUT" 2>&1 + GETFPS="$($FFPROBE -i "$input" -select_streams v:0 -show_entries stream=r_frame_rate 2>&1 | sed -n 's|^r_frame_rate=||p')" +} + +# Used by mc deinterlace and interlace-aware encoding +video_field_parity_func() { + echo + green "-> Detecting Field Parity..." + FPAR="$($FFPROBE -i "$input" -show_streams -select_streams v:0 -show_frames -read_intervals %+7 2>&1 | sed -n 's|^field_order=||p' | tail -1)" + case "$FPAR" in + t*|T*) fp="tff"; fparity="Top Field First (TFF)" ;; + b*|B*) fp="bff"; fparity="Bottom Field First (BFF)" ;; + p*|P*) fp="progressive"; fparity="Progressive" ;; + ""|*) fp="???"; fparity="???" ;; + esac + green "-> Detected $fparity Parity" + if "$fp" = "progressive" ; then + error "-> Your file appears to be progressive but" + error " this may be a misdetection!" + elif "$fp" = "???" ; then + error "-> Could not detect the Field Parity!" + fi + echo + case "$fp" in + bff) defpar="bff" ;; + *) defpar="tff" ;; + esac } if "$VID_DEINTERLACE" = "y" ; then @@ -519,16 +545,10 @@ printf "Use Motion-Compensation Deinterlacing? y/N: " read mcd if "$mcd" = "y" -o "$mcd" = "Y" ; then - printf "Specify the Field Parity of the Input File tff/bff - default is tff: " + video_field_parity_func + printf "Specify the Field Parity of the Input File tff/bff - default is $defpar: " read par - case "$par" in - t*|T*|"") fpar="tff" ;; - b*|B*) fpar="bff" ;; - *) - error "-> Invalid option!" - exit 1 - ;; - esac + test -z "$par" && fpar="$defpar" || fpar="$par" fi case "$1" in ofps) test ! -z "$fpar" && deinterlace="yadif=1,mcdeint=mode=medium:parity=$fpar:qp=10,framestep=step=2," || deinterlace="yadif=0," ;; @@ -550,16 +570,22 @@ case "$dmethod" in 0|"") video_deinterlace_func ofps ;; 1) - video_fps_func - FPS1="$(cat "$FPSOUT" | sed -n 's|r_frame_rate=||p' | awk -F/ '{print $1}')" - FPS2="$(cat "$FPSOUT" | sed -n 's|r_frame_rate=||p' | awk -F/ '{print $2}')" - OFPS="$(($FPS1*2))/$FPS2" - rm -f "$FPSOUT" - echo - green "-> Detected $FPS1/$FPS2 FPS" - green "-> Setting output FPS to: $OFPS" echo - ofps="-r $OFPS" + green "-> Detecting FPS value..." + sleep 1 + video_fps_func + if ! -z "$GETFPS" ; then + FPS1="$(echo "$GETFPS" | awk -F/ '{print $1}')" + FPS2="$(echo "$GETFPS"| awk -F/ '{print $2}')" + OFPS="$(($FPS1*2))/$FPS2" + green "-> Detected: $FPS1/$FPS2 FPS" + green "-> Setting output FPS to: $OFPS" + echo + ofps="-r $OFPS" + else + error "-> Could not detect the FPS value!" + echo + fi video_deinterlace_func bob bob="1" ;; @@ -604,16 +630,10 @@ printf "Enable Interlace-aware encoding? y/N: " read intaw if "$intaw" = "y" -o "$intaw" = "Y" ; then - printf "Specify the Field Parity of the Input File tff/bff - default is tff: " + video_field_parity_func + printf "Specify the Field Parity of the Input File tff/bff - default is $defpar: " read parity - case "$parity" in - t*|T*|"") interlaced=":interlace=tff" ;; - b*|B*) interlaced=":interlace=bff" ;; - *) - error "-> Invalid option!" - exit 1 - ;; - esac + test -z "$parity" && interlaced=":interlaced=$defpar" || interlaced=":interlaced=$parity" X265PARAMS="$X265PARAMS$interlaced" fi fi @@ -621,7 +641,7 @@ if "$AUTOCROP" = "y" ; then echo green "-> Detecting crop values..." - VDUR="$($FFPROBE -i "$input" -select_streams v:0 -show_format 2>&1 | sed -n 's|duration=||p' | awk -F. '{print $1}')" + VDUR="$($FFPROBE -i "$input" -select_streams v:0 -show_format 2>&1 | sed -n 's|^duration=||p' | awk -F. '{print $1}')" CROPVAL="$($FFMPEG -ss $(($VDUR/2)) -i "$input" -map 0:0 -vf cropdetect=24:4 -frames:v 1000 -f null - 2>&1 | awk '/crop/ {print $NF}' | awk -F= '{print $2}' | tail -1)" if ! -z "$CROPVAL" ; then green "-> Found crop values: $CROPVAL" @@ -729,12 +749,14 @@ green "-> Detecting FPS value..." sleep 1 video_fps_func - FPS="$(cat "$FPSOUT" | sed -n 's|r_frame_rate=||p')" - rm -f "$FPSOUT" - green "-> Detected: $FPS FPS" - case "$FPS" in + if ! -z "$GETFPS" ; then + green "-> Detected: $GETFPS FPS" + else + error "-> Could not detect the FPS value!" + fi + case "$GETFPS" in 24/1|25/1|24000/1001|30000/1001) true ;; - *) + ""|*) echo error "-> Detected FPS is not supported yet!" error "-> Supported FPS are: 24/1, 25/1, 24000/1001 and 30000/1001" @@ -948,11 +970,11 @@ defaudtrk="press 'Enter' to skip" fi printf "Track $i: Specify the Audio Track to Encode or Copy $defaudtrk: " - read astrmi - if -z "${astrm1}" -a "$ATRKS" != "0" ; then - astrm1="0:1" + read astreami + if -z "${astream1}" -a "$ATRKS" != "0" ; then + astream1="0:1" fi - if ! -z "${astrmi}" ; then + if ! -z "${astreami}" ; then printf "Track $i: Specify the 3-letter Language Code for Metadata press 'Enter' to skip: " read alangi if ! -z "${alangi}" ; then @@ -961,7 +983,7 @@ fi done -test -z "$(echo "${astrm*}" | sed 's| ||g')" && audparams1="-an" +test -z "$(echo "${astream*}" | sed 's| ||g')" && audparams1="-an" if "${audparams1}" != "-an" ; then echo @@ -982,9 +1004,9 @@ fi for i in $(eval echo "{1..$MAX_AUD_TRACKS}"); do - if ! -z "${astrmi}" ; then + if ! -z "${astreami}" ; then echo - audmapi="-map ${astrmi}" + audmapi="-map ${astreami}" # Workaround for an ffmpeg disposition issue # where in some cases it flags subsequent @@ -1021,7 +1043,7 @@ abroptsi="32-512" abrdefi="448" ;; - fdk-aac) + fdk*) acdci="libfdk_aac" abroptsi="8-512" abrdefi="448" @@ -1055,7 +1077,6 @@ ;; copy) acdci="copy" - skiptfs="1" # FPS conversion is incompatible with audio stream copy for # obvious reasons. We can't speed up or slow down audio that's # being copied. Audio filters have no effect on stream copy. @@ -1114,7 +1135,8 @@ if "${acodeci}" != "copy" ; then if "${acodeci}" != "flac" ; then if "${acodeci}" != "pcm" ; then - if "${acodeci}" = "fdk-aac" ; then + case "${acodeci}" in + fdk*) printf "Track $i: Which AAC Profile to Use? LC/HE/HEv2 - default is LC: " read aprofi case "${aprofi}" in @@ -1127,8 +1149,8 @@ ;; esac audprofilei="-profile:a:${audmapvali} ${aacprofi} -afterburner:a:${audmapvali} 1" - - fi + ;; + esac printf "Track $i: Specify the Audio Bitrate in kbps ${abroptsi} - default is ${abrdefi}: " read abri test -z "${abri}" && abitratei="${abrdefi}k" || abitratei="${abri}k" @@ -1155,7 +1177,7 @@ ac3|eac3|dts|"") chanrangei="1-6"; defchani="6" ;; aac|opus|vorbis|flac|pcm) chanrangei="1-8"; defchani="8" ;; mp3) chanrangei="1-2"; defchani="2" ;; - fdk-aac) + fdk*) case "${aacprofi}" in aac_low|aac_he) chanrangei="1-8"; defchani="8" ;; *) chanrangei="1-2"; defchani="2" ;; @@ -1201,7 +1223,7 @@ ;; esac ;; - fdk-aac) + fdk*) case "${aacprofi}" in aac_he_v2) case "${achi}" in @@ -1251,9 +1273,19 @@ printf "Track $i: Resample the Audio? y/N: " read aresi if "${aresi}" = "y" -o "${aresi}" = "Y" ; then + echo + green "-> Track $i: detecting audio sample rate..." + sleep 1 + aidi="$(($(echo "${astreami}" | awk -F: '{print $2}')-1))" + ASRi="$($FFPROBE -i "$input" -show_streams -select_streams a:${aidi} 2>&1 | sed -n 's|^sample_rate=||p')" + if ! -z "${ASRi}" ; then + green "-> Track $i: detected ${ASRi} Hz" + else + error "-> Track $i: could not detect the audio sample rate!" + fi + echo case "${acodeci}" in mp3|ac3|eac3|dts|"") - echo brown " Supported Sample Rates" brown " ~~~~~~~~~~~~~~~~~~~~~~" echo " 0 -> 32000 Hz" @@ -1272,8 +1304,7 @@ ;; esac ;; - aac|flac) - echo + aac|fdk*|flac) brown " Supported Sample Rates" brown " ~~~~~~~~~~~~~~~~~~~~~~" echo " 0 -> 8000 Hz 5 -> 24000 Hz 10 -> 88200 Hz" @@ -1304,7 +1335,6 @@ esac ;; opus) - echo brown " Supported Sample Rates" brown " ~~~~~~~~~~~~~~~~~~~~~~" echo " 0 -> 8000 Hz 5 -> 24000 Hz" @@ -1332,7 +1362,6 @@ esac ;; vorbis|pcm) - echo brown " Supported Sample Rates" brown " ~~~~~~~~~~~~~~~~~~~~~~" echo " 0 -> 8000 Hz 5 -> 24000 Hz 10 -> 88200 Hz" @@ -1370,9 +1399,9 @@ fi afiltersi="$(echo "${aresamplei}${anormalizei}${avolumei}$atempo" | sed 's|,$||')" - if ! -z "${afiltersi}" ; then - audfiltersi="-filter:a:${audmapvali} ${afiltersi}" - fi + + test ! -z "${afiltersi}" && audfiltersi="-filter:a:${audmapvali} ${afiltersi}" + fi audparamsi="${audmapi} -c:a:${audmapvali} ${acdci} ${audprofilei} ${audbtri} ${audchani} ${audfiltersi} ${audlangi} ${audmetai}" @@ -1386,10 +1415,10 @@ fi case "$mode" in - 1p|2p) + 1-2p) # Haven't found a reliable way to make it work with - # FLAC, PCM and Copy audio so just skip this if one - # of these audio options are chosen. Patch welcome + # FLAC and PCM audio so just skip this if one of + # these audio codecs is chosen. Patch welcome if -z "$skiptfs" ; then echo printf "Set a Target File Size? y/N: " @@ -1398,12 +1427,23 @@ printf "Specify the Target File Size in MiB default is 5120: " read tsize test -z "$tsize" && target="5120" || target="$tsize" - VLENGTH="$($FFPROBE -i "$input" -select_streams v:0 -show_format 2>&1 | sed -n 's|duration=||p' | awk -F. '{print $1}')" + VLENGTH="$($FFPROBE -i "$input" -select_streams v:0 -show_format 2>&1 | sed -n 's|^duration=||p' | awk -F. '{print $1}')" if -z "$VLENGTH" ; then echo error "-> Could not detect video length!" error "-> Skipping bitrate calculation!" else + # Audio copy, get bitrate + for i in $(eval echo "{1..$MAX_AUD_TRACKS}"); do + if "${acodeci}" = "copy" ; then + aidi="$(($(echo "${astreami}" | awk -F: '{print $2}')-1))" + abtri="$($FFPROBE -i "$input" -show_streams -select_streams a:${aidi} 2>&1 | sed -n 's|^bit_rate=||p')" + case "${abtri}" in + 1-9*) abitratei="$((${abtri}/1000))" ;; + ""|*) abitratei="0" ;; + esac + fi + done AUDBTR="$(($(echo "${abitrate*}" | sed 's|k||g; s| |+|g')))" VBITRATE="$((($target*8192/$VLENGTH)-$AUDBTR))" echo
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
.