[FFmpeg-user] CPU usage using two ssegment

Bruno Hass de Andrade brunohass2303 at gmail.com
Wed Jun 29 18:47:07 CEST 2016


Hello. I'm generating an HLS stream from an RTSP input and now I need to
save to MP4 as well.

I tested with the following command:

/usr/bin/ffmpeg -y \
    -probesize 2048 \
    -analyzeduration 1 \
    -fpsprobesize 2048 \
    -formatprobesize 2048 \
    -fflags +nobuffer \
    -flags +low_delay \
    -i rtsp://my.rtsp.input \
    -c copy \
    -flags +global_header \
    -f ssegment \
      -segment_list /output/playlist.m3u8 \
      -segment_time 6 \
      -segment_format mpeg_ts \
      -segment_list_type m3u8 \
      -segment_list_flags live \
      -segment_list_size 10 \
      -segment_wrap 10 \
      /output/segment-%02d.ts \
    -f ssegment \
      -segment_time 60 \
      -strftime 1 \
      -break_non_keyframes 0 \
      -reset_timestamps 1 \
      -segment_format_options movflags=+faststart \
      -segment_atclocktime 1 \
      /output/%Y%m%d%H%M%S.mp4


It works perfectly, but cpu usage is around 30%.

Separating into two commands:

/usr/bin/ffmpeg -y \
    -probesize 2048 \
    -analyzeduration 1 \
    -fpsprobesize 2048 \
    -formatprobesize 2048 \
    -fflags +nobuffer \
    -flags +low_delay \
    -i rtsp://my.rtsp.input \
    -c copy \
    -flags +global_header \
    -f ssegment \
      -segment_time 60 \
      -strftime 1 \
      -break_non_keyframes 0 \
      -reset_timestamps 1 \
      -segment_format_options movflags=+faststart \
      -segment_atclocktime 1 \
      /output/%Y%m%d%H%M%S.mp4

/usr/bin/ffmpeg -y \
    -probesize 2048 \
    -analyzeduration 1 \
    -fpsprobesize 2048 \
    -formatprobesize 2048 \
    -fflags +nobuffer \
    -flags +low_delay \
    -i rtsp://my.rtsp.input \
    -c copy \
    -flags +global_header \
    -f ssegment \
      -segment_list /output/playlist.m3u8 \
      -segment_time 6 \
      -segment_format mpeg_ts \
      -segment_list_type m3u8 \
      -segment_list_flags live \
      -segment_list_size 10 \
      -segment_wrap 10 \
      /output/segment-%02d.ts

CPU usage is less than 1%.

I'm just repackaging the RTSP stream in HLS and mp4.

Am I doing something wrong?

Using ffmpeg version N-79978-ged3a025-static from
http://johnvansickle.com/ffmpeg/

Machine is:
  Linux 4.4.11 x86_64
  2x Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz GenuineIntel GNU/Linux
  320GB RAM


Thank you!



--
-----

Bruno Hass
(51) 9280-3627


More information about the ffmpeg-user mailing list