Solved

Bash variabes not passing from .sh properly

Posted on 2012-12-30
2
261 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can use conditional statements using Python.
Fine Tune your automatic Updates for Ubuntu / Debian
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…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

943 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

10 Experts available now in Live!

Get 1:1 Help Now