Raspberry Pi 4是否保存损坏的h264文件?

问题描述

使用raspivid和通过Python,我都能够记录.h264文件而没有问题,但是无论如何,我都无法将它们转换为.mp4,.mkv或.avi文件。

我尝试使用MP4box(在几个地方建议)和mkvmerge进行转换,但无济于事。

当我使用MP4box(MP4box -add )时,我得到了:

AVC-H264 import - frame size 1920 x 1080 at 25.000 FPS
WARNING: NAL Unit type 0 not handled - adding5/100)
AVC Import results: 44 samples - Slices: 3 I 41 P 0 B - 0 SEI - 3 IDR
Saving video.mp4: 0.500 secs Interleaving

然后,我尝试使用VLC播放此文件,它没有给出错误,但显示乱码。

为清楚起见,相机工作正常(使用Python代码显示完美的视频,并且raspistill输出完美的jpg文件)。我也尝试过其他相机。

尝试使用mkvmerge:

pi@raspberrypi:~/cam $ raspivid -o test.h264 -fps 30 -t 15000 -w 1920 -h 1080
pi@raspberrypi:~/cam $ mkvmerge --default-duration 0:30p -o video.mkv test.h264
mkvmerge v31.0.0 ('Dolores In A Shoestand') 32-bit
'test.h264': Using the demultiplexer for the format 'AVC/h.264'.
'test.h264' track 0: Using the output module for the format 'AVC/h.264 (unframed)'.
The file 'video.mkv' has been opened for writing.
Error: 'test.h264' track 0: mkvmerge encountered broken or unparsable data in this AVC/h.264 video track. Either your file is damaged (which mkvmerge cannot cope with yet) or this is a bug in mkvmerge itself. The error message was:
Success
pi@raspberrypi:~/cam $

这是在Raspberry Pi 4上。

可以在此处找到示例文件:https://filebin.net/c40usz0crhgggadf 创建于:raspivid -t 30000 -w 640 -h 480 -fps 25 -b 1200000 -p 0,640,480 -o pivideo.h264

解决方法

我将自己对此做出回应。完成“ apt-get升级”后,问题就消失了。

如果有人想找出根本原因,这就是apt-get所做的:

The following packages will be upgraded:
  bind9-host bluez-firmware firmware-atheros firmware-brcm80211 firmware-libertas firmware-misc-nonfree firmware-realtek libbind9-161 libdns-export1104 libdns1104 libgs9 libgs9-common libisc-export1100 libisc1100 libisccc161
  libisccfg163 liblwres161 libraspberrypi-bin libraspberrypi-dev libraspberrypi-doc libraspberrypi0 pi-bluetooth raspberrypi-bootloader raspberrypi-kernel raspberrypi-kernel-headers raspi-config rpd-plym-splash
The following packages will be DOWNGRADED:
  python3-pgzero
27 upgraded,0 newly installed,1 downgraded,0 to remove and 0 not upgraded.

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...