FFmpeg Live Stream - Loop Video?

ffmpeg loop video forever
ffmpeg stream webcam
ffmpeg -loop image
ffmpeg rtsp streaming example
ffmpeg streaming
ffmpeg stream audio
ffmpeg make video longer
ffmpeg rtp streaming

I am trying to stream a video loop to justin.tv using FFmpeg? I have managed to loop an image sequence and combine it with line in audio:

ffmpeg -loop 1 -i imageSequence%04d.jpg -f alsa -ac 2 -ar 22050 -ab 64k \
  -i pulse -acodec adpcm_swf -r 10 -vcodec flv \
  -f flv rtmp://live.justin.tv/app/<yourStreamKeyHere>

Is it possible to do this with a video file?

Definitely possible. In the recent versions of ffmpeg they have added a -stream_loop flag that allows you to loop the input as many times as required.

The gotcha is that if you don't regenerate the pts from the source, ffmpeg will drop frames after the first loop (as the timestamp will suddenly go back in time). To avoid this, you need to tell ffmpeg to generate the pts so you get an increasing timestamp between loops. This is done with the +genpts call (it has to be before the -i arg).

Here's an example ffmpeg call (replace $F with your input file). This example generates two output streams and the -stream_loop -1 argument tells ffmpeg to continuously loop the input. The output in this case is for a similar stream broadcast ingest (MetaCDN), adjust accordingly to your requirements.

ffmpeg -threads 2 -re -fflags +genpts -stream_loop -1 -i $F \
-s 640x360 -ac 2 -f flv -vcodec libx264 -profile:v baseline -b:v 600k -maxrate 600k -bufsize 600k -r 24 -ar 44100 -g 48 -c:a libfdk_aac -b:a 64k "rtmp://publish.live.metacdn.com/2050C7/dfsdfsd/lowquality_664?hello&adbe-live-event=lowquality_" \
-s 1920x1080 -ac 2 -f flv -vcodec libx264 -profile:v baseline -b:v 2000k -maxrate 2000k -bufsize 2000k -r 24 -ar 44100 -g 48 -c:a libfdk_aac -b:a 64k "rtmp://publish.live.metacdn.com/2050C7/dfsdfsd/highquality_2064?mate&adbe-live-event=highquality_"

Make ffmpeg loop video indefinitely while streaming, Try ffmpeg -stream_loop -1 -i input {-rest of your parameters} -f flv rtmp://output. I am trying to stream a video loop to justin.tv using FFmpeg? I have managed to loop an image sequence and combine it with line in audio: ffmpeg -loop 1 -i imageSequence%04d.jpg -f alsa -ac 2 -ar

Sinclair Media has found a solution by using the lavfi filter and appending :loop=0 to the file name :

This is untested:

ffmpeg -f lavfi -re -i movie=StreamTest.avi:loop=0 \
-acodec libfaac -b:a 64k -pix_fmt yuv420p -vcodec libx264 \ 
-x264opts level=41 -r 25 -profile:v baseline -b:v 1500k  \ 
-maxrate 2000k -force_key_frames 50 -s 640×360 -map 0 -flags \ 
-global_header -f segment -segment_list index_1500.m3u8 \ 
-segment_time 10 -segment_format mpeg_ts \
-segment_list_type m3u8 segmented.ts

But it should create a local "index_1500.m3u8" file that streams the video in "StreamTest.avi".

Repeat/loop Input Video with ffmpeg?, Concat demuxer. This allows you to loop an input without needing to re-encode. Make a text file. Contents of an example text file to repeat 4 times. FFMPEG tools to broadcast live stream For live video streamapplications, FFMPEG provides a variety of options. In particular, FFMPEG can access any video and audio streams that are accessible to your computer. These include webcams, USB microphones, and cameras that connect via capture cards.

I just reuse the Rob's answers with a few of modifications in order to provide a file to live streaming

ffmpeg -threads 2 -re -fflags +genpts -stream_loop -1 -i gvf.mp4 -c copy -f mpegts -mpegts_service_id 102 -metadata service_name=My_channel -metadata service_provider=My_Self -max_interleave_delta 0 -use_wallclock_as_timestamps 1 -flush_packets 1 "udp://233.0.0.1:1001?localaddr=10.60.4.237&pkt_size=188"

streaming media solutions » loop a video with live , the goal: use ffmpeg to stream audio from shoutcast and a video loop to ustream.​tv, justin.tv, twitch.tv, youtube, wowza, flash media server, etc. because ffmpeg  ffmpeg -re -stream_loop -1 -i file.flv -c copy -f flv rtmp://x.y.z This option is buggy when the input it is applied to is filtered with another input, like in an overlay. For a single input - output chain, it works fine.

[FFmpeg-user] Infinite loop randomized stream to rtmp server, unfortunately, i still dont think there is way to 'loop' a video or a playlist of videos​. it will work with images using -loop 1. you were pretty close  ffmpeg handles RTMP streaming as input or output, and it's working well.. I want to stream some videos (a dynamic playlist managed by a python script) to a RTMP server, and i'm currently doing something quite simple: streaming my videos one by one with FFMPEG to the RTMP server, however this causes a connection break every time a video end, and the stream is ready to go when the next video begins.

ffmpeg Documentation, ffmpeg is a very fast video and audio converter that can also grab from a live E.g. 2:3 refers to the fourth stream in the third input file. -loglevel +repeat. Browse other questions tagged video ffmpeg youtube video-streaming live-streaming or ask your own question. The Overflow Blog Podcast 241: New tools for new times

FFmpeg Formats Documentation, In case of live network streams, if you force format, you may use live_flv Set the frame rate for the video stream. It defaults to 25. loop. If set to 1, loop over the  FFmpeg and its photosensitivity filter are not making any medical claims. That said, this is a new video filter that may help photosensitive people watch tv, play video games or even be used with a VR headset to block out epiletic triggers such as filtered sunlight when they are outside.

Comments
  • I had to use these arguments to make it work properly: -f lavfi -re -fflags +genpts -i "movie=GleamingThatBrownbutterfly.webm:loop=0, setpts=N/(FRAME_RATE*TB)". Without those, it was stopping after the first loop and the rest of the frames were dropped.