• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
do shell script quoting help
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

do shell script quoting help


  • Subject: do shell script quoting help
  • From: Terry Barnum <email@hidden>
  • Date: Tue, 02 Sep 2014 11:25:07 -0700

I've written a small droplet that takes a Prores QT movie and converts it to an mp4 using do shell script and ffmpeg and it works great. I'm now trying to overlay timecode with ffmpeg's drawtext function but am having trouble escaping characters. It works fine in Terminal and in a shell script but I can't figure it out with do shell script. I know I could instead just call a shell script that calls ffmpeg but I'd like to learn how from do shell script. Here's the terminal line that works (hopefully formatting doesn't get too mangled).

ffmpeg -i /Users/macuser/Desktop/source.mov -threads 0 -s 640x360 -pix_fmt yuv420p -vcodec libx264 -b:v 500k -acodec libfaac -b:a 128k -vf drawtext="fontsize=15:fontfile=/Library/Fonts/Verdana.ttf:timecode='01\:00\:00\:00':rate=23.976:text='TCR:':fontsize=72:fontcolor='white':boxcolor=0x000000AA:box=1:x=30:y=30" -y /Users/macuser/Desktop/out.mp4

Here are the relevant lines in the droplet applescript. I've tried several different ways of escaping quotes and colons but no luck.

set fontfile to quoted form of "fontfile=/Library/Fonts/Verdana.ttf:"
set rate to quoted form of "rate=23.976:"
set timecode to quoted form of "timecode='01:00:00:00':"
set myText to quoted form of "text='TCR ':"
set fontsize to quoted form of "fontsize=72:"
set fontcolor to quoted form of "fontcolor='white':"
set boxcolor to quoted form of "boxcolor=0x000000AA:"
set box to quoted form of "box=1:"
set xc to quoted form of "x=30:"
set yc to "y=30"

set myResult to do shell script ("/opt/local/bin/ffmpeg -i " & quoted form of POSIX path of this_item & "-threads 0 -s 640x360 -pix_fmt yuv420p -vcodec libx264 -b:v 500k -acodec libfaac -b:a 128k -vf drawtext=" & fontfile & rate & myText & timecode & fontsize & fontcolor & boxcolor & box & xc & yc & " -y /Users/macuser/Desktop/out.mp4 &> /tmp/out.txt")

/tmp/out.txt ends with:

[Parsed_drawtext_0 @ 0x7ffa0ae045e0] Both text and text file provided. Please provide only one
[AVFilterGraph @ 0x7ffa0ae04260] Error initializing filter 'drawtext' with args 'fontfile=/Library/Fonts/Verdana.ttf:rate=23.976:text=TCR :timecode=01:00:00:00:fontsize=72:fontcolor=white:boxcolor=0x000000AA:box=1:x=30:y=30'
Error opening filters!

Thanks for any help.

-Terry
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: do shell script quoting help
      • From: Terry Barnum <email@hidden>
    • Re: do shell script quoting help
      • From: Christopher Nebel <email@hidden>
  • Prev by Date: Requesting guidance on maintaining a scroll position in scroll field, please.
  • Next by Date: Re: do shell script quoting help
  • Previous by thread: Requesting guidance on maintaining a scroll position in scroll field, please.
  • Next by thread: Re: do shell script quoting help
  • Index(es):
    • Date
    • Thread