v0.9.2
This commit is contained in:
		
							parent
							
								
									59eb1dad5a
								
							
						
					
					
						commit
						91e6fa0451
					
				
					 1 changed files with 32 additions and 7 deletions
				
			
		
							
								
								
									
										39
									
								
								burnSubs
									
										
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										39
									
								
								burnSubs
									
										
									
									
									
										
										
										Normal file → Executable file
									
								
							| 
						 | 
					@ -5,12 +5,11 @@ set -o errexit
 | 
				
			||||||
 | 
					
 | 
				
			||||||
################################################################################
 | 
					################################################################################
 | 
				
			||||||
# burnSubs
 | 
					# burnSubs
 | 
				
			||||||
# version 0.9.1
 | 
					# version 0.9.2
 | 
				
			||||||
#################3
 | 
					#################3
 | 
				
			||||||
# Wishlist:
 | 
					# Wishlist:
 | 
				
			||||||
#   queue encodes
 | 
					#   queue encodes
 | 
				
			||||||
#   finish TODOs
 | 
					#   finish TODOs
 | 
				
			||||||
#	list subtitles flag
 | 
					 | 
				
			||||||
#	finish help flag
 | 
					#	finish help flag
 | 
				
			||||||
#	audio recode flag
 | 
					#	audio recode flag
 | 
				
			||||||
################################################################################
 | 
					################################################################################
 | 
				
			||||||
| 
						 | 
					@ -48,7 +47,7 @@ function machineSetup() {
 | 
				
			||||||
		if [[ "$(hostname)" == "Kusanagi" ]]; then
 | 
							if [[ "$(hostname)" == "Kusanagi" ]]; then
 | 
				
			||||||
			echo "   > Hostname: 草薙素子"
 | 
								echo "   > Hostname: 草薙素子"
 | 
				
			||||||
			export OPTS_ENC="nvidia"
 | 
								export OPTS_ENC="nvidia"
 | 
				
			||||||
			echo "FIX FFMPEG!"
 | 
								echo "---> FIX FFMPEG!"
 | 
				
			||||||
			#export FFMPEG="/opt/ffmpeg-nvenc/bin/ffmpeg"
 | 
								#export FFMPEG="/opt/ffmpeg-nvenc/bin/ffmpeg"
 | 
				
			||||||
			export LD_LIBRARY_PATH="/opt/ffmpeg-nvenc/lib"
 | 
								export LD_LIBRARY_PATH="/opt/ffmpeg-nvenc/lib"
 | 
				
			||||||
			export FF_EXT="${FF_EXT} -pix_fmt yuv420p"
 | 
								export FF_EXT="${FF_EXT} -pix_fmt yuv420p"
 | 
				
			||||||
| 
						 | 
					@ -312,7 +311,9 @@ function selectSubs() {
 | 
				
			||||||
	# TODO: handle multiple subtitle files
 | 
						# TODO: handle multiple subtitle files
 | 
				
			||||||
	# TODO: verify the the subtitle index is legal
 | 
						# TODO: verify the the subtitle index is legal
 | 
				
			||||||
	if [[ $SUB_COUNT -eq 0 ]]; then
 | 
						if [[ $SUB_COUNT -eq 0 ]]; then
 | 
				
			||||||
		echo "   > ERROR: No subtitles! Todo!"
 | 
							echo "   > ERROR: No subtitles!"
 | 
				
			||||||
 | 
							echo "      > Reverting to a dry run."
 | 
				
			||||||
 | 
							export OPTS_DRYRUN=true
 | 
				
			||||||
		export SUBTITLE_INDEX=-1
 | 
							export SUBTITLE_INDEX=-1
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		if [[ $OPTS_SELSUB -lt 0 && $SUB_COUNT -gt 1 ]]; then
 | 
							if [[ $OPTS_SELSUB -lt 0 && $SUB_COUNT -gt 1 ]]; then
 | 
				
			||||||
| 
						 | 
					@ -343,8 +344,13 @@ function selectSubs() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function extractSubs() {
 | 
					function extractSubs() {
 | 
				
			||||||
	echo "   > extracting subtitles"
 | 
					 | 
				
			||||||
	export SUBTITLE_FILE="${TMP}/ripped.ass"
 | 
						export SUBTITLE_FILE="${TMP}/ripped.ass"
 | 
				
			||||||
 | 
						if [[ $SUBTITLE_INDEX -lt 0 ]]; then
 | 
				
			||||||
 | 
							echo "   > skipping subtitles (TODO: tidy cleanup)"
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							echo "   > extracting subtitles"
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
	extractIndex="$1"
 | 
						extractIndex="$1"
 | 
				
			||||||
	"$FFMPEG" -i "${INPUT_VIDEO}" -map 0:"${extractIndex}" -vn -an -c:s copy -c:a copy \
 | 
						"$FFMPEG" -i "${INPUT_VIDEO}" -map 0:"${extractIndex}" -vn -an -c:s copy -c:a copy \
 | 
				
			||||||
		"$SUBTITLE_FILE" 2>/dev/null
 | 
							"$SUBTITLE_FILE" 2>/dev/null
 | 
				
			||||||
| 
						 | 
					@ -522,7 +528,26 @@ while true; do
 | 
				
			||||||
		"-h" | "--help")
 | 
							"-h" | "--help")
 | 
				
			||||||
			# TODO: Display help
 | 
								# TODO: Display help
 | 
				
			||||||
			shift # all arguments parsed
 | 
								shift # all arguments parsed
 | 
				
			||||||
			echo "TODO: HELP!" # Display HELP
 | 
								echo "$(basename $0) [args] <input> <output>"
 | 
				
			||||||
 | 
								#echo "TODO: HELP!" # Display HELP
 | 
				
			||||||
 | 
								cat << _EOT
 | 
				
			||||||
 | 
					  ----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					    -k          auto-klobber when ffmpeg asks
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    -t <t>      ffmpeg encoding time limit
 | 
				
			||||||
 | 
					    --crf <#>   override CRF setting
 | 
				
			||||||
 | 
					    --soft      force software decode and encode
 | 
				
			||||||
 | 
					    --psoft     use software encoding (allow hardware decode when available)
 | 
				
			||||||
 | 
					    --audiofix  transcode audio
 | 
				
			||||||
 | 
					    --audio     transcode audio, and low-pass filter as well
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    -l          list subtitles (no encoding)
 | 
				
			||||||
 | 
					    -s <#>      select specific subtitle track number
 | 
				
			||||||
 | 
					                #TODO: verify legal subtitle track number convention
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    -d          debug (no cleanup)
 | 
				
			||||||
 | 
					    --dry       dry run (no encoding)
 | 
				
			||||||
 | 
					_EOT
 | 
				
			||||||
			exit
 | 
								exit
 | 
				
			||||||
		;;
 | 
							;;
 | 
				
			||||||
		*)
 | 
							*)
 | 
				
			||||||
| 
						 | 
					@ -536,7 +561,7 @@ done
 | 
				
			||||||
# Now parse POSITIONAL ARGUMENTS
 | 
					# Now parse POSITIONAL ARGUMENTS
 | 
				
			||||||
if [[ $# -ne 2 ]]; then
 | 
					if [[ $# -ne 2 ]]; then
 | 
				
			||||||
	echo "ERROR: Incorrect number of positional arguments. Expected 2, got $#"
 | 
						echo "ERROR: Incorrect number of positional arguments. Expected 2, got $#"
 | 
				
			||||||
	echo "       $0 [args] <input> <output>"
 | 
						echo "       $(basename $0) [args] <input> <output>"
 | 
				
			||||||
	exit
 | 
						exit
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
	INPUT_VIDEO="$(readlink -f "$1")"
 | 
						INPUT_VIDEO="$(readlink -f "$1")"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue