Instantly share code, notes, and snippets.

Embed
What would you like to do?
Stream video to youtube via ffmpeg
#! /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"
@fahhu

This comment has been minimized.

Show comment
Hide comment
@fahhu

fahhu Aug 15, 2015

hi, great solution! But i'm don't understand the "Source" parameter..? I would stream from my local webcam to the youtube life stream. maybe you can help me with a little tip? thanks

fahhu commented Aug 15, 2015

hi, great solution! But i'm don't understand the "Source" parameter..? I would stream from my local webcam to the youtube life stream. maybe you can help me with a little tip? thanks

@MaoX17

This comment has been minimized.

Show comment
Hide comment
@MaoX17

MaoX17 Oct 28, 2015

Hi olasd,
thank you for your great solution.
I've tried your solution, but my streaming start after about 15-30 seconds and stop before the end of the video that i use as source.
Can you tell me how to solve?
Thank you very much

MaoX17 commented Oct 28, 2015

Hi olasd,
thank you for your great solution.
I've tried your solution, but my streaming start after about 15-30 seconds and stop before the end of the video that i use as source.
Can you tell me how to solve?
Thank you very much

@karthigamahe

This comment has been minimized.

Show comment
Hide comment
@karthigamahe

karthigamahe Jan 8, 2016

Hi olasd,
What is the use of this file .
Can you explain me,,

karthigamahe commented Jan 8, 2016

Hi olasd,
What is the use of this file .
Can you explain me,,

@sburns90

This comment has been minimized.

Show comment
Hide comment
@sburns90

sburns90 Jan 25, 2016

@fahhu
The "Source" parameter in this specific example is a UDP multicast stream (likely from another FFMPEG enabled device)
If you would like to use another source such as your desktop see the FFMPEG guide on streaming https://trac.ffmpeg.org/wiki/Capture/Desktop
Note: -i is the operator specific the input device or source

@MaoX17
What is the upload and download speed on the connection you are using. You can run a test over at SpeedTest.net to find out.

@karthigamahe
This is a script for a unix based computer (likely Linux), to send a UDP multicast stream to YouTube.

sburns90 commented Jan 25, 2016

@fahhu
The "Source" parameter in this specific example is a UDP multicast stream (likely from another FFMPEG enabled device)
If you would like to use another source such as your desktop see the FFMPEG guide on streaming https://trac.ffmpeg.org/wiki/Capture/Desktop
Note: -i is the operator specific the input device or source

@MaoX17
What is the upload and download speed on the connection you are using. You can run a test over at SpeedTest.net to find out.

@karthigamahe
This is a script for a unix based computer (likely Linux), to send a UDP multicast stream to YouTube.

@pstoll

This comment has been minimized.

Show comment
Hide comment
@pstoll

pstoll Feb 27, 2016

fwiw recent version of ffmpeg now complain about that command line. you need to modify -qscale to -qscale:v. It complains about -qscale being ambiguous.

pstoll commented Feb 27, 2016

fwiw recent version of ffmpeg now complain about that command line. you need to modify -qscale to -qscale:v. It complains about -qscale being ambiguous.

@pythonjohn

This comment has been minimized.

Show comment
Hide comment
@pythonjohn

pythonjohn May 10, 2016

What if the source is a local usb webcam?
Or what if it is a local video file?

pythonjohn commented May 10, 2016

What if the source is a local usb webcam?
Or what if it is a local video file?

@smac89

This comment has been minimized.

Show comment
Hide comment
@smac89

smac89 Jun 22, 2016

@fahhu, to stream from webcam, set the SOURCE to this

SOURCE='/dev/video0'

smac89 commented Jun 22, 2016

@fahhu, to stream from webcam, set the SOURCE to this

SOURCE='/dev/video0'

@mkalte666

This comment has been minimized.

Show comment
Hide comment
@mkalte666

mkalte666 Jul 21, 2016

If you stream from a file, use the -re parameter. I didn't and having stuff going faster than they should is kinda awkward, especially if your stream includes a countdown.

mkalte666 commented Jul 21, 2016

If you stream from a file, use the -re parameter. I didn't and having stuff going faster than they should is kinda awkward, especially if your stream includes a countdown.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jul 23, 2016

fanks :)

ghost commented Jul 23, 2016

fanks :)

@codex-corp

This comment has been minimized.

Show comment
Hide comment
@codex-corp

codex-corp Nov 1, 2016

it works with m3u8 as well .

codex-corp commented Nov 1, 2016

it works with m3u8 as well .

@9xcoder

This comment has been minimized.

Show comment
Hide comment
@9xcoder

9xcoder Dec 28, 2016

Good, worked with me
i want stream a playlist video on server, can you help me change this script ?
Thanks

9xcoder commented Dec 28, 2016

Good, worked with me
i want stream a playlist video on server, can you help me change this script ?
Thanks

@leonirlopes

This comment has been minimized.

Show comment
Hide comment
@leonirlopes

leonirlopes Feb 23, 2017

Very grateful for your contribution.
And I managed to broadcast to Facebook Live

leonirlopes commented Feb 23, 2017

Very grateful for your contribution.
And I managed to broadcast to Facebook Live

@Mildwhale

This comment has been minimized.

Show comment
Hide comment
@Mildwhale

Mildwhale Feb 24, 2017

Nice, it work.
Thanks!

Mildwhale commented Feb 24, 2017

Nice, it work.
Thanks!

@hohaidang

This comment has been minimized.

Show comment
Hide comment
@hohaidang

hohaidang Mar 11, 2017

Hello,
I downloaded your source code and changed a little bit as fit as my require. But in youtube website just show "It's working" and just have a black monitor I was waiting for a long time and no difference. Please help me. Something wrong?

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
URL="http://localhost:8090/feed1.ffm"
SOURCE="/home/hohaidang/Helicopter_DivXHT_ASP.divx"              # Source UDP (voir les annonces SAP)
KEY="291d-5hz9-fkku-8jvc"                                     # 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"

hohaidang commented Mar 11, 2017

Hello,
I downloaded your source code and changed a little bit as fit as my require. But in youtube website just show "It's working" and just have a black monitor I was waiting for a long time and no difference. Please help me. Something wrong?

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
URL="http://localhost:8090/feed1.ffm"
SOURCE="/home/hohaidang/Helicopter_DivXHT_ASP.divx"              # Source UDP (voir les annonces SAP)
KEY="291d-5hz9-fkku-8jvc"                                     # 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"
@GitItAgain

This comment has been minimized.

Show comment
Hide comment
@GitItAgain

GitItAgain Mar 16, 2017

@hohaidang You should edit your post to remove the youtube key. Posting the youtube key will allow others to stream to your youtube account.

Also, are you running the ffmpeg stream through ffserver? ("URL="http://localhost:8090/feed1.ffm")

GitItAgain commented Mar 16, 2017

@hohaidang You should edit your post to remove the youtube key. Posting the youtube key will allow others to stream to your youtube account.

Also, are you running the ffmpeg stream through ffserver? ("URL="http://localhost:8090/feed1.ffm")

@brrrrain

This comment has been minimized.

Show comment
Hide comment
@brrrrain

brrrrain Apr 6, 2017

Thanks! It's very helpful!

brrrrain commented Apr 6, 2017

Thanks! It's very helpful!

@quky

This comment has been minimized.

Show comment
Hide comment
@quky

quky Aug 13, 2017

thanks for the script how can i stop it ones i got it running.

quky commented Aug 13, 2017

thanks for the script how can i stop it ones i got it running.

@zardoz01

This comment has been minimized.

Show comment
Hide comment
@zardoz01

zardoz01 Aug 15, 2017

'q' to quit works for me.

zardoz01 commented Aug 15, 2017

'q' to quit works for me.

@shikagemew

This comment has been minimized.

Show comment
Hide comment
@shikagemew

shikagemew Sep 2, 2017

Hi everyone,
Can you help me? I have a question.
I need to live stream some videos in 1 folder on youtube by ffmpeg.
This is code live all video (*.mp4) in 1 folder
But I need live random video all of them, and loop forever to live stream 24/7 .
For example: with 4 video ( 3-2-4-1 and loop 2-1-3-4 and loop 1-4-3-2,.....)

@ECHO OFF
Setlocal EnableDelayedExpansion
: path to ffmpeg
set ffmpeg=C:\FMPEG\bin\ffmpeg.exe
: path to ffmpeg
set INPUT=C:\input
set OUTPUT=C:\output
: encode video
for %%i in (*.mp4) DO “%ffmpeg%” -re -i “%%i” -vcodec libx264 -preset veryfast -maxrate 2500k -bufsize 3368k -vf “format=yuv420p” -g 60 -acodec libmp3lame -b:a 198k -ar 44100 -metadata title=”” -metadata artist=”” -metadata album_artist=”” -metadata album=”” -metadata date=”” -metadata track=”” -metadata genre=”” -metadata publisher=”” -metadata encoded_by=”” -metadata copyright=”” -metadata composer=”” -metadata performer=”” -metadata TIT1=”” -metadata TIT3=”” -metadata disc=”” -metadata TKEY=”” -metadata TBPM=”” -metadata language=”eng” -metadata encoder=”” -f flv -s 1280×720 “rtmp://a.rtmp.youtube.com/live2/xxxx-xxxx-xxxx-xxxx”

shikagemew commented Sep 2, 2017

Hi everyone,
Can you help me? I have a question.
I need to live stream some videos in 1 folder on youtube by ffmpeg.
This is code live all video (*.mp4) in 1 folder
But I need live random video all of them, and loop forever to live stream 24/7 .
For example: with 4 video ( 3-2-4-1 and loop 2-1-3-4 and loop 1-4-3-2,.....)

@ECHO OFF
Setlocal EnableDelayedExpansion
: path to ffmpeg
set ffmpeg=C:\FMPEG\bin\ffmpeg.exe
: path to ffmpeg
set INPUT=C:\input
set OUTPUT=C:\output
: encode video
for %%i in (*.mp4) DO “%ffmpeg%” -re -i “%%i” -vcodec libx264 -preset veryfast -maxrate 2500k -bufsize 3368k -vf “format=yuv420p” -g 60 -acodec libmp3lame -b:a 198k -ar 44100 -metadata title=”” -metadata artist=”” -metadata album_artist=”” -metadata album=”” -metadata date=”” -metadata track=”” -metadata genre=”” -metadata publisher=”” -metadata encoded_by=”” -metadata copyright=”” -metadata composer=”” -metadata performer=”” -metadata TIT1=”” -metadata TIT3=”” -metadata disc=”” -metadata TKEY=”” -metadata TBPM=”” -metadata language=”eng” -metadata encoder=”” -f flv -s 1280×720 “rtmp://a.rtmp.youtube.com/live2/xxxx-xxxx-xxxx-xxxx”
@DedaDev

This comment has been minimized.

Show comment
Hide comment
@DedaDev

DedaDev Sep 18, 2017

I need also way to stream multiple videos :/

DedaDev commented Sep 18, 2017

I need also way to stream multiple videos :/

@Cyxo

This comment has been minimized.

Show comment
Hide comment
@Cyxo

Cyxo Oct 17, 2017

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#filter

Here 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

Cyxo commented Oct 17, 2017

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#filter

Here 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

@dokomade9921

This comment has been minimized.

Show comment
Hide comment
@dokomade9921

dokomade9921 Oct 18, 2017

@p4ulolol how to keep script repeatedly? for example 1 folder there are 10 videos. then 10 videos are playing and will be played back until I stopped ffmpeg process by myself. How ?

dokomade9921 commented Oct 18, 2017

@p4ulolol how to keep script repeatedly? for example 1 folder there are 10 videos. then 10 videos are playing and will be played back until I stopped ffmpeg process by myself. How ?

@Cyxo

This comment has been minimized.

Show comment
Hide comment
@Cyxo

Cyxo Oct 18, 2017

@dokomade9921 well I don't really know. You can either add an infinite while loop arround the ffmpeg command, but I think you won't be ablento stop it until you stop the script using a command from another terminal. Else you can add a while loop or for loop around these lines :

for f in $FOLDER/*.mp4
...
done

with a lot of iterations, that should generate a very long playlist, probably longer than you need. But in this case I don't know what is the character limit of a variable or of a command if there is one.

That's also why I hope people will improve it 🙂
By the way people, you can fork it right here (and also comment for help, if you don't want to flood this gist) :
https://gist.github.com/p4ulolol/e4192f58e738446f3491d839eaa50ed7

Cyxo commented Oct 18, 2017

@dokomade9921 well I don't really know. You can either add an infinite while loop arround the ffmpeg command, but I think you won't be ablento stop it until you stop the script using a command from another terminal. Else you can add a while loop or for loop around these lines :

for f in $FOLDER/*.mp4
...
done

with a lot of iterations, that should generate a very long playlist, probably longer than you need. But in this case I don't know what is the character limit of a variable or of a command if there is one.

That's also why I hope people will improve it 🙂
By the way people, you can fork it right here (and also comment for help, if you don't want to flood this gist) :
https://gist.github.com/p4ulolol/e4192f58e738446f3491d839eaa50ed7

@dokomade9921

This comment has been minimized.

Show comment
Hide comment
@dokomade9921

dokomade9921 Oct 18, 2017

@p4ulolol I also can not overcome this. because I do not understand the script so I am confused. so can you load this script to run on linux?

: Batch Render Youtube Video Reup
: Settings for x264 video and mp3 Audio

@echo OFF
Setlocal EnableDelayedExpansion

: path to ffmpeg
set ffmpeg=C:\FMPEG\bin\ffmpeg.exe

: path to ffmpeg
set INPUT=C:\input
set OUTPUT=C:\output

: encode video
for %%i in (*.mp4) DO "%ffmpeg%" -re -i "%%i" -vcodec libx264 -preset veryfast -maxrate 2500k -bufsize 3368k -vf "format=yuv420p" -g 60 -acodec libmp3lame -b:a 198k -ar 44100 -metadata title="" -metadata artist="" -metadata album_artist="" -metadata album="" -metadata date="" -metadata track="" -metadata genre="" -metadata publisher="" -metadata encoded_by="" -metadata copyright="" -metadata composer="" -metadata performer="" -metadata TIT1="" -metadata TIT3="" -metadata disc="" -metadata TKEY="" -metadata TBPM="" -metadata language="eng" -metadata encoder="" -f flv -s 1280x720 "rtmp://a.rtmp.youtube.com/live2/3xd5-9yeg-mw0z-29k7"

please help me so i can make sh file for linux. because i am a linux user not windows.

dokomade9921 commented Oct 18, 2017

@p4ulolol I also can not overcome this. because I do not understand the script so I am confused. so can you load this script to run on linux?

: Batch Render Youtube Video Reup
: Settings for x264 video and mp3 Audio

@echo OFF
Setlocal EnableDelayedExpansion

: path to ffmpeg
set ffmpeg=C:\FMPEG\bin\ffmpeg.exe

: path to ffmpeg
set INPUT=C:\input
set OUTPUT=C:\output

: encode video
for %%i in (*.mp4) DO "%ffmpeg%" -re -i "%%i" -vcodec libx264 -preset veryfast -maxrate 2500k -bufsize 3368k -vf "format=yuv420p" -g 60 -acodec libmp3lame -b:a 198k -ar 44100 -metadata title="" -metadata artist="" -metadata album_artist="" -metadata album="" -metadata date="" -metadata track="" -metadata genre="" -metadata publisher="" -metadata encoded_by="" -metadata copyright="" -metadata composer="" -metadata performer="" -metadata TIT1="" -metadata TIT3="" -metadata disc="" -metadata TKEY="" -metadata TBPM="" -metadata language="eng" -metadata encoder="" -f flv -s 1280x720 "rtmp://a.rtmp.youtube.com/live2/3xd5-9yeg-mw0z-29k7"

please help me so i can make sh file for linux. because i am a linux user not windows.

@Cyxo

This comment has been minimized.

Show comment
Hide comment
@Cyxo

Cyxo Oct 19, 2017

@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)

Cyxo commented Oct 19, 2017

@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)

@Rietveldd

This comment has been minimized.

Show comment
Hide comment
@Rietveldd

Rietveldd Nov 10, 2017

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 commented Nov 10, 2017

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?

@IRISMusic

This comment has been minimized.

Show comment
Hide comment
@IRISMusic

IRISMusic Dec 4, 2017

what is the source for the screen to be casted or is it default

IRISMusic commented Dec 4, 2017

what is the source for the screen to be casted or is it default

@robmorin

This comment has been minimized.

Show comment
Hide comment
@robmorin

robmorin Jan 11, 2018

What about if i want to use my shoutcast radio stream, rather than a video source or file source? Is this possible?

robmorin commented Jan 11, 2018

What about if i want to use my shoutcast radio stream, rather than a video source or file source? Is this possible?

@amankumarjain

This comment has been minimized.

Show comment
Hide comment
@amankumarjain

amankumarjain Mar 3, 2018

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

amankumarjain commented Mar 3, 2018

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

@2LuckyLuke

This comment has been minimized.

Show comment
Hide comment
@2LuckyLuke

2LuckyLuke Mar 24, 2018

"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 commented Mar 24, 2018

"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?

@saconni

This comment has been minimized.

Show comment
Hide comment
@saconni

saconni Apr 22, 2018

@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"

saconni commented Apr 22, 2018

@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"
@HaNiTLG

This comment has been minimized.

Show comment
Hide comment
@HaNiTLG

HaNiTLG Sep 11, 2018

Why is the speed of the stream so high?
The speed is always 3-5 times faster than normal, how can I fix this?

HaNiTLG commented Sep 11, 2018

Why is the speed of the stream so high?
The speed is always 3-5 times faster than normal, how can I fix this?

@alexey-v-paramonov

This comment has been minimized.

Show comment
Hide comment
@alexey-v-paramonov

alexey-v-paramonov Sep 20, 2018

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?

alexey-v-paramonov commented Sep 20, 2018

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment