Answers.Body: <p>I switched to a 32-bit binary and the problem has gone away.  </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-05T20:04:03.140Z
Answers.LastActivityDate: 2018-08-05T20:04:03.140Z
Answers.UserDisplayName: Gordon
Body: <p>Reposted from superuser: <a href="https://superuser.com/questions/1340574/ffmpeg-copy-hls-high-cpu-usage">https://superuser.com/questions/1340574/ffmpeg-copy-hls-high-cpu-usage</a></p>
  
  <p>I have a set of batch scripts (Windows 10) to create an "instant replay" for some (11) HLS streams using FFMPEG. When everything is working each instance uses less than 1% CPU. The problem I have is that FFMPEG regularly hangs and does not continue looping. When this happens, the instance jumps to 10-15% CPU usage.</p>
  
  <p>The first time I had this problem, I updated my graphics card drivers and FFMPEG version and that worked for a while but the problem came back. I assumed that it was the graphics card going bad. I now have a brand new computer (Precision 7520 with Xeon E3-1535M v6, Quadro M2200, and 32GB ECC RAM) and the problem persists. I have no idea what the cause is. I have tried updating FFMPEG again to no avail.</p>
  
  <p>If anybody has a fix that would be the best; however, if you know a way to monitor the processor usage and automatically kill ffmpeg when it spikes for more than 10s that would be an acceptable solution.</p>
  
  <p>The recorder script is as follows:</p>
  
  <p><code>Set Event=%1
  Set CamName=%4
  ::SegLength is normally 30 to 60 seconds
  Set SegLength=%2
  Set BasePath=%3</p>
  
  <p>mkdir "%BasePath%\%Event%\%CamName%\"
  for /f %%i in ('yt-dl PATH_TO_master.m3u8 -f best --get-url') do set url="%%i"</p>
  
  <p>:beg
  Set "FileName=%CamName%.%TIME::=-%.mp4"
  ffmpeg -n -i %url% -t %SegLength% -c:v copy -c:a copy -f mp4 "%BasePath%\%Event%\%CamName%\%FileName%"
  goto :beg
  </code></p>
  
Tags: <ffmpeg><streaming><video-recording><live>
Title: High cpu usage with FFMPEG copying video codec from HLS
UserDisplayName: Gordon
ThreadText: # High cpu usage with FFMPEG copying video codec from HLS
  
  (Asked by: username_0 on 2018-07-17)
  
  Reposted from superuser: <https://superuser.com/questions/1340574/ffmpeg-copy-hls-high-cpu-usage>
  
  I have a set of batch scripts (Windows 10) to create an "instant replay" for some (11) HLS streams using FFMPEG. When everything is working each instance uses less than 1% CPU. The problem I have is that FFMPEG regularly hangs and does not continue looping. When this happens, the instance jumps to 10-15% CPU usage.
  
  The first time I had this problem, I updated my graphics card drivers and FFMPEG version and that worked for a while but the problem came back. I assumed that it was the graphics card going bad. I now have a brand new computer (Precision 7520 with Xeon E3-1535M v6, Quadro M2200, and 32GB ECC RAM) and the problem persists. I have no idea what the cause is. I have tried updating FFMPEG again to no avail.
  
  If anybody has a fix that would be the best; however, if you know a way to monitor the processor usage and automatically kill ffmpeg when it spikes for more than 10s that would be an acceptable solution.
  
  The recorder script is as follows:
  
  `Set Event=%1
  Set CamName=%4
  ::SegLength is normally 30 to 60 seconds
  Set SegLength=%2
  Set BasePath=%3`
  
  mkdir "%BasePath%\%Event%\%CamName%\"
  for /f %%i in ('yt-dl PATH\_TO\_master.m3u8 -f best --get-url') do set url="%%i"
  
  :beg
  Set "FileName=%CamName%.%TIME::=-%.mp4"
  ffmpeg -n -i %url% -t %SegLength% -c:v copy -c:a copy -f mp4 "%BasePath%\%Event%\%CamName%\%FileName%"
  goto :beg
  
  **Tags:** ffmpeg, streaming, video-recording, live
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-08-05. Score: 0 | Accepted answer
  
  I switched to a 32-bit binary and the problem has gone away.
  
  
  ---
  
  