0
votes

cpulimit -l 180 ffmpeg-static/ffmpeg -ss 0 -t 8.96 -i '/var/www/html/Videos2/Character Jack/Happy/happy birthday scene.mp4' -filter_complex '[0] drawtext=textfile=scene2.txt:fontsize=199.68:fontfile=/var/www/html/fonts/Arial.ttf:x=288:y=409:fontcolor_expr=ffffff%{eif\: clip(1+(255*t/4)\, 0\, 255)\:x\:2}' -pass 1 -f h264 -y - > /dev/null &&

cpulimit -l 180 ffmpeg-static/ffmpeg -ss 0 -t 8.96 -i '/var/www/html/Videos2/Character Jack/Happy/happy birthday scene.mp4' -i '/var/www/html/Userfiles/Users/blaze/Projects/earl3x/audio/scene2_music.x.mp3' -filter_complex '[1] volume=0.95 [au1]; [0][au1] amix=inputs=2:duration=shortest' -c:v copy -c:a libmp3lame -pix_fmt yuv420p -preset ultrafast -shortest -movflags faststart -y -pass 2 /var/www/html/Userfiles/Users/blaze/example/earl4x/scene2.mp4

What i'm trying to achieve ? encoding text elements / graphics on the first pass and encoding Sound (audio) on the second pass

the first pass and second pass runs fine ( with no errors at all) and the output has no artifact.

however the text is totally no where to be found! what it seems like is that , the second pass had no idea there was a first pass with text encoded in it.

what will be the right way to run / format the command ?

thanks

2
Doesn't like anything to do with the pass method. Check that your drawtext does print text, using a single-pass method. - Gyan

2 Answers

0
votes

i solved this.

i had to go through another method


-generate the video with with draw text ( dont parse the -pass 1 parameter) just run your output normally

-put you output url as the input url of the next command (use -y and remember no passes)

  • add the audio file as the second input parameter

-output a final file

note things could get really muddy if you have a series of complex combinations

so i have to figure out an algorithm specific to my case that worked.

0
votes

The drawtext has to be applied both times. What pass 1 is generate the video, analyze video and then discard it, so drawtext has to be present for pass 2 as well.

ffmpeg -ss 0 -t 8.96 -i '/var/www/html/Videos2/Character Jack/Happy/happy birthday scene.mp4' \
-filter_complex \
'[0] drawtext=textfile=scene2.txt:fontsize=199.68:fontfile=/var/www/html/fonts/Arial.ttf: \
 x=288:y=409: \
 fontcolor_expr=ffffff%{eif\: clip(1+(255*t/4)\, 0\, 255)\:x\:2}' \
-pass 1 -c:v libx264 -f null -

2nd pass:

ffmpeg -ss 0 -t 8.96 -i '/var/www/html/Videos2/Character Jack/Happy/happy birthday scene.mp4' \
       -i '/var/www/html/Userfiles/Users/blaze/Projects/earl3x/audio/scene2_music.x.mp3' \
-filter_complex \
'[0] drawtext=textfile=scene2.txt:fontsize=199.68:fontfile=/var/www/html/fonts/Arial.ttf: \
 x=288:y=409: \
 fontcolor_expr=ffffff%{eif\: clip(1+(255*t/4)\, 0\, 255)\:x\:2}[v];
 [1]volume=0.95 [au1]; [0][au1] amix=inputs=2:duration=shortest[a]' -map "[v]" -map "[a]" \
-pass 2 -c:v libx264 -c:a libmp3lame -pix_fmt yuv420p -preset ultrafast -shortest \
-movflags +faststart -y \
/var/www/html/Userfiles/Users/blaze/example/earl4x/scene2.mp4