Thread: Tech FFmpeg duration
View Single Post
Old 10-26-2017, 05:45 AM  
mikeworks
Confirmed User
 
Join Date: Apr 2010
Posts: 272
The field value is:

duration=$(%ffmpeg_path% -i %video_file% 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] }') %ffmpeg_path% -i %video_file% %video_filters% -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 %audio_encoder% -ar 44100 -ab %audio_bitrate%k -vcodec libx264 -preset slower -keyint_min 25 -g 250 -r %video_fps% %video_rotate% -y %video_target%

The field type is 'text'.

You can see the script replaces %ffmpeg_path% and others with true values.

I need to determine the duration of the video in seconds. Then divide that duration by 2, so I can add a watermark half way through the video.
mikeworks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote