Solved

Bash variabes not passing from .sh properly

Posted on 2012-12-30
2
260 Views
Last Modified: 2012-12-30
I am trying to use HandBrakeCLI to encode.

Everything works fine except one aspect.

INPUT=$1
EMBED=$2
WIDTH=$3
QUALITY=$4
AUDIO=$5
SUBS="$6"
DIRNAME=`dirname "$INPUT"`
FILENAME=`basename "$INPUT"`
BASENAME=${FILENAME%%.*}
FILENAME=$INPUT
HandBrakeCLI -i /www/domain.com/processing/"$FILENAME" -t 1 -c 1 -o /www/domain.com/htdocs/embed/"$EMBED".mp4 -f mp4 -r 23.976 --detelecine --decomb --denoise=weak -w "$WIDTH" --loose-anamorphic --start-at duration:300 --stop-at duration:30 --modulus 16 -e x264 -q "$QUALITY" --vfr -a 1 -E ffaac -B "$AUDIO" -6 stereo -R Auto -D 0 -x ref=6:subq=10:rc-lookahead=60:trellis=2:bframes=6:b-adapt=2:direct=auto:me=tesa:merange=24:analyse=all:psy-rd=0.40,0:deblock=1,1:aq-strength=0.6 --optimize "$SUBS"

Open in new window


run code
./encode.sh videoin.mkv videoout 660 24 128 '--subtitle=1 --subtitle-forced=1 --subtitle-burn=1 --subtitle-default=1'

something is wrong with my $6 or the subtitle variable

Using HandBrakeCLI from command line I get the following:
[03:55:29]  * subtitle track 0, Unknown (id 2) Text [SSA] -> Render/Burn in, Forced Only, Default (this shows that all of the subtitles are working as expected)

Running the same command from within encode.sh
[03:56:30]  * subtitle track 0, Unknown (id 2) Text [SSA] -> Pass-Through (not working as expected)

It seems that using Handbrake from cmd line it understands the full line below
'--subtitle=1 --subtitle-forced=1 --subtitle-burn=1 --subtitle-default=1'

However, when used within encode.sh it only reads the first command --subtitle=1 and ignores the rest. Even when echoing the encode.sh everything looks correct.

Hence I am stuck and have been for days. Can anyone spot anything wrong or out of place?
0
Comment
Question by:UltraFlux
2 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 38731903
--optimize $SUBS
0
 

Author Comment

by:UltraFlux
ID: 38731931
ozo

I don't know what to say besides I hate and love you at the same time!

Thanks
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now