Unknown decoder 'libx264'
Asked Answered
E

1

14

I have ffmpeg with libx264 enabled from BtbN for Windows 10. This is the command:

ffmpeg -f gdigrab -c:v libx264 -framerate 30 -i title="FiveM" -f flv rtmp://MYSITE.COM/stream/MYSECRETKEY

Unfortunately I get this output:

Unknown decoder 'libx264'
Exarchate answered 29/10, 2020 at 19:21 Comment(0)
U
16

Position of options is important:

ffmpeg [input options] -i input [output options] output

You are trying to apply -c:v libx264 to the input, but you should apply it to the output:

ffmpeg -f gdigrab -framerate 30 -i title="FiveM" -c:v libx264 -f flv rtmp://MYSITE.COM/stream/MYSECRETKEY

With some suggested options added:

ffmpeg -f gdigrab -framerate 30 -i title="FiveM" -c:v libx264 -vf format=yuv420p -g 60 -b:v 3000k -maxrate 3000k -bufsize 6000k -f flv rtmp://MYSITE.COM/stream/MYSECRETKEY

Some services require audio, so you can add silent audio if needed:

ffmpeg -f gdigrab -framerate 30 -i title="FiveM" -re -f lavfi -i anullsrc -c:v libx264 -c:a aac -vf format=yuv420p -g 60 -b:v 3000k -maxrate 3000k -bufsize 6000k -f flv rtmp://MYSITE.COM/stream/MYSECRETKEY
Unhorse answered 29/10, 2020 at 19:37 Comment(3)
Thank you very much sir :-)Exarchate
thanks for this real helpful ... why is -vf format=yuv420p applied to the output? sorry im such a noobJany
@Jany For chroma subsampling that all players can handle. Otherwise libx264 will try to preserve color info but most players can't play advanced pixel formats.Unhorse

© 2022 - 2024 — McMap. All rights reserved.