[FFmpeg-user] FFmpeg Not Transcoding In Real Time

Gabriel Balaich roderrooder at gmail.com
Sun Dec 2 06:12:34 EET 2018


Hello all,

been setting up a recording build for a friend to resemble mine, but I
can't seem to get things to work in real-time despite sufficient (as far as
I can tell) hardware.

System specs: 8600K, GTX 1050ti, 16Gb RAM, 1tb 860 EVO

Test command:
ffmpeg -y -hide_banner -thread_queue_size 9999 -indexmem 9999
-guess_layout_max 0 -f dshow -rtbufsize 2147.48M `
-video_size 1920x1080 -framerate 60 `
-i
video="@device_pnp_\\?\usb#vid_07ca&pid_0570&mi_00#7&3886ab1a&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global":audio="@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{0A494693-5F33-4304-88D7-394757E09648}"
`
-thread_queue_size 9999 -indexmem 9999 -guess_layout_max 0 -f dshow
-rtbufsize 2147.48M `
-video_size 1920x1080 -framerate 60 `
-i
video="@device_pnp_\\?\usb#vid_07ca&pid_0570&mi_00#7&24df76f&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global":audio="@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{0E6F0DEF-2B29-4117-8D30-13F01160AC5B}"
`
-map 0:0,0:1 -map 0:1 -c:v h264_nvenc -r 60 -rc-lookahead 120 -forced-idr 1
-strict_gop 1 -sc_threshold 0 -flags +cgop `
-force_key_frames "expr:gte(t,n_forced*2)" -preset: llhp -pix_fmt nv12 -b:v
250M -minrate 250M -maxrate 250M `
-bufsize 250M -c:a aac -ar 44100 -b:a 384k -ac 2 -vsync 1 -ss 00:00:00.000 `
-max_muxing_queue_size 9999 -f segment -segment_time 600 -segment_wrap 9
-reset_timestamps 1 `
-segment_format_options max_delay=0
C:\Users\Jordan\Videos\FFmpeg\Left\Left%02d.ts `
-map 1:0,1:1 -map 1:1 -c:v h264_nvenc -r 60 -rc-lookahead 120 -forced-idr 1
-strict_gop 1 -sc_threshold 0 -flags +cgop `
-force_key_frames "expr:gte(t,n_forced*2)" -preset: llhp -pix_fmt nv12 -b:v
250M -minrate 250M -maxrate 250M `
-bufsize 250M -c:a aac -ar 44100 -b:a 384k -ac 2 -vsync 1 -ss 00:00:00.000 `
-max_muxing_queue_size 9999 -f segment -segment_time 600 -segment_wrap 9
-reset_timestamps 1 `
-segment_format_options max_delay=0
C:\Users\Jordan\Videos\FFmpeg\Right\Right%02d.ts

For one reason or another this command is not transcoding video in
real-time, which is a big issue when you're trying to record not simply
convert a file. When I omit one of the two outputs or if I halve the
resolution of each input / output everything works in real-time. This would
make me believe there is a bottleneck in the system somewhere but when
monitoring everything in task manager nothing is even close to capping out
(GPU encoder, cpu, ram, and SSD below 30% usage).

Furthermore when I try recording both streams in one 4K60 video via OBS
things work perfectly fine, as in real-time. So I don't understand how
transcoding two 1080p60 streams in FFmpeg would be anymore intensive than
one 4K60 stream in OBS... When looking at the GPUs encoding chip usage it
shows about 30% for the two 1080p60 streams on FFmpeg and 80% usage for
single 4K60 stream in OBS, yet the OBS recording is real-time while the
FFmpeg recording is at .6x speed.

Lastly I run a very similar command at home but instead of two 1080p60
streams I'm doing 2 4K60 streams, a 1080p60 stream, and another 2 audio
streams without issue. I do have a GTX 1080 though... however when
monitoring usage for the 1050 TI being used in this situation nothing
points to a GPU bottlecap.

Any insight would be greatly appreciated, been going at this for hours now
with no clue as to what could be causing this.

Full console output from a "minute" (according to the console, took 2
minutes of real time to get to that point) of recording:
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

PS C:\Users\Jordan>
PS C:\Users\Jordan> ffmpeg -y -thread_queue_size 9999 -indexmem 9999
-guess_layout_max 0 -f dshow -rtbufsize 2147.48M `
>> -video_size 1920x1080 -framerate 60 `
>> -i
video="@device_pnp_\\?\usb#vid_07ca&pid_0570&mi_00#7&3886ab1a&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global":audio="@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{0A494693-5F33-4304-88D7-394757E09648}"
`
>> -thread_queue_size 9999 -indexmem 9999 -guess_layout_max 0 -f dshow
-rtbufsize 2147.48M `
>> -video_size 1920x1080 -framerate 60 `
>> -i
video="@device_pnp_\\?\usb#vid_07ca&pid_0570&mi_00#7&24df76f&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global":audio="@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{0E6F0DEF-2B29-4117-8D30-13F01160AC5B}"
`
>> -map 0:0,0:1 -map 0:1 -c:v h264_nvenc -r 60 -rc-lookahead 120
-forced-idr 1 -strict_gop 1 -sc_threshold 0 -flags +cgop `
>> -force_key_frames "expr:gte(t,n_forced*2)" -preset: llhp -pix_fmt nv12
-b:v 250M -minrate 250M -maxrate 250M `
>> -bufsize 250M -c:a aac -ar 44100 -b:a 384k -ac 2 -vsync 1 -ss
00:00:00.000 `
>> -max_muxing_queue_size 9999 -f segment -segment_time 600 -segment_wrap 9
-reset_timestamps 1 `
>> -segment_format_options max_delay=0
C:\Users\Jordan\Videos\FFmpeg\Left\Left%02d.ts `
>> -map 1:0,1:1 -map 1:1 -c:v h264_nvenc -r 60 -rc-lookahead 120
-forced-idr 1 -strict_gop 1 -sc_threshold 0 -flags +cgop `
>> -force_key_frames "expr:gte(t,n_forced*2)" -preset: llhp -pix_fmt nv12
-b:v 250M -minrate 250M -maxrate 250M `
>> -bufsize 250M -c:a aac -ar 44100 -b:a 384k -ac 2 -vsync 1 -ss
00:00:00.000 `
>> -max_muxing_queue_size 9999 -f segment -segment_time 600 -segment_wrap 9
-reset_timestamps 1 `
>> -segment_format_options max_delay=0
C:\Users\Jordan\Videos\FFmpeg\Right\Right%02d.ts
ffmpeg version N-92573-gc047901012 Copyright (c) 2000-2018 the FFmpeg
developers
  built with gcc 8.2.1 (GCC) 20181201
  configuration: --enable-gpl --enable-version3 --enable-sdl2
--enable-fontconfig --enable-gnutls --enable-iconv --enable-libass
--enable-libbluray --enable-libfreetype --enable-libmp3lame
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg
--enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr
--enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack
--enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2
--enable-libzimg --enable-lzma --enable-zlib --enable-gmp
--enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc
--enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom
--enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid
--enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2
--enable-avisynth --enable-libopenmpt
  libavutil      56. 24.101 / 56. 24.101
  libavcodec     58. 41.100 / 58. 41.100
  libavformat    58. 23.102 / 58. 23.102
  libavdevice    58.  6.101 / 58.  6.101
  libavfilter     7. 46.101 /  7. 46.101
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
[mjpeg @ 000001a6974dc580] Found EOI before any SOF, ignoring
[mjpeg @ 000001a6974dc580] No JPEG data found in image
Input #0, dshow, from
'video=@device_pnp_\\?\usb#vid_07ca&pid_0570&mi_00#7&3886ab1a&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global:audio=@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{0A494693-5F33-4304-88D7-394757E09648}':
  Duration: N/A, start: 1009.409000, bitrate: N/A
    Stream #0:0: Video: mjpeg (Baseline) (MJPG / 0x47504A4D), yuvj422p(pc,
bt470bg/unknown/unknown), 1920x1080, 60 fps, 60 tbr, 10000k tbn, 10000k tbc
    Stream #0:1: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s
[mjpeg @ 000001a697590e80] Found EOI before any SOF, ignoring
[mjpeg @ 000001a697590e80] No JPEG data found in image
Input #1, dshow, from
'video=@device_pnp_\\?\usb#vid_07ca&pid_0570&mi_00#7&24df76f&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global:audio=@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{0E6F0DEF-2B29-4117-8D30-13F01160AC5B}':
  Duration: N/A, start: 1009.922000, bitrate: N/A
    Stream #1:0: Video: mjpeg (Baseline) (MJPG / 0x47504A4D), yuvj422p(pc,
bt470bg/unknown/unknown), 1920x1080, 60 fps, 60 tbr, 10000k tbn, 10000k tbc
    Stream #1:1: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 [sync #0:1] (mjpeg (native) -> h264 (h264_nvenc))
  Stream #0:1 -> #0:1 (pcm_s16le (native) -> aac (native))
  Stream #1:0 -> #1:0 [sync #1:1] (mjpeg (native) -> h264 (h264_nvenc))
  Stream #1:1 -> #1:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
[mjpeg @ 000001a6975927c0] Found EOI before any SOF, ignoring
[mjpeg @ 000001a6975927c0] No JPEG data found in image
Error while decoding stream #0:0: Invalid data found when processing input
[swscaler @ 000001a6a174aa00] deprecated pixel format used, make sure you
did set range correctly
[segment @ 000001a6a0cc8180] Opening
'C:\Users\Jordan\Videos\FFmpeg\Left\Left00.ts' for writing/A
Output #0, segment, to 'C:\Users\Jordan\Videos\FFmpeg\Left\Left%02d.ts':
  Metadata:
    encoder         : Lavf58.23.102
    Stream #0:0: Video: h264 (h264_nvenc) (Main), nv12(progressive),
1920x1080, q=-1--1, 250000 kb/s, 60 fps, 90k tbn, 60 tbc
    Metadata:
      encoder         : Lavc58.41.100 h264_nvenc
    Side data:
      cpb: bitrate max/min/avg: 250000000/0/250000000 buffer size:
250000000 vbv_delay: -1
    Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp, 384 kb/s
    Metadata:
      encoder         : Lavc58.41.100 aac
[mjpeg @ 000001a6a0b89d00] Found EOI before any SOF, ignoring
[mjpeg @ 000001a6a0b89d00] No JPEG data found in image
Error while decoding stream #1:0: Invalid data found when processing input
[swscaler @ 000001a6a1623a00] deprecated pixel format used, make sure you
did set range correctly
[segment @ 000001a6a1885140] Opening
'C:\Users\Jordan\Videos\FFmpeg\Right\Right00.ts' for writing
Output #1, segment, to 'C:\Users\Jordan\Videos\FFmpeg\Right\Right%02d.ts':
  Metadata:
    encoder         : Lavf58.23.102
    Stream #1:0: Video: h264 (h264_nvenc) (Main), nv12(progressive),
1920x1080, q=-1--1, 250000 kb/s, 60 fps, 90k tbn, 60 tbc
    Metadata:
      encoder         : Lavc58.41.100 h264_nvenc
    Side data:
      cpb: bitrate max/min/avg: 250000000/0/250000000 buffer size:
250000000 vbv_delay: -1
    Stream #1:1: Audio: aac (LC), 44100 Hz, stereo, fltp, 384 kb/s
    Metadata:
      encoder         : Lavc58.41.100 aac
frame= 3939 fps= 31 q=13.0 Lq=13.0 size=N/A time=00:01:05.63 bitrate=N/A
dup=4 drop=0 speed=0.512x
video:1155166kB audio:6138kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: unknown
[aac @ 000001a6a1882d00] Qavg: 377.927
[aac @ 000001a6a1882880] Qavg: 378.411
PS C:\Users\Jordan>


More information about the ffmpeg-user mailing list