Solved

Bash variabes not passing from .sh properly

Posted on 2012-12-30
2
266 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Shell script issue 4 65
Install XRDP on Ubuntu Server 16.10 x64 3 116
Windows 10 linux VM 30 92
MySql Linux vs Windows: bad results for Windows but why? 10 72
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
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.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

734 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