sourcey / libsourcey

C++14 evented IO libraries for high performance networking and media based applications
https://sourcey.com/libsourcey
GNU Lesser General Public License v2.1
1.31k stars 344 forks source link

Wrong frame rate of mp4 file encoded from local camera. #277

Open Monsterkappa-dev opened 4 years ago

Monsterkappa-dev commented 4 years ago

I compiled the code on Win10 platform. And run the sample "devicerecorder" in src/av. It seemed worked but the fps of output video is wrong. The video is very stuck and the fps shows less than 1 fps. The console info is below:

Input #0, dshow, from 'video=@devicepnp\?\usb#vid_18ec&pid_3399&mi_00#7&189a2f54&1&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global': Duration: N/A, start: 240084.451000, bitrate: N/A Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x480, 30 fps, 30 tbr, 10000k tbn, 10000k tbc [libx264 @ 000002a00d916bc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 [libx264 @ 000002a00d916bc0] profile High, level 3.0 [libx264 @ 000002a00d916bc0] 264 - core 155 r2901 7d0ff22 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=8 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=50 rc=abr mbtree=1 bitrate=128 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 [mp4 @ 000002a00d9161e0] Using AVStream.codec.time_base as a timebase hint to the muxer is deprecated. Set AVStream.time_base instead. [mp4 @ 000002a00d9161e0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead. Output #0, mp4, to 'deviceoutput.mp4': Metadata: encoder : Lavf57.83.100 Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 640x480, q=-1--1, 128 kb/s, 15360 tbn, 30 tbc [libx264 @ 000002a00d916bc0] frame I:2 Avg QP:24.30 size: 6996 [libx264 @ 000002a00d916bc0] frame P:48 Avg QP: 2.34 size:152222 [libx264 @ 000002a00d916bc0] frame B:141 Avg QP: 3.86 size:140073 [libx264 @ 000002a00d916bc0] consecutive B-frames: 1.0% 0.0% 0.0% 99.0% [libx264 @ 000002a00d916bc0] mb I I16..4: 76.5% 14.4% 9.1% [libx264 @ 000002a00d916bc0] mb P I16..4: 20.4% 1.3% 30.2% P16..4: 15.7% 18.2% 12.2% 0.0% 0.0% skip: 2.0% [libx264 @ 000002a00d916bc0] mb B I16..4: 9.7% 0.6% 24.8% B16..8: 22.5% 13.3% 7.3% direct:17.6% skip: 4.1% L0:36.1% L1:22.8% BI:41.1% [libx264 @ 000002a00d916bc0] final ratefactor: -40.21 [libx264 @ 000002a00d916bc0] 8x8 transform intra:2.3% inter:3.4% [libx264 @ 000002a00d916bc0] direct mvs spatial:93.6% temporal:6.4% [libx264 @ 000002a00d916bc0] coded y,uvDC,uvAC intra: 97.2% 97.8% 97.2% inter: 83.5% 92.4% 84.1% [libx264 @ 000002a00d916bc0] i16 v,h,dc,p: 15% 9% 30% 46% [libx264 @ 000002a00d916bc0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 22% 25% 5% 7% 6% 7% 6% 11% [libx264 @ 000002a00d916bc0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 22% 26% 5% 7% 5% 8% 5% 10% [libx264 @ 000002a00d916bc0] i8c dc,h,v,p: 74% 10% 5% 11% [libx264 @ 000002a00d916bc0] Weighted P-Frames: Y:6.2% UV:6.2% [libx264 @ 000002a00d916bc0] ref P L0: 38.2% 5.1% 25.0% 17.3% 14.5% 0.0% [libx264 @ 000002a00d916bc0] ref B L0: 52.1% 29.2% 13.9% 4.9% [libx264 @ 000002a00d916bc0] ref B L1: 85.0% 15.0% [libx264 @ 000002a00d916bc0] kb/s:0.55

Anyone know how to deal with it?