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