Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Video 捕获我的网络摄像头并用ffmpeg编码到mp4,但x264效果不佳_Video_Ffmpeg_Mp4_X264 - Fatal编程技术网

Video 捕获我的网络摄像头并用ffmpeg编码到mp4,但x264效果不佳

Video 捕获我的网络摄像头并用ffmpeg编码到mp4,但x264效果不佳,video,ffmpeg,mp4,x264,Video,Ffmpeg,Mp4,X264,这是我的版本: ffmpeg版本:2.3.3 libx264版本:142.x 我想捕获我的视频,并使用ffmpeg和x264生成mp4文件。解决方案是320x240。 但是我发现视频文件太大了。然后我发现P帧和B帧非常大,甚至几乎等于i帧,我不知道为什么 这是我的代码: [libx264 @ 0xb6200fc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX [libx264 @ 0xb6200fc0] profile Hig

这是我的版本: ffmpeg版本:2.3.3 libx264版本:142.x

我想捕获我的视频,并使用ffmpeg和x264生成mp4文件。解决方案是320x240。 但是我发现视频文件太大了。然后我发现P帧和B帧非常大,甚至几乎等于i帧,我不知道为什么

这是我的代码:

[libx264 @ 0xb6200fc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX 

[libx264 @ 0xb6200fc0] profile High, level 1.3

[libx264 @ 0xb6200fc0] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 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=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=10 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=400 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00

Output #0, mp4, to '/home/2014_09_12/0002b6429579/5/2014_09_12_18_39_12_600.mp4':

    Stream #0:0: Video: h264 (libx264), yuv420p, 320x240, q=-1--1, 400 kb/s, 10 tbc

    Stream #0:1: Audio: aac, 8000 Hz, mono, fltp, 32 kb/s

[mp4 @ 0xb62005e0] Using AVStream.codec.time_base as a timebase hint to the muxer is deprecated. Set AVStream.time_base instead.

[mp4 @ 0xb62005e0] Using AVStream.codec.time_base as a timebase hint to the muxer is deprecated. Set AVStream.time_base instead.

[mp4 @ 0xb62005e0] Encoder did not produce proper pts, making some up.

[libx264 @ 0xb6200fc0] frame I:3     Avg QP: 2.79  size: 72996

[libx264 @ 0xb6200fc0] frame P:383   Avg QP: 0.14  size: 54075

[libx264 @ 0xb6200fc0] frame B:216   Avg QP: 1.95  size: 64784

[libx264 @ 0xb6200fc0] consecutive B-frames: 30.1% 63.2%  6.0%  0.7%

[libx264 @ 0xb6200fc0] mb I  I16..4: 16.1% 12.7% 71.2%

[libx264 @ 0xb6200fc0] mb P  I16..4:  3.5%  5.1% 15.9%  P16..4: 20.3% 22.8% 14.0%  0.0%  0.0%    skip:18.3%

[libx264 @ 0xb6200fc0] mb B  I16..4:  0.4%  2.5%  8.2%  B16..8: 32.6% 19.8% 13.5%  
direct:22.2%  skip: 0.8%  L0:25.5% L1:12.8% BI:61.6%

[libx264 @ 0xb6200fc0] final ratefactor: -32.89

[libx264 @ 0xb6200fc0] 8x8 transform intra:21.0% inter:29.6%

[libx264 @ 0xb6200fc0] coded y,uvDC,uvAC intra: 100.0% 100.0% 100.0% inter: 83.3% 80.9% 80.9%

[libx264 @ 0xb6200fc0] i16 v,h,dc,p:  5%  7% 42% 46%

[libx264 @ 0xb6200fc0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14% 12% 23%  8%  6%  6%  8%  9% 14%

[libx264 @ 0xb6200fc0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 11% 19% 10%  8%  8% 10% 10% 12%

[libx264 @ 0xb6200fc0] i8c dc,h,v,p: 78%  3%  4% 15%

[libx264 @ 0xb6200fc0] Weighted P-Frames: Y:0.5% UV:0.3%

[libx264 @ 0xb6200fc0] ref P L0: 43.4% 14.6% 19.0% 22.9%  0.1%

[libx264 @ 0xb6200fc0] ref B L0: 63.3% 35.7%  1.1%

[libx264 @ 0xb6200fc0] ref B L1: 97.0%  3.0%

[libx264 @ 0xb6200fc0] kb/s:4.53

[aac @ 0xb6201ba0] 2 frames left in the queue on closing
这是我的程序输出:

[libx264 @ 0xb6200fc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX 

[libx264 @ 0xb6200fc0] profile High, level 1.3

[libx264 @ 0xb6200fc0] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 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=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=10 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=400 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00

Output #0, mp4, to '/home/2014_09_12/0002b6429579/5/2014_09_12_18_39_12_600.mp4':

    Stream #0:0: Video: h264 (libx264), yuv420p, 320x240, q=-1--1, 400 kb/s, 10 tbc

    Stream #0:1: Audio: aac, 8000 Hz, mono, fltp, 32 kb/s

[mp4 @ 0xb62005e0] Using AVStream.codec.time_base as a timebase hint to the muxer is deprecated. Set AVStream.time_base instead.

[mp4 @ 0xb62005e0] Using AVStream.codec.time_base as a timebase hint to the muxer is deprecated. Set AVStream.time_base instead.

[mp4 @ 0xb62005e0] Encoder did not produce proper pts, making some up.

[libx264 @ 0xb6200fc0] frame I:3     Avg QP: 2.79  size: 72996

[libx264 @ 0xb6200fc0] frame P:383   Avg QP: 0.14  size: 54075

[libx264 @ 0xb6200fc0] frame B:216   Avg QP: 1.95  size: 64784

[libx264 @ 0xb6200fc0] consecutive B-frames: 30.1% 63.2%  6.0%  0.7%

[libx264 @ 0xb6200fc0] mb I  I16..4: 16.1% 12.7% 71.2%

[libx264 @ 0xb6200fc0] mb P  I16..4:  3.5%  5.1% 15.9%  P16..4: 20.3% 22.8% 14.0%  0.0%  0.0%    skip:18.3%

[libx264 @ 0xb6200fc0] mb B  I16..4:  0.4%  2.5%  8.2%  B16..8: 32.6% 19.8% 13.5%  
direct:22.2%  skip: 0.8%  L0:25.5% L1:12.8% BI:61.6%

[libx264 @ 0xb6200fc0] final ratefactor: -32.89

[libx264 @ 0xb6200fc0] 8x8 transform intra:21.0% inter:29.6%

[libx264 @ 0xb6200fc0] coded y,uvDC,uvAC intra: 100.0% 100.0% 100.0% inter: 83.3% 80.9% 80.9%

[libx264 @ 0xb6200fc0] i16 v,h,dc,p:  5%  7% 42% 46%

[libx264 @ 0xb6200fc0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14% 12% 23%  8%  6%  6%  8%  9% 14%

[libx264 @ 0xb6200fc0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 11% 19% 10%  8%  8% 10% 10% 12%

[libx264 @ 0xb6200fc0] i8c dc,h,v,p: 78%  3%  4% 15%

[libx264 @ 0xb6200fc0] Weighted P-Frames: Y:0.5% UV:0.3%

[libx264 @ 0xb6200fc0] ref P L0: 43.4% 14.6% 19.0% 22.9%  0.1%

[libx264 @ 0xb6200fc0] ref B L0: 63.3% 35.7%  1.1%

[libx264 @ 0xb6200fc0] ref B L1: 97.0%  3.0%

[libx264 @ 0xb6200fc0] kb/s:4.53

[aac @ 0xb6201ba0] 2 frames left in the queue on closing

很可能您在VFR(可变帧速率)模式下编码,但未能向libx264提供正确的pts(mp4模块对此有提示)。因为根据您的输出,libx264认为它的编码速度约为4.5 kb/s,而您要求它以400 kb/s的速度进行编码,即即使在最低的QPs下,它也无法丰富您的目标比特率(这并没有结束,而是在使用比特率的情况下)。

我尝试了最新的演示,然后成功了。doc/examples中的旧版本2.0.4 demo muxing.c在2.3.3 ffmpeg中效果不佳