Is it possible to add stroke to text in ffmpeg - ffmpeg

I would like to add black stroke to text in ffmpeg. Is it possible?
ffmpeg -y -i video.mp4 -vf drawtext="fontfile=arialuni.ttf:textfile=z1.txt : x=0/2:y=h-t*13:fontcolor=white:fontsize=35:shadowcolor=black:shadowx=10:shadowy=10" -shortest -vcodec libx264 -pix_fmt yuv420p -r 25 -g 160 -b:v 4000k -profile:v main -level 3.1 -acodec libmp3lame -b:a 128k -ar 44100 -preset superfast output1.mp4

Yes - set the borderw option in your drawtext filter to set the width of the stroke you want.
bordercolor can be used to set the colour, but defaults to black so you don't need to set it for your use case.
For example, the command in the OP could become:
ffmpeg -y -i video.mp4 -vf drawtext="fontfile=arialuni.ttf:textfile=z1.txt : x=0/2:y=h-t*13:fontcolor=white:fontsize=35:shadowcolor=black:shadowx=10:shadowy=10:bordercolor=black:borderw=3" -shortest -vcodec libx264 -pix_fmt yuv420p -r 25 -g 160 -b:v 4000k -profile:v main -level 3.1 -acodec libmp3lame -b:a 128k -ar 44100 -preset superfast output1.mp4
See https://ffmpeg.org/ffmpeg-filters.html#drawtext-1 for documentation.

Related

I want to mix multiple crop is my command But ffmpeg error

I want to mix multiple crop is my command But ffmpeg error Filter overlay has an unconnected output.
ffmpeg -y -i "tetcrop.mp4" -i fulla.png -filter_complex "[0:v]setpts=PTS/1,scale=854:480,select='lt(mod(t,20),20)',setpts=N/FRAME_RATE/TB,setdar=16/9[vm];[vm]crop=155:176:229:150,scale=854:480,setdar=16/9[v2];[0:v]scale=854:480,setdar=16/9,setpts=PTS/1,select='lt(mod(t,20),20)',setpts=N/FRAME_RATE/TB[vc];[vc][v2]overlay=shortest=1:enable='lt(mod(t,4),2)*gte(t,2)'[v3];[0:v]setpts=PTS/1,scale=854:480,select='lt(mod(t,20),20)',setpts=N/FRAME_RATE/TB,setdar=16/9[ve];[ve]crop=155:176:229:150,scale=854:480,setdar=16/9[v4];[0:v]scale=854:480,setdar=16/9,setpts=PTS/1,select='lt(mod(t,20),20)',setpts=N/FRAME_RATE/TB[vd];[vd][v4]overlay=shortest=1:enable='lt(mod(t,4),2)*gte(t,2)'[vout];[vout]overlay =main_w-overlay_w-5:5;[0:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,atempo=1,aecho=0.5:0.3:2:0.5,aecho=0.5:0.3:2:0.5,aecho=0.5:0.3:2:0.5,highpass=f=10,treble=g=0,volume=10,volume=+25dB,aselect='lt(mod(t,20),20)',asetpts=N/SR/TB[a1];amovie=uottro.mp4:loop=999,volume=0.03[a2];[a1][a2]amix=duration=shortest" -vcodec libx264 -pix_fmt yuv420p -b:v 1000k -bf 2 -r 25 -g 60 -acodec libmp3lame -b:a 128k -ar 44100 -ac 2 -preset veryfast "tetcropok.mp4"
You made [vc][v2]overlay=shortest=1:enable='lt(mod(t,4),2)*gte(t,2)'[v3] but never told ffmpeg what to do with [v3]. It is orphaned, but it must be consumed.

I am using ffmpeg to overlay a image on top of a live stream using filter graphs, but when the input resolution changes, the overlay vanishes

I did my research and found that some filter graph options do not adapt to changing resolutions.
https://lists.ffmpeg.org/pipermail/libav-user/2012-October/002920.html
Here is the command which i am using. Whenever my input video changes from portrait to landscape, the overlay vanishes. I would really appreciate any help here.
ffmpeg -i rtmp://127.0.0.1:1935/show/$2 -i $overlayUrl -filter_complex "[1][0]scale2ref=iw:ih[ovr][base];[base][ovr] overlay=0:0, split=4[a][b]" -async 1 -vsync -1 -map 0:a -map "[a]" -c:v libx264 -c:a aac -b:v 256k -b:a 32k -s 640x360 -tune zerolatency -r 60 -preset veryfast -crf 23 -f flv rtmp://$rtmpoutput/$2_low -map 0:a -map "[b]" -c:v libx264 -c:a aac -b:v 768k -b:a 96k -s 640x480 -tune zerolatency -r 60 -preset veryfast -crf 23 -f flv rtmp://$rtmpoutput/$2_mid code here
FFmpeg reinitializes the filtergraph when input properties change. The image input is one frame long and has already been consumed.
Loop the image.
ffmpeg -i rtmp://127.0.0.1:1935/show/$2 -loop 1 -i $overlayUrl ...

How can I apply yadif filter to my command using -vf in ffmpeg

ffmpeg -i "udp://localhost:2117" -vf "movie= logo3.png [logo];[in]
[logo]overlay= 30:70 [out]" -c:a aac -ac 1 -strict -2 -c:v libx264 -maxrate
1500k -bufsize 1500k -g 40 -r 23 -preset veryfast -threads 1 -f flv
rtmp://localhost/live/OTA2
I'am using this command above for my streaming transcoding , I want apply yadif filter in side -vf " " but i am getting error , so maybe i don't know the syntax
so someone help me how to apply yadif filter to the current command
Better to use a filter_complex in this case.
ffmpeg -i "udp://localhost:2117"
-filter_complex "[0]yadif[main];movie=logo3.png[logo];[main][logo]overlay=30:70"
-c:v libx264 -maxrate 1500k -bufsize 1500k -g 40 -r 23 -preset veryfast -threads 1
-c:a aac -ac 1 -strict -2
-f flv rtmp://localhost/live/OTA2

ffmpeg keyframerate can't setup

I need setting keyframe for youtube but not working. Is on linux Debian.
ffmpeg -i "test.flv" -vcodec libx264 -x264-params keyint=120:no-scenecut -sameq -pix_fmt yuv420p -re -ar 44100 -b:a 128k -bufsize 2048k -vb 400k -maxrate 800k -deinterlace -acodec libmp3lame -preset medium -g 30 -r 30 -f flv "rtmp://a.rtmp.youtube.com/live2/"
I have error Unrecognized option 'x264-params'

What is difference between using ffmpeg GOP setting or x264opt keyint combination?

Here is a ffmpeg command:
ffmpeg -i input.mp4 -flags +global_header -c:v libx264 -vf scale="864x486",setsar=1:1,setdar=16:9 -profile:v main -level 31 -g 50 -keyint_min 50 -sc_threshold 0 -b:v 700k -pix_fmt yuv420p -c:a libfdk_aac -ar 44100 -ac 2 -b:a 128k output2.mp4
and here is the other one:
ffmpeg -i input.mp4 -flags +global_header -c:v libx264 -vf scale="864x486",setsar=1:1,setdar=16:9 -x264opts keyint=50:min-keyint=50:no-scenecut -profile:v main -level 31 -b:v 700k -pix_fmt yuv420p -c:a libfdk_aac -ar 44100 -ac 2 -b:a 128k output2.mp4
Are there any differences between using -g 50 -keyint_min 50 -sc_threshold 0 and -x264opts keyint=50:min-keyint=50:no-scenecut settings to gain constant keyframe interval?

Resources