几个月来,我在结合使用FFmpeg
和视频代码h264
时遇到问题。视频生成工作正常,没有任何错误。自2015年以来,我一直在使用以下脚本从单张图片中构建视频:
#!/bin/bash
# ------------------------------------------------------------------------------
#
# Video generator
# Tobias Holzmann
# Date: 18.03.15
# Update: 24.12.2019
# Switch back to ffmpeg from avconv
#
# ------------------------------------------------------------------------------
frameRate=30
vcodec="h264"
crf=18 # Between 0-51; 23 is default. 0 = lossless
# ------------------------------------------------------------------------------
ffmpeg \
-f image2 \
-r $frameRate \
-i animation.%4d.png \
-r $frameRate \
-crf $crf \
-vcodec $vcodec \
AVideo.flv
# ------------------------------------------------------------------------------
今天,我使它变得更花哨且更易于使用。但是,问题是,我使用h264
生成的所有视频都根本无法使用vlc
播放器或通用Ubuntu视频播放器播放。我收到如下错误:
shorty@animation: vlc AVideo.flv
VLC media player 3.0.8 Vetinari (revision 3.0.8-0-gf350b6b5a7)
[000055c0e70af420] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[NULL @ 0x7fe318c2c2a0] Invalid NAL unit size (30490 > 15039).
[NULL @ 0x7fe318c2c2a0] missing picture in access unit with size 15733
[h264 @ 0x7fe318c2c2a0] Invalid NAL unit size (30490 > 15039).
[h264 @ 0x7fe318c2c2a0] Error splitting the input into NAL units.
[00007fe324c1c420] avcodec decoder: Using NVIDIA VDPAU Driver Shared Library 430.50 Thu Sep 5 22:38:52 CDT 2019 for hardware decoding
[h264 @ 0x7fe325428ac0] hardware accelerator failed to decode picture
[h264 @ 0x7fe324c1fb00] hardware accelerator failed to decode picture
[h264 @ 0x7fe324eb9d80] hardware accelerator failed to decode picture
[h264 @ 0x7fe324ed6080] hardware accelerator failed to decode picture
[h264 @ 0x7fe324ef2400] hardware accelerator failed to decode picture
[h264 @ 0x7fe324f0e780] hardware accelerator failed to decode picture
[h264 @ 0x7fe325428ac0] hardware accelerator failed to decode picture
[h264 @ 0x7fe324c1fb00] hardware accelerator failed to decode picture
[h264 @ 0x7fe324eb9d80] hardware accelerator failed to decode picture
[h264 @ 0x7fe324ed6080] hardware accelerator failed to decode picture
[h264 @ 0x7fe324ef2400] hardware accelerator failed to decode picture
[00007fe324c1c420] main decoder error: buffer deadlock prevented
[h264 @ 0x7fe324f0e780] hardware accelerator failed to decode picture
...
...
我想知道是否有人知道问题所在。任何提示或反馈表示赞赏。预先感谢您,托比。