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
Solved

Bash variabes not passing from .sh properly

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

The purpose of this article is to demonstrate how we can use conditional statements using Python.
Fine Tune your automatic Updates for Ubuntu / Debian
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

856 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