gpt4 book ai didi

ffmpeg - 错误的视频时长和 fps

转载 作者:行者123 更新时间:2023-12-04 23:33:18 40 4
gpt4 key购买 nike

我通过 VLC 录制了一个 RTSP 流(4K)大约一个小时,发生了一些奇怪的事情。
文件大小为 6.6 GB,但视频长度只有 12 分钟。
当我在 VLC 上播放时,进度条到达末尾,但视频仍在连续播放。
除此之外,它的 FPS 为 213,尽管播放速度为 30 FPS。
我尝试了以下命令,但无法解决问题。

$ ffmpeg -i <INPUT.mp4> -filter:v fps=fps=30 <OUTPUT.mp4>

// Only returns a 12 minutes long video
$ ffmpeg -vsync drop -i <INPUT.mp4> -map 0:v -vcodec copy output.mp4

// Crashes immediately

ffmpeg version 4.3.2-0york0~18.04 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
configuration: --prefix=/usr --extra-version='0york0~18.04' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libzimg --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55ed710400c0] st: 0 edit list: 1 Missing key frame while searching for timestamp: 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55ed710400c0] st: 0 edit list 1 Cannot find an index entry before timestamp: 0.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from <INPUT.mp4>:
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: mp41avc1
creation_time : 2021-11-20T01:02:54.000000Z
encoder : vlc 3.0.16 stream output
encoder-eng : vlc 3.0.16 stream output
Duration: 00:11:42.58, start: 0.000000, bitrate: 74723 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 3840x2160 [SAR 1:1 DAR 16:9], 74694 kb/s, 30.07 fps, 120 tbr, 1000k tbn, 60 tbc (default)
Metadata:
creation_time : 2021-11-20T01:02:54.000000Z
handler_name : VideoHandler
Output #0, mp4, to 'output.mp4':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: mp41avc1
encoder : Lavf58.45.100
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 74694 kb/s, 30.07 fps, 120 tbr, 1000k tbn, 1000k tbc (default)
Metadata:
creation_time : 2021-11-20T01:02:54.000000Z
handler_name : VideoHandler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x55ed71043180] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
av_interleaved_write_frame(): Invalid argument
frame= 1 fps=0.0 q=-1.0 Lsize= 0kB time=-577014:32:22.77 bitrate=N/A speed=N/A
video:623kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!

最佳答案

尽管由于帧损坏而无法恢复完整文件,但我想分享进度。MP4Box支持在不重新编码的情况下更改帧率$ MP4Box -single 1 -raw 1 <INPUT_MP4_FILE>它将返回两个文件,<INPUT_MP4_FILE>_track1.mp4<INPUT_MP4_FILE>_track1.h264 .<INPUT_MP4_FILE>_track1.mp4是具有正确 fps 和持续时间的文件。
对于我的视频,文件在 54:17 停止(总长度为 1:23:17),我相信这是由于帧损坏。
Reference

关于ffmpeg - 错误的视频时长和 fps,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70060384/

40 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com