Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Bash variabes not passing from .sh properly

Posted on 2012-12-30
2
Medium Priority
?
269 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 85

Accepted Solution

by:
ozo earned 2000 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month10 days, 13 hours left to enroll

886 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