ffmpeg keyframerate can't setup - ffmpeg

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'

Related

ffmpeg streaming to youtube

I've used the following command to stream mp4 file to youtube :
ffmpeg -re -i merge.mp4 \
-c:v libx264 -preset veryfast -maxrate 3000k \
-bufsize 6000k -pix_fmt yuv420p -g 50 -c:a aac -b:a 160k -ac 2 \
-ar 44100 -f flv rtmp://a.rtmp.youtube.com/live2/<MYKEY>
I see the ffmpeg streams the data like that:
but yet the youtube streaming page shows nothing yet received:
Any idea what am I missing?

Is it possible to add stroke to text in 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.

I trying to stream screen to multiple sources with ffmpeg and got error

My command
ffmpeg -thread_queue_size 1024 -f x11grab -draw_mouse 0 -video_size 1920x1080 -i :99.0+0,0 -f alsa -i pulse -channels 2 -c:a aac -b:a 160k -ar 44100 -threads 8 -c:v libx264 -x264-params nal-hrd=cbr -profile:v baseline -framerate 30 -level:v 4.2 -vf format=yuv420p -b:v 1000k -maxrate 1500k -minrate 1000k -bufsize 8000k -g 60 -preset ultrafast -tune zerolatency -f tee -flags +global_header -map 0:v -map 1:a "[f=flv:onfail=ignore]rtmp://stream1|[f=flv:onfail=ignore]rtmp://stream2"
Error in console:
[NULL # 0x55aaf9a54bc0] Unable to find a suitable output format for '"[f=flv:onfail=ignore]rtmp://strea1
[tee # 0x55aaf96f3200] Slave muxer #0 failed, aborting.
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:1 --
ffmpeg -thread_queue_size 1024 -f x11grab -draw_mouse 0 -video_size 1920x1080 -i :99.0+0,0 -f alsa -i pulse -channels 2 -c:a aac -b:a 160k -ar 44100 -threads 8 -c:v libx264 -x264-params nal-hrd=cbr -profile:v baseline -framerate 30 -level:v 4.2 -vf format=yuv420p -b:v 1000k -maxrate 2500k -minrate 800k -bufsize 8000k -g 60 -preset ultrafast -tune zerolatency -map 0:v -map 1:a -f tee -flags +global_header [f=flv:onfail=ignore:flvflags=no_duration_filesize]rtmp://stream1|[f=flv:onfail=ignore:flvflags=no_duration_filesize]rtmp://stream2
problem was with quotes

FFMPEG Multiple outputs from BlackMagic input

I'm currently needing help to achieve multiple outputs from one input.
Right now, the outputs are set like this:
ffmpeg -re -f decklink -i "DeckLink Mini Recorder" -y -pix_fmt yuv420p -c:v h264 -preset fast -tune zerolatency -c:a aac -ac 2 -b:a 128k -ar 44100 -async 1 -b:v 2300k -g 5 -probesize 32 -framerate 30 -movflags +faststart -s 1280x720 -bufsize 1000k -maxrate 3072k -shortest -f flv "rtmp://10.0.0.172:1935/Testing/live_720p"
ffmpeg -re -i "rtmp://10.0.0.172:1935/Testing/live_720p" -c:v h264 -preset fast -tune zerolatency -c:a aac -ac 2 -b:a 114k -ar 44100 -async 1 -b:v 900k -g 5 -probesize 32 -framerate 30 -movflags +faststart -s 854x480 -bufsize 400k -maxrate 1000k -shortest -f flv "rtmp://10.0.0.172:1935/Testing/live_480p_hq"
ffmpeg -re -i "rtmp://10.0.0.172:1935/Testing/live_720p" -c:v h264 -preset fast -tune zerolatency -c:a aac -ac 2 -b:a 114k -ar 44100 -async 1 -b:v 550k -g 5 -probesize 32 -framerate 30 -movflags +faststart -s 854x480 -bufsize 400k -maxrate 500k -shortest -f flv "rtmp://10.0.0.172:1935/Testing/live_480p_lq"
ffmpeg -re -i "rtmp://10.0.0.172:1935/Testing/live_720p" -c:v h264 -preset fast -tune zerolatency -c:a aac -ac 2 -b:a 114k -ar 44100 -async 1 -b:v 450k -g 5 -probesize 32 -framerate 30 -movflags +faststart -s 640x360 -bufsize 400k -maxrate 500k -shortest -f flv "rtmp://10.0.0.172:1935/Testing/live_360p"
This uses quite a lot of processing power, and also generates unnecessary latency (since I have to stream to WOWZA first, then back to FFMPEG and then back to WOWZA).
And I want to optimize this.
I've been trying several methods, but I only managed to overflow the decklink buffer. How could I solve this?
As per #Brad's comment, you can select the source input and then create multiple outputs on a single command line, like this:
ffmpeg -re -f decklink -i "DeckLink Mini Recorder" -y -pix_fmt yuv420p \
-c:v h264 -preset fast -tune zerolatency -c:a aac -ac 2 -b:a 128k -ar 44100 -async 1 -b:v 2300k -g 5 -probesize 32 -framerate 30 -movflags +faststart -s 1280x720 -bufsize 1000k -maxrate 3072k -shortest -f flv "rtmp://10.0.0.172:1935/Testing/live_720p" \
-c:v h264 -preset fast -tune zerolatency -c:a aac -ac 2 -b:a 114k -ar 44100 -async 1 -b:v 900k -g 5 -probesize 32 -framerate 30 -movflags +faststart -s 854x480 -bufsize 400k -maxrate 1000k -shortest -f flv "rtmp://10.0.0.172:1935/Testing/live_480p_hq" \
-c:v h264 -preset fast -tune zerolatency -c:a aac -ac 2 -b:a 114k -ar 44100 -async 1 -b:v 550k -g 5 -probesize 32 -framerate 30 -movflags +faststart -s 854x480 -bufsize 400k -maxrate 500k -shortest -f flv "rtmp://10.0.0.172:1935/Testing/live_480p_lq" \
-c:v h264 -preset fast -tune zerolatency -c:a aac -ac 2 -b:a 114k -ar 44100 -async 1 -b:v 450k -g 5 -probesize 32 -framerate 30 -movflags +faststart -s 640x360 -bufsize 400k -maxrate 500k -shortest -f flv "rtmp://10.0.0.172:1935/Testing/live_360p"
(if you're running this on Windows then copy & paste the above into a single command - Windows command line doesn't support the backslash line-continuation feature).

FFMPEG watermark with filter

I am trying to use a watermark and apply Yadif using complex filter, but I cannot figure out how to apply Yadif with the following syntax
ffmpeg -i "source:" -i C:\logo.png -c:v libx264 -preset veryfast -s 1920x1080 -b:v 4000k -minrate 4000k -maxrate 4000k -bufsize 11835k -crf 18 -acodec mp3 -ab 128k -filter_complex [0:v][1:v]overlay=main_w-overlay_w-10:main_h-overlay_h-10[out] -map [out] -f mpegts "dest"
Can anyone point me in the right direction?
Thanks
As indicated at the support forum, use
ffmpeg -i "source:" -i C:\logo.png \
-filter_complex "[0:v]yadif,scale=hd1080,setsar=1[b]; \
[b][1:v]overlay=main_w-overlay_w-10:main_h-overlay_h-10" \
-c:v libx264 -preset veryfast -b:v 4000k -minrate 4000k -maxrate 4000k -bufsize 11835k \
-c:a mp3 -b:a 128k -f mpegts "dest"

Resources