Hello guys !
I wanted to know how to loop a video with a script so I can make with my VM Instance a Youtube Live 7/7j without touching anything else more.
I used this script used in one of your video :
#! /bin/bash VBR=โ2500kโ FPS=โ30โณ QUAL=โsuperfastโ YOUTUBE_URL=โrtmp://a.rtmp.youtube.com/live2โณ KEY=โ????โ VIDEO_SOURCE=โ/home/ubuntu/live_session.mp4โณ AUDIO_SOURCE=โ/home/ubuntu/livesound.mp3โณ ffmpeg \\ -re -f lavfi -i โmovie=filename=$VIDEO_SOURCE:loop=2, setpts=N/(FRAME_RATE*TB)โ \\ -thread_queue_size 512 -i โ$AUDIO_SOURCEโ \\ -map 0:v:0 -map 1:a:0 \\ -map_metadata:g 1:g \\ -vcodec libx264 -pix_fmt yuv420p -preset $QUAL -r $FPS -g $(($FPS * 2)) -b:v $VBR \\ -acodec libmp3lame -ar 44100 -threads 6 -qscale:v 3 -b:a 320000 -bufsize 512k \\ -f flv โ$YOUTUBE_URL/$KEYโ
The problem here is when my stream reach the end of the mp4 file it didn't loop and the stream seems to crash or something else. So I wanted to know if there is a script that works for looping a mp4,mp3 files and maybe a command to add that restart my stream and play my video at 00:00.
The problem here is when my stream reach the end of the mp4 file it didnโt loop and the stream seems to crash or something else.
So I wanted to know if there is a script that works for looping a mp4,mp3 files and maybe a command to add that restart my stream and play my video at 00:00.
See lessThis code will help you to loop the process. ย #! /bin/bash while true do VBR=โ2500kโ FPS=โ30โณ QUAL=โsuperfastโ YOUTUBE_URL=โrtmp://a.rtmp.youtube.com/live2โณ KEY=โ????โ VIDEO_SOURCE=โ/home/ubuntu/live_session.mp4โณ AUDIO_SOURCE=โ/home/ubuntu/livesound.mp3โณ ffmpeg \\ -re -f lavfi -i โmovie=filenaRead more
This code will help you to loop the process.
ย
#! /bin/bash
while true
do
VBR=โ2500kโ FPS=โ30โณ QUAL=โsuperfastโ YOUTUBE_URL=โrtmp://a.rtmp.youtube.com/live2โณ KEY=โ????โ VIDEO_SOURCE=โ/home/ubuntu/live_session.mp4โณ AUDIO_SOURCE=โ/home/ubuntu/livesound.mp3โณ ffmpeg \\ -re -f lavfi -i โmovie=filename=$VIDEO_SOURCE:loop=2, setpts=N/(FRAME_RATE*TB)โ \\ -thread_queue_size 512 -i โ$AUDIO_SOURCEโ \\ -map 0:v:0 -map 1:a:0 \\ -map_metadata:g 1:g \\ -vcodec libx264 -pix_fmt yuv420p -preset $QUAL -r $FPS -g $(($FPS * 2)) -b:v $VBR \\ -acodec libmp3lame -ar 44100 -threads 6 -qscale:v 3 -b:a 320000 -bufsize 512k \\ -f flv โ$YOUTUBE_URL/$KEYโ
done
See less