1

its my first post on this community.

Im from brazil, so im sorry for bad english.

I am using FFMPEG on Ubuntu VPS for streaming 24/7 mp4 video on youtube.

I am using this code:

VBR="2500k"                                    
FPS="30"                                    
QUAL="veryfast"                              
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2"

SOURCE="/stream/video.mp4"           
KEY="my_Secret_key"                               

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"

With this code, i have sucesfully put my stream online, but i need that the code loop and repeat the mp4 file, because i dont want to make a 24h mp4 file.

How can i make that this mp4 file (SOURCE="/stream/video.mp4") repeat itself infinitely?

I dont have imagens and notthing, i only put a mp4 file on stream!

Ideas?

1 Answer 1

4

You should be able to achieve this by prepending the source with stream_loop parameter and -1 value specifying indefinite looping.

Replace

-i "$SOURCE" -deinterlace \

with

-stream_loop -1 -i "$SOURCE" -deinterlace \

See https://ffmpeg.org/ffmpeg.html#Main-options

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.