Projects
Multimedia
ffx264
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 10
View file
ffx264.changes
Changed
@@ -1,18 +1,23 @@ ------------------------------------------------------------------- -Sat Nov 05 10:56:00 UTC 2016 - neutrino8@opensuse.org +Sun Nov 06 09:52:00 UTC 2016 - neutrino8@opensuse.org -- Update to version 3.0.9 - * Use a single var, $ofps, to set the output FPS for both - deinterlace bobbing and FPS conversion - * Use new $bob var to indicate that we do bobbing and use that - var to disable FPS conversion - * Renamed $fp var in video_deinterlace_func() to $fpar - * Print a warning message that FPS conversion gets disabled if - the user chooses audio copy - * Added support for the FDK-AAC audio codec. Requires ffmpeg - to be compiled with libfdk-aac support - * Support FPS conversion with the 'fps' filter - * Some minor code optimizations +- Update to version 3.1.0 + * 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-2]p 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 ------------------------------------------------------------------- Fri Nov 04 10:43:00 UTC 2016 - neutrino8@opensuse.org
View file
ffx264.spec
Changed
@@ -17,7 +17,7 @@ Name: ffx264 -Version: 3.0.9 +Version: 3.1.0 Release: 0 Summary: A small shell script for encoding to H.264 with ffmpeg License: GPL-2.0+
View file
ffx264-3.0.9.tar.gz/AUTHORS -> ffx264-3.1.0.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
ffx264-3.0.9.tar.gz/ChangeLog -> ffx264-3.1.0.tar.gz/ChangeLog
Changed
@@ -1,3 +1,21 @@ +2016-11-06 - ffx264 3.1.0 + * 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-2]p 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 - ffx264 3.0.9 * Use a single var, $ofps, to set the output FPS for both deinterlace bobbing and FPS conversion
View file
ffx264-3.0.9.tar.gz/ffx264 -> ffx264-3.1.0.tar.gz/ffx264
Changed
@@ -1,16 +1,16 @@ #!/usr/bin/env bash # # Small script to encode to H.264/AVC video using FFmpeg and libx264. -# Author: Grozdan "microchip" Nikolov <neutrino8@gmail.com> -# Version: 3.0.9 -# Date: 2016-11-05 +# Author: Grozdan "microchip" Nikolov <neutrino8@opensuse.org> +# Version: 3.1.0 +# Date: 2016-11-06 # License: GNU GPLv2+ green() { echo -e "\e[1;32m$1\e[0;39;49m"; } brown() { echo -e "\e[0;33m$1\e[0;39;49m"; } error() { echo -e "\e[1;31m$1\e[0;39;49m"; } -version="3.0.9" +version="3.1.0" CFG="$HOME/.ffx264" cfgversion="24" @@ -125,7 +125,7 @@ ;; m) case "$OPTARG" in - 1p|2p|crf) true ;; + [1-2]p|crf) true ;; *) error "-> Invalid mode!" error "-> Use: $(basename $0) -h" @@ -363,6 +363,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 @@ -402,7 +404,7 @@ fi case "$mode" in - 1p|2p) + [1-2]p) printf "Specify the desired Video Bitrate in kbps [default is 8000]: " read vbtr test -z "$vbtr" && vbitrate="8000" || vbitrate="$vbtr" @@ -511,8 +513,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 @@ -520,16 +546,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," ;; @@ -551,16 +571,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" ;; @@ -606,16 +632,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=":tff=1" ;; - b*|B*) interlaced=":bff=1" ;; - *) - error "-> Invalid option!" - exit 1 - ;; - esac + test -z "$parity" && interlaced=":${defpar}=1" || interlaced=":${parity}=1" X264PARAMS="$X264PARAMS$interlaced" fi fi @@ -623,7 +643,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" @@ -731,12 +751,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" @@ -950,11 +972,11 @@ defaudtrk="press 'Enter' to skip" fi printf "Track $i: Specify the Audio Track to Encode or Copy [$defaudtrk]: " - read astrm[i] - if [ -z "${astrm[1]}" -a "$ATRKS" != "0" ]; then - astrm[1]="0:1" + read astream[i] + if [ -z "${astream[1]}" -a "$ATRKS" != "0" ]; then + astream[1]="0:1" fi - if [ ! -z "${astrm[i]}" ]; then + if [ ! -z "${astream[i]}" ]; then printf "Track $i: Specify the 3-letter Language Code for Metadata [press 'Enter' to skip]: " read alang[i] if [ ! -z "${alang[i]}" ]; then @@ -963,7 +985,7 @@ fi done -test -z "$(echo "${astrm[*]}" | sed 's| ||g')" && audparams[1]="-an" +test -z "$(echo "${astream[*]}" | sed 's| ||g')" && audparams[1]="-an" if [ "${audparams[1]}" != "-an" ]; then echo @@ -984,9 +1006,9 @@ fi for i in $(eval echo "{1..$MAX_AUD_TRACKS}"); do - if [ ! -z "${astrm[i]}" ]; then + if [ ! -z "${astream[i]}" ]; then echo - audmap[i]="-map ${astrm[i]}" + audmap[i]="-map ${astream[i]}" # Workaround for an ffmpeg disposition issue # where in some cases it flags subsequent @@ -1023,7 +1045,7 @@ abropts[i]="32-512" abrdef[i]="448" ;; - fdk-aac) + fdk*) acdc[i]="libfdk_aac" abropts[i]="8-512" abrdef[i]="448" @@ -1057,7 +1079,6 @@ ;; copy) acdc[i]="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. @@ -1116,7 +1137,8 @@ if [ "${acodec[i]}" != "copy" ]; then if [ "${acodec[i]}" != "flac" ]; then if [ "${acodec[i]}" != "pcm" ]; then - if [ "${acodec[i]}" = "fdk-aac" ]; then + case "${acodec[i]}" in + fdk*) printf "Track $i: Which AAC Profile to Use? [LC/HE/HEv2 - default is LC]: " read aprof[i] case "${aprof[i]}" in @@ -1129,8 +1151,8 @@ ;; esac audprofile[i]="-profile:a:${audmapval[i]} ${aacprof[i]} -afterburner:a:${audmapval[i]} 1" - - fi + ;; + esac printf "Track $i: Specify the Audio Bitrate in kbps [${abropts[i]} - default is ${abrdef[i]}]: " read abr[i] test -z "${abr[i]}" && abitrate[i]="${abrdef[i]}k" || abitrate[i]="${abr[i]}k" @@ -1157,7 +1179,7 @@ ac3|eac3|dts|"") 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" ;; - fdk-aac) + fdk*) case "${aacprof[i]}" in aac_low|aac_he) chanrange[i]="1-8"; defchan[i]="8" ;; *) chanrange[i]="1-2"; defchan[i]="2" ;; @@ -1203,7 +1225,7 @@ ;; esac ;; - fdk-aac) + fdk*) case "${aacprof[i]}" in aac_he_v2) case "${ach[i]}" in @@ -1253,9 +1275,19 @@ printf "Track $i: Resample the Audio? [y/N]: " read ares[i] if [ "${ares[i]}" = "y" -o "${ares[i]}" = "Y" ]; then + echo + green "-> Track $i: detecting audio sample rate..." + sleep 1 + aid[i]="$(($(echo "${astream[i]}" | awk -F: '{print $2}')-1))" + ASR[i]="$($FFPROBE -i "$input" -show_streams -select_streams a:${aid[i]} 2>&1 | sed -n 's|^sample_rate=||p')" + if [ ! -z "${ASR[i]}" ]; then + green "-> Track $i: detected ${ASR[i]} Hz" + else + error "-> Track $i: could not detect the audio sample rate!" + fi + echo case "${acodec[i]}" in mp3|ac3|eac3|dts|"") - echo brown " Supported Sample Rates" brown " ~~~~~~~~~~~~~~~~~~~~~~" echo " 0 -> 32000 Hz" @@ -1274,8 +1306,7 @@ ;; esac ;; - aac|flac) - echo + aac|fdk*|flac) brown " Supported Sample Rates" brown " ~~~~~~~~~~~~~~~~~~~~~~" echo " 0 -> 8000 Hz 5 -> 24000 Hz 10 -> 88200 Hz" @@ -1306,7 +1337,6 @@ esac ;; opus) - echo brown " Supported Sample Rates" brown " ~~~~~~~~~~~~~~~~~~~~~~" echo " 0 -> 8000 Hz 5 -> 24000 Hz" @@ -1334,7 +1364,6 @@ esac ;; vorbis|pcm) - echo brown " Supported Sample Rates" brown " ~~~~~~~~~~~~~~~~~~~~~~" echo " 0 -> 8000 Hz 5 -> 24000 Hz 10 -> 88200 Hz" @@ -1372,9 +1401,8 @@ fi afilters[i]="$(echo "${aresample[i]}${anormalize[i]}${avolume[i]}$atempo" | sed 's|,$||')" - if [ ! -z "${afilters[i]}" ]; then - audfilters[i]="-filter:a:${audmapval[i]} ${afilters[i]}" - fi + + test ! -z "${afilters[i]}" && audfilters[i]="-filter:a:${audmapval[i]} ${afilters[i]}" fi audparams[i]="${audmap[i]} -c:a:${audmapval[i]} ${acdc[i]} ${audprofile[i]} ${audbtr[i]} ${audchan[i]} ${audfilters[i]} ${audlang[i]} ${audmeta[i]}" @@ -1389,10 +1417,10 @@ fi case "$mode" in - 1p|2p) + [1-2]p) # 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]: " @@ -1401,12 +1429,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 [ "${acodec[i]}" = "copy" ]; then + aid[i]="$(($(echo "${astream[i]}" | awk -F: '{print $2}')-1))" + abtr[i]="$($FFPROBE -i "$input" -show_streams -select_streams a:${aid[i]} 2>&1 | sed -n 's|^bit_rate=||p')" + case "${abtr[i]}" in + [1-9]*) abitrate[i]="$((${abtr[i]}/1000))" ;; + ""|*) abitrate[i]="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
.