Answer the question
In order to leave comments, you need to log in
ffmpeg stream from looped video and audio to youtube(rtmp)?
Hello! How to start a stream on youtube, while having a video file lasting 3 seconds and mp3 audio? I know how to stream just over a video file with sound, and from a webcam, but I'm powerless here. At random, I realized that in order for the stream to go without stopping, the video or picture must be looped. I am aware of stream_loop -1, however, the error "Operation not allowed" comes out, after that I made ts from my mp4 and tried to start the stream (also with stream_loop), this error did not exist and ffmpeg started the stream, only here youtube it did not pick up - "broadcast is started".
In general, there is an mp4 file and mp3, you need to endlessly loop the video and start mp3, then send it to rtmp:youtube.
Help me please
I figured it out halfway - the stream passes, you can see the picture and hear the audio, but not for long - about a second, then the download on the player just spins and that's it.
Simplified as much as possible:
ffmpeg -stream_loop -1 -i video.gif -i audio.mp3 -c:v libx264 -f flv rtmp://a.rtmp.youtube.com/live2/key
Answer the question
In order to leave comments, you need to log in
stream.sh (stream in 1080p):
value=`cat mylist.txt`
ffmpeg -stream_loop -1 -thread_queue_size 1500 -i stream.mp4 -stream_loop -1 -i "$value" -shortest -map 0:v:0 -map 1:a:0? -acodec aac -pix_fmt yuv420p -vcodec libx264 -b:v 500k -crf 35 -intra-refresh 1 -g 1 -filter:v "scale=-1:1080" -r 5 -preset ultrafast -tune zerolatency -err_detect ignore_err -truncate 0 -f flv "rtmp"
from youtube_dl import YoutubeDL
from os import system
while True:
with YoutubeDL({}) as ydl:
file = open('url.txt', 'r')
url=file.read()
file.close()
song_info = ydl.extract_info(url, download=False)
su=song_info["formats"][0]["url"]
file = open('mylist.txt', 'w')
file.write(su)
file.close()
system('sh stream.sh')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question