博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
使用ffmpeg将yuv编码成h264时有大小限制,太小的数据源编码会失败。
阅读量:4059 次
发布时间:2019-05-25

本文共 6565 字,大约阅读时间需要 21 分钟。

shell.albert@yantai:~/project/H.264/ffmpeg-2.6.2-64bit-static> ls -l fb001.h264

-rw-r--r-- 1 shell.albert users 0 Apr 23 16:44 fb001.h264
shell.albert@yantai:~/project/H.264/ffmpeg-2.6.2-64bit-static> clear
shell.albert@yantai:~/project/H.264/ffmpeg-2.6.2-64bit-static> ls -lh ../football/fb001.yuv
-rw-r--r-- 1 shell.albert users 124K Feb 12  2002 ../football/fb001.yuv
shell.albert@yantai:~/project/H.264/ffmpeg-2.6.2-64bit-static> ./ffmpeg  -s cif -pix_fmt yuv420p -i ../football/fb001.yuv  -vcodec libx264   fb001.h264
ffmpeg version 2.6.2-   http://johnvansickle.com/ffmpeg/    Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --enable-libass --enable-gnutls --enable-libvidstab --enable-libsoxr --cc=gcc-4.9
  libavutil      54. 20.100 / 54. 20.100
  libavcodec     56. 26.100 / 56. 26.100
  libavformat    56. 25.101 / 56. 25.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.102 /  5. 11.102
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
[rawvideo @ 0x2bcec80] Estimating duration from bitrate, this may be inaccurate
Input #0, rawvideo, from '../football/fb001.yuv':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 25344 kb/s
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 352x288, 30412 kb/s, 25 tbr, 25 tbn, 25 tbc
File 'fb001.h264' already exists. Overwrite ? [y/N] y
[libx264 @ 0x2bd1660] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64
[libx264 @ 0x2bd1660] profile High, level 1.3
Output #0, h264, to 'fb001.h264':
  Metadata:
    encoder         : Lavf56.25.101
    Stream #0:0: Video: h264 (libx264), yuv420p, 352x288, q=-1--1, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc56.26.100 libx264
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[rawvideo @ 0x2bd04e0] Invalid buffer size, packet size 126720 < expected frame_size 152064
Error while decoding stream #0:0: Invalid argument
frame=    0 fps=0.0 q=0.0 Lsize=       0kB time=00:00:00.00 bitrate=N/A    
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
Conversion failed!
shell.albert@yantai:~/project/H.264/ffmpeg-2.6.2-64bit-static>

shell.albert@yantai:~/project/H.264/ffmpeg-2.6.2-64bit-static> cat fb001.yuv  fb002.yuv  fb003.yuv >fb123.yuv

shell.albert@yantai:~/project/H.264/ffmpeg-2.6.2-64bit-static> ls -l *.yuv
-rw-r--r-- 1 shell.albert users 126720 Apr 23 16:50 fb001.yuv
-rw-r--r-- 1 shell.albert users 126720 Apr 23 16:50 fb002.yuv
-rw-r--r-- 1 shell.albert users 126720 Apr 23 16:50 fb003.yuv
-rw-r--r-- 1 shell.albert users 380160 Apr 23 16:51 fb123.yuv
shell.albert@yantai:~/project/H.264/ffmpeg-2.6.2-64bit-static> bc
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
126702*3
380106

shell.albert@yantai:~/project/H.264/ffmpeg-2.6.2-64bit-static> ./ffmpeg  -s cif -pix_fmt yuv420p -i fb123.yuv  -vcodec libx264  fb123.h264

ffmpeg version 2.6.2-   http://johnvansickle.com/ffmpeg/    Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --enable-libass --enable-gnutls --enable-libvidstab --enable-libsoxr --cc=gcc-4.9
  libavutil      54. 20.100 / 54. 20.100
  libavcodec     56. 26.100 / 56. 26.100
  libavformat    56. 25.101 / 56. 25.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.102 /  5. 11.102
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
[rawvideo @ 0x323ec80] Estimating duration from bitrate, this may be inaccurate
Input #0, rawvideo, from 'fb123.yuv':
  Duration: 00:00:00.12, start: 0.000000, bitrate: 25344 kb/s
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 352x288, 30412 kb/s, 25 tbr, 25 tbn, 25 tbc
[libx264 @ 0x32415a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64
[libx264 @ 0x32415a0] profile High, level 1.3
Output #0, h264, to 'fb123.h264':
  Metadata:
    encoder         : Lavf56.25.101
    Stream #0:0: Video: h264 (libx264), yuv420p, 352x288, q=-1--1, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc56.26.100 libx264
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[rawvideo @ 0x3240420] Invalid buffer size, packet size 76032 < expected frame_size 152064
Error while decoding stream #0:0: Invalid argument
frame=    2 fps=0.0 q=-1.0 Lsize=      33kB time=00:00:00.08 bitrate=3353.4kbits/s    
video:33kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
[libx264 @ 0x32415a0] frame I:1     Avg QP:29.71  size: 16172
[libx264 @ 0x32415a0] frame P:1     Avg QP:31.49  size: 17362
[libx264 @ 0x32415a0] mb I  I16..4:  3.8% 64.9% 31.3%
[libx264 @ 0x32415a0] mb P  I16..4:  5.6% 58.6% 34.6%  P16..4:  0.8%  0.5%  0.0%  0.0%  0.0%    skip: 0.0%
[libx264 @ 0x32415a0] 8x8 transform intra:62.1% inter:80.0%
[libx264 @ 0x32415a0] coded y,uvDC,uvAC intra: 81.5% 99.9% 99.7% inter: 95.0% 100.0% 100.0%
[libx264 @ 0x32415a0] i16 v,h,dc,p:  3% 84%  3% 11%
[libx264 @ 0x32415a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  5% 32% 24%  5%  6%  3%  9%  5% 12%
[libx264 @ 0x32415a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 33% 13%  5%  8%  6% 11%  4%  9%
[libx264 @ 0x32415a0] i8c dc,h,v,p: 49% 38%  5%  8%
[libx264 @ 0x32415a0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x32415a0] kb/s:3353.40
shell.albert@yantai:~/project/H.264/ffmpeg-2.6.2-64bit-static> ls -l fb123.yuv  fb123.h264
-rw-r--r-- 1 shell.albert users  33534 Apr 23 16:53 fb123.h264
-rw-r--r-- 1 shell.albert users 380160 Apr 23 16:51 fb123.yuv
shell.albert@yantai:~/project/H.264/ffmpeg-2.6.2-64bit-static>

你可能感兴趣的文章
[LeetCode By Python]121. Best Time to Buy and Sell Stock
查看>>
Android/Linux 内存监视
查看>>
Android2.1消息应用(Messaging)源码学习笔记
查看>>
Variable property attributes or Modifiers in iOS
查看>>
NSNotificationCenter 用法总结
查看>>
C primer plus 基础总结(一)
查看>>
剑指offer算法题分析与整理(三)
查看>>
mint/ubuntu安装搜狗输入法
查看>>
C++动态申请数组和参数传递问题
查看>>
opencv学习——在MFC中读取和显示图像
查看>>
JVM并发机制探讨—内存模型、内存可见性和指令重排序
查看>>
nginx+tomcat+memcached (msm)实现 session同步复制
查看>>
WAV文件解析
查看>>
WPF中PATH使用AI导出SVG的方法
查看>>
QT打开项目提示no valid settings file could be found
查看>>
Win10+VS+ESP32环境搭建
查看>>
android 代码实现圆角
查看>>
flutter-解析json
查看>>
android中shader的使用
查看>>
java LinkedList与ArrayList迭代器遍历和for遍历对比
查看>>