Answers.Body: <p>Use</p>
  
  <pre><code>ffmpeg -re -stream_loop -1 -i file.flv -c copy -f flv rtmp://x.y.z
  </code></pre>
  
  <p>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.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-09T14:35:34.333Z
Answers.Text: Unrecognized option 'stream_loop'.
Answers.UserDisplayName: spacer GIF
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-09T14:41:05.913Z
Answers.Text: You'll need a ffmpeg build from Oct 2015 or later.
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-09T14:45:57.037Z
Answers.Text: Oh. How do I get a more recent version? I have Ubuntu 15.04 but it has certainly had updates since October!
Answers.UserDisplayName: spacer GIF
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-09T14:49:51.873Z
Answers.Text: Get them from here: http://johnvansickle.com/ffmpeg/
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-09T15:03:14.457Z
Answers.Text: Thanks! I'll download it later today, wonder what on earth a .xz file is then pray this works. Will do it on a server though since that way there's no real chance of upsetting things on my computer such as Openshot. Do you advise uninstalling the repositories version first?
Answers.UserDisplayName: spacer GIF
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-09T15:17:18.270Z
Answers.Text: This is a static build. It won't affect anything else. Just don't put in one of the path locations to avoid it being called by other programs.
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-09T15:35:17.223Z
Answers.Text: Oh, okay. I've got it.  :P
  
  Trying it soon.
Answers.UserDisplayName: spacer GIF
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-09T15:49:20.637Z
Answers.Text: Just tried it and it outputs the video once, adds a minute to the timestamp for some reason then gets stuck.  :/
Answers.UserDisplayName: spacer GIF
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-09T15:50:18.180Z
Answers.Text: Add `-fflags +genpts` before `-i`
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-09T15:52:03.230Z
Answers.Text: Same thing is happening. `./ffmpeg -re -stream_loop -1 -fflags +genpts -i ../file.flv -c copy -f flv test2.flv`
Answers.UserDisplayName: spacer GIF
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-09T16:14:02.100Z
Answers.Text: I tested it here. It loops, but the timecode is buggy and jumps 30 seconds after each loop on a 10 second input. Which is to say, it's buggy.
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-09T04:31:53.547Z
Answers.LastActivityDate: 2016-05-09T14:50:44.563Z
Answers.LastEditDate: 2016-05-09T14:50:44.563Z
Answers.UserDisplayName: Gyan
Body: <p>Is there a way to infinitely loop a video in ffmpeg for a livestream? I've been looking around and can see it was possible to use "loop 1" but it appears that is no longer working.</p>
  
  <p>This is what I'm currently using, but as you can see, it is not infinitely looping and entering a ridiculously high number is not an option for me due to 32-bit integer limitations:</p>
  
  <pre><code>ffmpeg -re -f concat -i &lt;(for i in {1..10000}; do printf "file '%s'\n" /root/file.flv; done) -codec copy -f flv rtmp://a.rtmp.youtube.com/live2/xxxx-xxxx-xxxx-xxxx
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-05-10T16:36:32.277Z
Comments.Text: _Update:_ In my testing, I got `WriteN, RTMP send error 104 (52 bytes)` after a few hours so will probably just call it quits and say Ffmpeg just isn't up to livestreaming. Thanks anyway, folks!
Comments.UserDisplayName: spacer GIF
Tags: <video><ffmpeg><rtmp>
Title: Infinite Video Loop in Ffmpeg?
UserDisplayName: spacer GIF
ThreadText: # Infinite Video Loop in Ffmpeg?
  
  (Asked by: username_0 on 2016-05-08)
  
  Is there a way to infinitely loop a video in ffmpeg for a livestream? I've been looking around and can see it was possible to use "loop 1" but it appears that is no longer working.
  
  This is what I'm currently using, but as you can see, it is not infinitely looping and entering a ridiculously high number is not an option for me due to 32-bit integer limitations:
  
  ```
  ffmpeg -re -f concat -i <(for i in {1..10000}; do printf "file '%s'\n" /root/file.flv; done) -codec copy -f flv rtmp://a.rtmp.youtube.com/live2/xxxx-xxxx-xxxx-xxxx
  
  ```
  
  **Tags:** video, ffmpeg, rtmp
  
  > **Comments:**
  > **username_0**: _Update:_ In my testing, I got `WriteN, RTMP send error 104 (52 bytes)` after a few hours so will probably just call it quits and say Ffmpeg just isn't up to livestreaming. Thanks anyway, folks!  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-05-09. Score: 5
  
  Use
  
  ```
  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.
  
  > **Comments:**
  > **username_0**: Unrecognized option 'stream_loop'.  
  > **username_1**: You'll need a ffmpeg build from Oct 2015 or later.  
  > **username_0**: Oh. How do I get a more recent version? I have Ubuntu 15.04 but it has certainly had updates since October!  
  > **username_1**: Get them from here: http://johnvansickle.com/ffmpeg/  
  > **username_0**: Thanks! I'll download it later today, wonder what on earth a .xz file is then pray this works. Will do it on a server though since that way there's no real chance of upsetting things on my computer such as Openshot. Do you advise uninstalling the repositories version first?  
  > **username_1**: This is a static build. It won't affect anything else. Just don't put in one of the path locations to avoid it being called by other programs.  
  > **username_0**: Oh, okay. I've got it.  :P  Trying it soon.  
  > **username_0**: Just tried it and it outputs the video once, adds a minute to the timestamp for some reason then gets stuck.  :/  
  > **username_1**: Add `-fflags +genpts` before `-i`  
  > **username_0**: Same thing is happening. `./ffmpeg -re -stream_loop -1 -fflags +genpts -i ../file.flv -c copy -f flv test2.flv`  
  > **username_1**: I tested it here. It loops, but the timecode is buggy and jumps 30 seconds after each loop on a 10 second input. Which is to say, it's buggy.  
  
  ---
  
  