树莓派4保存损坏的h264文件



无论是使用raspiid还是通过Python,我都可以毫无问题地录制.h264文件,但无论我尝试什么,我都无法将它们转换为.mp4、.mmv或.avi文件。

我尝试过使用MP4box(在一些地方建议使用(和mkvmerge进行转换,但没有成功。

当我使用MP4box(MP4box-添加<source.h264><dest.mp4>(时,我得到:

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 $

这是在树莓派4上。

可以在此处找到示例文件:https://filebin.net/c40usz0crhgggadf创建于:raspivid-t 30000-w 640-h 480-fps 25-b 1200000-p 0,0640480-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.

相关内容

  • 没有找到相关文章

最新更新