-
-
Save olasd/9841772 to your computer and use it in GitHub Desktop.
#! /bin/bash | |
# | |
# Diffusion youtube avec ffmpeg | |
# Configurer youtube avec une résolution 720p. La vidéo n'est pas scalée. | |
VBR="2500k" # Bitrate de la vidéo en sortie | |
FPS="30" # FPS de la vidéo en sortie | |
QUAL="medium" # Preset de qualité FFMPEG | |
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2" # URL de base RTMP youtube | |
SOURCE="udp://239.255.139.0:1234" # Source UDP (voir les annonces SAP) | |
KEY="...." # Clé à récupérer sur l'event youtube | |
ffmpeg \ | |
-i "$SOURCE" -deinterlace \ | |
-vcodec libx264 -pix_fmt yuv420p -preset $QUAL -r $FPS -g $(($FPS * 2)) -b:v $VBR \ | |
-acodec libmp3lame -ar 44100 -threads 6 -qscale 3 -b:a 712000 -bufsize 512k \ | |
-f flv "$YOUTUBE_URL/$KEY" |
Mine keeps saying the stream is starting but never does. when i look at the "health" of the YouTube stream it says its not receiving data. at the start of the stream the "health" of it is green the a short time later is gray. Any idea on how to fix this?
what is the source for the screen to be casted or is it default
What about if i want to use my shoutcast radio stream, rather than a video source or file source? Is this possible?
Hi, my source url is another rtmp server, how to send stream to youtube from another rtmp server, please help.
ffmpeg -i rtmp://{url}/live/ -f flv rtmp://a.rtmp.youtube.com/live2/key is not working
"Mine keeps saying the stream is starting but never does. when i look at the "health" of the YouTube stream it says its not receiving data. at the start of the stream the "health" of it is green the a short time later is gray. Any idea on how to fix this?"
@Rietveldd
Same problem here. Can someone help?
@2LuckyLuke I had the same problem and I realized that, in my case, youtube didn't like non-audio streams. If you are using a non-audio source (screen capturing, or testsrc) add a null audio source. These are my ffmpeg arguments (I'm on windows):
ffmpeg ^
-re -f lavfi -i testsrc=size=768x432:rate=30 -deinterlace ^
-f lavfi -i anullsrc ^
-vcodec libx264 -pix_fmt yuv420p -preset veryfast -r 30 -g 60 -b:v "1000k" ^
-acodec libmp3lame -ar 44100 -b:a 128k ^
-f flv "rtmp://a.rtmp.youtube.com/live2/key"
Why is the speed of the stream so high?
The speed is always 3-5 times faster than normal, how can I fix this?
I wonder if there is away to hide YouTube key from the command line. Running ffmpeg
like this can make your key visible to other system users, they can do ps -Af
and see your key (if they have enough privileges on the system) in the process list.
A possible solution could be reading the target YouTube url from a file, is it possible?
hi i need to know how to stream or go live to youtube with a downloaded or recorded video 24*7 but without turning the computer on for 24 hours (i.e offline)
please help
@joseph488 This thread already has all you need. If you don't want to run the stream from your computer 24/7, get a VPS and run the script from there.
Stream no sound. How can I fix this problem? @olasd
i have try the code of @Cyxo but i have a error a anybody to help me ?
Please use -q:a or -q:v, -qscale is ambiguous
Stream mapping:
Stream #0:0 (h264) -> concat:in0:v0
Stream #0:1 (aac) -> concat:in0:a0
Stream #1:0 (h264) -> concat:in1:v0
Stream #1:1 (aac) -> concat:in1:a0
concat:out:v0 -> Stream #0:0 (libx264)
concat:out:a0 -> Stream #0:1 (libmp3lame)
Press [q] to stop, [?] for help
[Parsed_concat_0 @ 0x55652e0b4ca0] Input link in1:v0 parameters (size 1920x1080, SAR 1:1) do not match the corresponding output link in0:v0 parameters (640x480, SAR 1:1)
[Parsed_concat_0 @ 0x55652e0b4ca0] Failed to configure output pad on Parsed_concat_0
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #1:0
Conversion failed!
edit: i have gess !
hey @Cyxo
Hey everyone ( @dedaloodak , @shikagemew ) ! For those who want to make a youtube radio, I made a little script which plays all .mp4 files in a folder.
For a radio, you could heavily imporve it by randomizing the order of the files in the for loop (I don't know if it's feasible), or by having a continuous stream with a fifo or something (I don't master it really well). By the way, here is where I found the trick : https://trac.ffmpeg.org/wiki/Concatenate#filterHere is the script :
#! /bin/bash # # Diffusion youtube avec ffmpeg # Configurer youtube avec une résolution 720p. La vidéo n'est pas scalée. VBR="2500k" # Bitrate de la vidéo en sortie FPS="30" # FPS de la vidéo en sortie QUAL="medium" # Preset de qualité FFMPEG YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2" # URL de base RTMP youtube FOLDER="videos" # Dossier source KEY="PUT YOUR KEY THERE" # Clé à récupérer sur l'event youtube SOURCE="" n=0 filter="" for f in $FOLDER/*.mp4 do SOURCE="$SOURCE -i $f" filter="$filter [$n:v:0] [$n:a:0]" ((n++)) done filter="$filter concat=n=$n:v=1:a=1 [v] [a]" echo "ffmpeg $SOURCE -filter_complex '$filter'" ffmpeg \ $SOURCE -filter_complex "$filter" \ -map "[v]" -map "[a]" -deinterlace \ -vcodec libx264 -pix_fmt yuv420p -preset $QUAL -r $FPS -g $(($FPS * 2)) -b:v $VBR \ -acodec libmp3lame -ar 44100 -threads 6 -qscale 3 -b:a 712000 -bufsize 512k \ -f flv "$YOUTUBE_URL/$KEY"
Let me know if you do any improvement, I'll be glad to use them
i am getting this error
[concat @ 0x5573f4b41040] Value 0.000000 for parameter 'n' out of range [1 - 2.14748e+09] Last message repeated 1 times [concat @ 0x5573f4b41040] Error setting option n to value 0. [Parsed_concat_0 @ 0x5573f4b2f240] Error applying options to the filter. [AVFilterGraph @ 0x5573f4b24de0] Error initializing filter 'concat' with args 'n=0:v=1:a=1' Error initializing complex filters. Numerical result out of range
how to run this file in ubuntu
How much resources does it consume???
how to run this file in ubuntu
https://linuxforever.info/2017/05/06/how-to-live-stream-to-youtube-from-linux-mint-ubuntu/
A complete tutorial
HI
is it possible to set my source as another live video? eg: live video url from Facebook something like https://www.facebook.com/groupname/videos/590993838218530/
looks cool
but cannot get it going yet
restream video from
http://Arduino.TK
is it possible to set my source as another live video? eg: live video url from Facebook something like https://www.facebook.com/groupname/videos/590993838218530/
Interested by any answer too, I tried with piping from youtube-dl with no luck.
is it possible to set my source as another live video? eg: live video url from Facebook something like https://www.facebook.com/groupname/videos/590993838218530/
Interested by any answer too, I tried with piping from youtube-dl with no luck.
im here looking for answers too, im currently trying to write code using FFMPEG & youtube-dl, and i seem to have that part ok, but i really want to stream from a URL like @bentech4u wants to do also.. hopefully someone in this community can figure it out. best of luck all.
Please how can I stream a website URL (like an ongoing video conference url ) to youtube using FFmpeg
@faraamcode you could (if supported) first get the feed down via streamlink, then pipe it into ffmpeg.
@bentech4u Copy M3U8 from facebook live thats all also if both video , audio streams are libx264, aac respectively then no need for re-encoding stream to youtube rtmp
if not then you need to encode codecs suggested by youtube
damn man why the hell you reported my question 🤨🤨
It can be as simple as ffmpeg -i "<YOUR_SOURCE>" -f flv "rtmp://a.rtmp.youtube.com/live2/<YOUR_STREAM_KEY>"
The other stuff just adds extra control. You may or may not need it depending on your needs.
@dokomade9921 Well your script does almost the same thing as mine, just in different way. All you have to do is to set FOLDER to
"."
. In any case, your script won't keep the live stream alive forever, it will only loop once through all the files and play them (I even wonder if it doesn't stop the stream and restart it between each file, which is not great)