[FFmpeg-user] Multithreaded multioutput problem
Deron
deron at pagestream.org
Sun Jan 25 16:41:44 CET 2015
On 1/23/15 2:30 PM, Deron wrote:
> On 1/23/15 9:28 AM, Deron wrote:
>> I would like to generate 4 different HLS (sub)streams from a single
>> DVB capture, but ffmpeg fails to keep up with more than 2. Yes, I
>> have the CPU power and I'm writing to a ram disk (or SSD, doesn't
>> matter). I have a dual tuner capture card and can generate two
>> different HLS substreams per tuner (total of 4) with plenty of CPU
>> left to burn.
>>
>> I would guess it is some kind of thread limit but I can't seem to get
>> past it. Any suggestions? Below is an example command and output. If
>> I cut out one of the outputs, it works fine.
>>
>> Thanks for your suggestions!
>>
>> Deron
>>
>
> Reading this, I obviously did not make the problem very clear.
>
> I am trying to do this (simplified):
>
> ffmpeg -i "/dev/dvb/adapter0/dvr0" -b:v 2400k "hi.m3u8" -b:v 1200k
> "med.m3u8" -b:v 600k "low.m3u8" -vn "audio.m3u8"
>
> And it fails with: /dev/dvb/adapter0/dvr0: Value too large for defined
> data type
>
> But if I remove any 2 outputs like:
>
> ffmpeg -i "/dev/dvb/adapter0/dvr0" -b:v 2400k "hi.m3u8" -vn "audio.m3u8"
>
> It works. I can see fps is very close (not sure if it is a because of
> HLS working in "real time" or some thread limitation), but cpu usage
> is very light.
>
> Since I have 2 adapters, I can actually run
>
> ffmpeg -i "/dev/dvb/adapter0/dvr0" -b:v 2400k "hi.m3u8" -b:v 1200k
> "med.m3u8"
> ffmpeg -i "/dev/dvb/adapter1/dvr0" -b:v 600k "low.m3u8" -vn "audio.m3u8"
>
> And that runs fine (again with light cpu usage). Obviously a threading
> issue. What can I do to fix this?
To further complicate maters, I tried copying 10 minutes of data to a
file using:
cp /dev/dvb/adapter0/dvr0 data.ts
and then
ffmpeg -i data.ts -b:v 2400k "hi.m3u8" -b:v 1200k "med.m3u8" -b:v 600k
"low.m3u8" -vn "audio.m3u8"
Which works. In fact, I can run 8 copies of this at the same time and it
still runs faster than real time on this computer.
where
ffmpeg -i "/dev/dvb/adapter0/dvr0" -b:v 2400k "hi.m3u8" -b:v 1200k
"med.m3u8" -b:v 600k "low.m3u8" -vn "audio.m3u8"
and
ffmpeg -i "/dev/dvb/adapter0/dvr0" -b:v 2400k "hi.m3u8" -b:v 1200k
"med.m3u8"
Fails as above (and below) with: /dev/dvb/adapter0/dvr0: Value too large
for defined data type
and
ffmpeg -i "/dev/dvb/adapter0/dvr0" -b:v 2400k "hi.m3u8" -vn "audio.m3u8"
Works.
Does anyone have an idea on what could be causing this grief? What is
kicking out this message? Could it be simply that ffmpeg can't get going
fast enough and the dvb device is loosing initial data?? Ie, the first
frame takes too long?
Thanks,
Deron
>
> Thanks,
>
> Deron
>
>
>
>> ffmpeg -f mpegts -i /dev/dvb/adapter0/dvr0 -c:v libx264 -vf
>> scale=1280:720 -s 1280x720 -aspect 1280:720 -pix_fmt yuv420p -r 29.97
>> -preset veryfast -b:v 2400k -c:a libfaac -ar 48000 -ac 2 -async 2 -f
>> hls -hls_time 2 -hls_list_size 10 -hls_wrap 20 -y
>> "/var/www/html/stream/WPBF/wpbf.hi.m3u8" -c:v libx264 -vf
>> scale=1280:720 -s 1280x720 -aspect 1280:720 -pix_fmt yuv420p -r 29.97
>> -preset veryfast -b:v 1200k -c:a libfaac -ar 48000 -ac 2 -async 2 -f
>> hls -hls_time 2 -hls_list_size 10 -hls_wrap 20 -y
>> "/var/www/html/stream/WPBF/wpbf.mid.m3u8" -c:v libx264 -vf
>> scale=1280:720 -s 1280x720 -aspect 1280:720 -pix_fmt yuv420p -r 29.97
>> -preset veryfast -b:v 600k -c:a libfaac -ar 48000 -ac 2 -async 2 -f
>> hls -hls_time 2 -hls_list_size 10 -hls_wrap 20 -y
>> "/var/www/html/stream/WPBF/wpbf.low.m3u8" -vn -c:a libfaac -b:a 30k
>> -ar 24000 -ac 1 -f hls -hls_time 2 -hls_list_size 10 -hls_wrap 20 -y
>> "/var/www/html/stream/WPBF/wpbf.a.m3u8"
>>
>>
>> ffmpeg version N-69206-g4b46ce8 Copyright (c) 2000-2015 the FFmpeg
>> developers
>> built on Jan 22 2015 18:39:59 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
>> configuration: --enable-shared --enable-gpl --enable-nonfree
>> --enable-libxvid --enable-libx264 --enable-libmp3lame
>> --enable-libvorbis --enable-libfaac --enable-libopenjpeg
>> libavutil 54. 17.100 / 54. 17.100
>> libavcodec 56. 20.100 / 56. 20.100
>> libavformat 56. 19.100 / 56. 19.100
>> libavdevice 56. 4.100 / 56. 4.100
>> libavfilter 5. 8.101 / 5. 8.101
>> libswscale 3. 1.101 / 3. 1.101
>> libswresample 1. 1.100 / 1. 1.100
>> libpostproc 53. 3.100 / 53. 3.100
>> [mpeg2video @ 0x1c430a0] Invalid frame dimensions 0x0.
>> Input #0, mpegts, from '/dev/dvb/adapter0/dvr0':
>> Duration: N/A, start: 94543.371178, bitrate: N/A
>> Stream #0:0[0x31]: Video: mpeg2video (Main), yuv420p(tv),
>> 1920x1080 [SAR 1:1 DAR 16:9], max. 24000 kb/s, 29.97 fps, 29.97 tbr,
>> 90k tbn, 59.94 tbc
>> Stream #0:1[0x34]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
>> -async is forwarded to lavfi similarly to -af
>> aresample=async=2:min_hard_comp=0.100000:first_pts=0.
>> Last message repeated 3 times
>> [libx264 @ 0x1db48a0] using SAR=1/1
>> [libx264 @ 0x1db48a0] using cpu capabilities: MMX2 SSE2Fast SSSE3
>> SSE4.2 AVX
>> [libx264 @ 0x1db48a0] profile High, level 3.1
>> [libx264 @ 0x1c4b780] using SAR=1/1
>> [libx264 @ 0x1c4b780] using cpu capabilities: MMX2 SSE2Fast SSSE3
>> SSE4.2 AVX
>> [libx264 @ 0x1c4b780] profile High, level 3.1
>> [libx264 @ 0x1c4f400] using SAR=1/1
>> [libx264 @ 0x1c4f400] using cpu capabilities: MMX2 SSE2Fast SSSE3
>> SSE4.2 AVX
>> [libx264 @ 0x1c4f400] profile High, level 3.1
>> Output #0, hls, to '/var/www/html/stream/WPBF/wpbf.hi.m3u8':
>> Metadata:
>> encoder : Lavf56.19.100
>> Stream #0:0: Video: h264 (libx264), yuv420p, 1280x720 [SAR 1:1
>> DAR 16:9], q=-1--1, 2400 kb/s, 29.97 fps, 90k tbn, 29.97 tbc
>> Metadata:
>> encoder : Lavc56.20.100 libx264
>> Stream #0:1: Audio: aac (libfaac), 48000 Hz, stereo, s16, 128 kb/s
>> Metadata:
>> encoder : Lavc56.20.100 libfaac
>> Output #1, hls, to '/var/www/html/stream/WPBF/wpbf.mid.m3u8':
>> Metadata:
>> encoder : Lavf56.19.100
>> Stream #1:0: Video: h264 (libx264), yuv420p, 1280x720 [SAR 1:1
>> DAR 16:9], q=-1--1, 1200 kb/s, 29.97 fps, 90k tbn, 29.97 tbc
>> Metadata:
>> encoder : Lavc56.20.100 libx264
>> Stream #1:1: Audio: aac (libfaac), 48000 Hz, stereo, s16, 128 kb/s
>> Metadata:
>> encoder : Lavc56.20.100 libfaac
>> Output #2, hls, to '/var/www/html/stream/WPBF/wpbf.low.m3u8':
>> Metadata:
>> encoder : Lavf56.19.100
>> Stream #2:0: Video: h264 (libx264), yuv420p, 1280x720 [SAR 1:1
>> DAR 16:9], q=-1--1, 600 kb/s, 29.97 fps, 90k tbn, 29.97 tbc
>> Metadata:
>> encoder : Lavc56.20.100 libx264
>> Stream #2:1: Audio: aac (libfaac), 48000 Hz, stereo, s16, 128 kb/s
>> Metadata:
>> encoder : Lavc56.20.100 libfaac
>> Output #3, hls, to '/var/www/html/stream/WPBF/wpbf.a.m3u8':
>> Metadata:
>> encoder : Lavf56.19.100
>> Stream #3:0: Audio: aac (libfaac), 24000 Hz, mono, s16, 30 kb/s
>> Metadata:
>> encoder : Lavc56.20.100 libfaac
>> Stream mapping:
>> Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (libx264))
>> Stream #0:1 -> #0:1 (ac3 (native) -> aac (libfaac))
>> Stream #0:0 -> #1:0 (mpeg2video (native) -> h264 (libx264))
>> Stream #0:1 -> #1:1 (ac3 (native) -> aac (libfaac))
>> Stream #0:0 -> #2:0 (mpeg2video (native) -> h264 (libx264))
>> Stream #0:1 -> #2:1 (ac3 (native) -> aac (libfaac))
>> Stream #0:1 -> #3:0 (ac3 (native) -> aac (libfaac))
>> Press [q] to stop, [?] for help
>> [mpegts @ 0x1c26340] PES packet size mismatch=N/A time=00:00:02.30
>> bitrate=N/A dup=24 drop=0
>> [mpeg2video @ 0x1c479c0] ac-tex damaged at 30 5
>> [mpeg2video @ 0x1c479c0] Warning MVs not available
>> [mpeg2video @ 0x1c479c0] concealing 7560 DC, 7560 AC, 7560 MV errors
>> in P frame
>> [ac3 @ 0x1c46260] incomplete frame
>> /dev/dvb/adapter0/dvr0: Value too large for defined data type
>> Last message repeated 1 times
>> frame= 96 fps= 51 q=-1.0 Lq=-1.0 q=-1.0 size=N/A time=00:00:03.13
>> bitrate=N/A dup=27 drop=0
>> video:1360kB audio:145kB subtitle:0kB other streams:0kB global
>> headers:0kB muxing overhead: unknown
>> [libx264 @ 0x1db48a0] frame I:3 Avg QP:21.51 size: 77363
>> [libx264 @ 0x1db48a0] frame P:34 Avg QP:24.37 size: 13149
>> [libx264 @ 0x1db48a0] frame B:59 Avg QP:26.02 size: 2416
>> [libx264 @ 0x1db48a0] consecutive B-frames: 4.2% 29.2% 37.5% 29.2%
>> [libx264 @ 0x1db48a0] mb I I16..4: 14.4% 37.0% 48.5%
>> [libx264 @ 0x1db48a0] mb P I16..4: 4.9% 4.9% 0.6% P16..4: 36.3%
>> 13.0% 6.1% 0.0% 0.0% skip:34.3%
>> [libx264 @ 0x1db48a0] mb B I16..4: 0.4% 0.2% 0.0% B16..8: 12.1%
>> 2.5% 0.2% direct: 9.4% skip:75.3% L0:32.6% L1:54.1% BI:13.3%
>> [libx264 @ 0x1db48a0] final ratefactor: 20.34
>> [libx264 @ 0x1db48a0] 8x8 transform intra:42.0% inter:42.7%
>> [libx264 @ 0x1db48a0] coded y,uvDC,uvAC intra: 55.0% 81.7% 52.3%
>> inter: 6.0% 19.6% 1.3%
>> [libx264 @ 0x1db48a0] i16 v,h,dc,p: 39% 33% 22% 6%
>> [libx264 @ 0x1db48a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 20% 28% 4%
>> 4% 5% 4% 5% 5%
>> [libx264 @ 0x1db48a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 25% 7% 6%
>> 7% 8% 7% 8% 7%
>> [libx264 @ 0x1db48a0] i8c dc,h,v,p: 40% 27% 25% 9%
>> [libx264 @ 0x1db48a0] Weighted P-Frames: Y:0.0% UV:0.0%
>> [libx264 @ 0x1db48a0] kb/s:2052.11
>> [libx264 @ 0x1c4b780] frame I:3 Avg QP:26.95 size: 44610
>> [libx264 @ 0x1c4b780] frame P:34 Avg QP:29.81 size: 5683
>> [libx264 @ 0x1c4b780] frame B:59 Avg QP:32.12 size: 949
>> [libx264 @ 0x1c4b780] consecutive B-frames: 4.2% 29.2% 37.5% 29.2%
>> [libx264 @ 0x1c4b780] mb I I16..4: 21.7% 49.9% 28.4%
>> [libx264 @ 0x1c4b780] mb P I16..4: 4.1% 4.6% 0.1% P16..4: 20.5%
>> 7.4% 2.6% 0.0% 0.0% skip:60.8%
>> [libx264 @ 0x1c4b780] mb B I16..4: 0.3% 0.1% 0.0% B16..8: 6.3%
>> 1.1% 0.0% direct: 3.0% skip:89.1% L0:33.2% L1:58.6% BI: 8.3%
>> [libx264 @ 0x1c4b780] final ratefactor: 24.88
>> [libx264 @ 0x1c4b780] 8x8 transform intra:50.4% inter:46.8%
>> [libx264 @ 0x1c4b780] coded y,uvDC,uvAC intra: 45.4% 64.9% 28.0%
>> inter: 1.9% 7.1% 0.2%
>> [libx264 @ 0x1c4b780] i16 v,h,dc,p: 41% 33% 19% 7%
>> [libx264 @ 0x1c4b780] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 21% 28% 4%
>> 4% 5% 4% 6% 5%
>> [libx264 @ 0x1c4b780] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 24% 8% 7%
>> 7% 8% 6% 8% 6%
>> [libx264 @ 0x1c4b780] i8c dc,h,v,p: 42% 26% 25% 7%
>> [libx264 @ 0x1c4b780] Weighted P-Frames: Y:0.0% UV:0.0%
>> [libx264 @ 0x1c4b780] kb/s:956.64
>> [libx264 @ 0x1c4f400] frame I:3 Avg QP:32.85 size: 24825
>> [libx264 @ 0x1c4f400] frame P:34 Avg QP:36.57 size: 2594
>> [libx264 @ 0x1c4f400] frame B:59 Avg QP:39.34 size: 421
>> [libx264 @ 0x1c4f400] consecutive B-frames: 4.2% 29.2% 37.5% 29.2%
>> [libx264 @ 0x1c4f400] mb I I16..4: 30.6% 59.5% 9.9%
>> [libx264 @ 0x1c4f400] mb P I16..4: 3.4% 4.0% 0.0% P16..4: 11.3%
>> 3.4% 0.9% 0.0% 0.0% skip:76.9%
>> [libx264 @ 0x1c4f400] mb B I16..4: 0.2% 0.1% 0.0% B16..8: 3.3%
>> 0.5% 0.0% direct: 1.1% skip:94.9% L0:34.9% L1:61.8% BI: 3.3%
>> [libx264 @ 0x1c4f400] final ratefactor: 30.77
>> [libx264 @ 0x1c4f400] 8x8 transform intra:56.3% inter:50.0%
>> [libx264 @ 0x1c4f400] coded y,uvDC,uvAC intra: 33.4% 49.8% 16.7%
>> inter: 0.5% 2.7% 0.0%
>> [libx264 @ 0x1c4f400] i16 v,h,dc,p: 45% 34% 14% 8%
>> [libx264 @ 0x1c4f400] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 19% 33% 4%
>> 3% 5% 4% 5% 5%
>> [libx264 @ 0x1c4f400] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 24% 11% 7%
>> 6% 8% 6% 7% 5%
>> [libx264 @ 0x1c4f400] i8c dc,h,v,p: 51% 22% 22% 5%
>> [libx264 @ 0x1c4f400] Weighted P-Frames: Y:0.0% UV:0.0%
>> [libx264 @ 0x1c4f400] kb/s:468.32
More information about the ffmpeg-user
mailing list