执行 avprobe test.h264
命令会输出以下结果:
Input #0, h264, from 'test.h264':
Duration: N/A, bitrate: N/A
Stream #0.0: Video: h264 (High), yuv420p, 720x480, 25 fps, 25 tbn, 50 tbc
执行
file test.h264
命令将输出:test.h264: JVT NAL sequence, H.264 video @ L 30
请注意,该文件并未损坏或损坏,在VLC上我可以毫无问题地播放它。
有办法从原始H264文件中获取持续时间和比特率吗?我在某个地方读到,如果首先解码文件,则可能是可能的,但我不确定如何做到这一点。
编辑#1
我正在使用名为
picamera
的Python库创建H264文件。编辑#2
运行
avconv -i test.h264 -f null -
时的控制台输出。avconv version 11.7-6:11.7-1~deb8u1+rpi1, Copyright (c) 2000-2016 the Libav developers
built on Jun 17 2016 02:13:49 with gcc 4.9.2 (Raspbian 4.9.2-10)
[h264 @ 0x1bcc200] Estimating duration from bitrate, this may be inaccurate
Input #0, h264, from 'test.h264':
Duration: N/A, bitrate: N/A
Stream #0.0: Video: h264 (High), yuv420p, 720x480, 25 fps, 25 tbn
Output #0, null, to 'pipe:':
Metadata:
encoder : Lavf56.1.0
Stream #0.0: Video: rawvideo, yuv420p, 720x480, q=2-31, 200 kb/s, 25 tbn, 25 tbc
Metadata:
encoder : Lavc56.1.0 rawvideo
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> rawvideo (native))
Press ctrl-c to stop encoding
frame= 208 fps= 68 q=0.0 Lsize= 0kB time=10000000000.00 bitrate= 0.0kbits/s
video:13kB audio:0kB other streams:0kB global headers:0kB muxing overhead: unknown
'-i
之前添加-framerate N
,其中N是fps值,否则ffmpeg将假定为25 fps。 - Gyanavconv -framerate 30 -i test.h264 -c copy test.mp4
运行得非常完美!谢谢! - Maxime Dupré