我有一台摄像机,可以使用如下 ffmpeg 命令来生成短片:ffmpeg -ss 00:01:00 -i INPUT.mp4 -t 00:00:30 -codec copy OUTPUT.mp4
这之前已经过测试并且可以正常工作,但是最近该命令在使用新创建的视频文件时失败,并且我看到类似这样的错误,视频输出无法播放:
[mp4 @ 0x55f1ac7e71c0] Application provided duration: -9223372036854775808 / timestamp: -9223372036854775808 is out of range for mov/mp4 format
[mp4 @ 0x55f1ac7e71c0] pts has no value
为什么持续时间和时间戳值这么高(负值?)?
源视频文件播放正常,我可以重新编码它们并获得质量不错的输出。我还可以用来-vcodec copy -an
抑制音轨,虽然我在终端输出中看到相同的错误,但它确实输出了可播放的视频片段,但没有声音。
如果有必要的话,我正在使用带有 Fedora 34 Workstation 的 ffmpeg 版本 4.4。
以下是带有完整控制台输出的命令:
ffmpeg -ss 00:01:00 -i GHAG0912.MP4 -t 00:00:10 -codec copy OUT.mp4
ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 11 (GCC)
configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' --extra-ldflags='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld ' --extra-cflags=' -I/usr/include/rav1e' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-fontconfig --enable-frei0r --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libaom --enable-libdav1d --enable-libass --enable-libbluray --enable-libcdio --enable-libdrm --enable-libjack --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-nvenc --enable-openal --enable-opencl --enable-opengl --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librav1e --enable-libsmbclient --enable-version3 --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-version3 --enable-vapoursynth --enable-libvpx --enable-vulkan --enable-libglslang --enable-libx264 --enable-libx265 --enable-libxvid --enable-libxml2 --enable-libzimg --enable-libzvbi --enable-lv2 --enable-avfilter --enable-avresample --enable-libmodplug --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-lto --enable-libmfx --enable-runtime-cpudetect
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'GHAG0912.MP4':
Metadata:
major_brand : mp41
minor_version : 538120216
compatible_brands: mp41
creation_time : 2016-05-14T15:10:15.000000Z
firmware : HD8.01.02.50.00
Duration: 00:05:00.57, start: 0.000000, bitrate: 55758 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 3840x2160 [SAR 1:1 DAR 16:9], 55506 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc (default)
Metadata:
creation_time : 2016-05-14T15:10:15.000000Z
handler_name : GoPro AVC
vendor_id : [0][0][0][0]
encoder : GoPro AVC encoder
timecode : 15:10:15:12
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
Metadata:
creation_time : 2016-05-14T15:10:15.000000Z
handler_name : GoPro AAC
vendor_id : [0][0][0][0]
timecode : 15:10:15:12
Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
Metadata:
creation_time : 2016-05-14T15:10:15.000000Z
handler_name : GoPro TCD
timecode : 15:10:15:12
Stream #0:3(eng): Data: bin_data (gpmd / 0x646D7067), 44 kb/s (default)
Metadata:
creation_time : 2016-05-14T15:10:15.000000Z
handler_name : GoPro MET
Stream #0:4(eng): Data: none (fdsc / 0x63736466), 9 kb/s (default)
Metadata:
creation_time : 2016-05-14T15:10:15.000000Z
handler_name : GoPro SOS
[mp4 @ 0x557a365f5180] Application provided duration: -9223372036854775808 / timestamp: -9223372036854775808 is out of range for mov/mp4 format
[mp4 @ 0x557a365f5180] pts has no value
Output #0, mp4, to 'OUT.mp4':
Metadata:
major_brand : mp41
minor_version : 538120216
compatible_brands: mp41
firmware : HD8.01.02.50.00
encoder : Lavf58.76.100
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 55506 kb/s, 0.04 fps, 25 tbr, 90k tbn, 90k tbc (default)
Metadata:
creation_time : 2016-05-14T15:10:15.000000Z
handler_name : GoPro AVC
vendor_id : [0][0][0][0]
encoder : GoPro AVC encoder
timecode : 15:10:15:12
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
Metadata:
creation_time : 2016-05-14T15:10:15.000000Z
handler_name : GoPro AAC
vendor_id : [0][0][0][0]
timecode : 15:10:15:12
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 0 fps=0.0 q=-1.0 size= 0kB time=00:00:00.00 bitrate=N/A speed=N/frame= 268 fps=0.0 q=-1.0 Lsize= 72885kB time=00:00:09.99 bitrate=59739.3kbits/s speed= 301x
video:72629kB audio:248kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.010705%