Thread: Tech FFmpeg duration
View Single Post
Old 10-26-2017, 04:08 AM  
mikeworks
Confirmed User
 
Join Date: Apr 2010
Posts: 272
Thanks for help. I have tried everything so far and still no joy.

I went from using ffprobe to ffmpeg itself to output duration in seconds:

duration=$(/usr/local/bin/ffmpeg -i /path/to/file/1.mp4 2>&1 | grep "Duration"| cut -d ' ' -f 4 | sed s/,// | sed 's@\..*@@g' | awk '{ split($1, A, ":"); split(A[3], B, "."); print 3600*A[1] + 60*A[2] + B[1] }') /usr/local/bin/ffmpeg -i /path/to/file/1.mp4 -vf 'scale=448:trunc(ow/a/vsub)*vsub' -vf drawtext="fontsize=16:[email protected]:fontfile =/usr/local/share/fonts/freefont-ttf/FreeSans.ttf:text='Blah blah blah':y=25:x=w-(t-($duration/2))*w/20" -threads 0 -acodec libfaac -ar 44100 -ab 128k -vcodec libx264 -preset slower -keyint_min 25 -g 250 -r 24 -y /path/to/output/temp_vid.mp4

It works in command line perfect, even without a line break it works.

But when I save it in database for script to use, damn thing won't encode and shows in admin area the error code, if I copy the 'error code' into command line it works perfect.
mikeworks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote