[FFmpeg-user] Shortest between audio or video with text scroll

pinkgogh pinkgogh at gmail.com
Thu Jul 10 16:08:41 CEST 2014


Good morning!

I am using ffmpeg to mux a video file, a text file and an audio file. I
first add the text (one line) to the video file:

ffmpeg -y -i $STEP3OUT -vf
drawtext="fontfile=/usr/share/fonts/ttf/LiberationSans-Regular.ttf:textfile=$INCOMING_DIR/$ALERT_ID.txt:fontcolor=white:fontsize=36:y=h-h/3:x=w-120*t"
-b:v 9000k -maxrate 9000k -minrate 9000k -bufsize 1890k -acodec copy
$STEP4OUT

And then I mux the audio file with the video file:

ffmpeg -y -i $VIDEO_DIR/EAS_Blank.mpg -i $STEP2OUT -vcodec copy -acodec
libmp3lame -ab 96000 -ar 48000 -ac 1 -shortest $STEP3OUT

I am using -shortest as the video, EAS_Blank.mpg, is a long blank template.
My problem arises when the audio file is shortest than the time the text I
inserted in step 1 takes to scroll. 

Right now I am manually approximately calculating how long will the text
take to scroll and I add a silence buffer to the audio, but the calculation
is far from perfect and I end up either cutting text or adding too much
silence.

I was wondering if there is a way using ffmpeg to take the text file into
account when choosing the shortest file, or to do an exact calculation of
the time the text will take to scroll. Not sure how to use the 120*t to do
it.

Thanks in advance for the help!



--
View this message in context: http://ffmpeg-users.933282.n4.nabble.com/Shortest-between-audio-or-video-with-text-scroll-tp4666292.html
Sent from the FFmpeg-users mailing list archive at Nabble.com.


More information about the ffmpeg-user mailing list