gpt4 book ai didi

video - ffmpeg sdl 输出帧率太高

转载 作者:行者123 更新时间:2023-12-04 22:46:43 26 4
gpt4 key购买 nike

我正在使用以下命令行通过 SDL 播放视频:

ffmpeg -i input.mkv -f sdl "Video"

视频播放速度太快,ffmpeg 打印出帧速率约为 500(不是恒定的,只是尽可能快地播放)
我试图将帧速率限制如下,但这些都没有任何效果:
ffmpeg -i input.mkv -r 25 -f sdl "Video"  
ffmpeg -i input.mkv -f sdl -r 25 "Video"
ffmpeg -i input.mkv -framerate 25 -f sdl "Video"
ffmpeg -i input.mkv -f sdl -framerate 25 "Video"

我正在使用 ffmpeg 版本 ffmpeg-20150605-git-7be0f48-win64-static在 Windows 7 上。 ffplay input.mkv效果很好。

谢谢!

编辑: ffmpeg -i input.mkv -r 25 -f sdl "Video" 的控制台输出如下:
ffmpeg version N-72662-g7be0f48 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
ibilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopenc
ore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --ena
ble-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable
-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enabl
e-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable
-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --e
nable-lzma --enable-decklink --enable-zlib
libavutil 54. 26.101 / 54. 26.101
libavcodec 56. 41.101 / 56. 41.101
libavformat 56. 34.100 / 56. 34.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 16.101 / 5. 16.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.100 / 1. 2.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, matroska,webm, from 'input.mkv':
Metadata:
ENCODER : Lavf56.34.100
Duration: 00:20:00.20, start: 0.000000, bitrate: 1006 kb/s
Stream #0:0: Video: h264 (High), yuv420p, 720x304, SAR 1:1 DAR 45:19, 23.98
fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
Metadata:
BPS : 813254
BPS-eng : 813254
DURATION : 02:13:35.090000000
DURATION-eng : 02:13:35.090000000
NUMBER_OF_FRAMES: 192170
NUMBER_OF_FRAMES-eng: 192170
NUMBER_OF_BYTES : 814788601
NUMBER_OF_BYTES-eng: 814788601
_STATISTICS_WRITING_APP: mkvmerge v7.0.0 ('Where We Going') 32bit built on
Jun 9 2014 15:08:34
_STATISTICS_WRITING_APP-eng: mkvmerge v7.0.0 ('Where We Going') 32bit buil
t on Jun 9 2014 15:08:34
_STATISTICS_WRITING_DATE_UTC: 2015-01-07 06:01:37
_STATISTICS_WRITING_DATE_UTC-eng: 2015-01-07 06:01:37
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:1(eng): Audio: aac (LC), 48000 Hz, 5.1, fltp (default)
Metadata:
LANGUAGE : eng
BPS : 185184
BPS-eng : 185184
DURATION : 02:13:35.125000000
DURATION-eng : 02:13:35.125000000
NUMBER_OF_FRAMES: 375709
NUMBER_OF_FRAMES-eng: 375709
NUMBER_OF_BYTES : 185534548
NUMBER_OF_BYTES-eng: 185534548
_STATISTICS_WRITING_APP: mkvmerge v7.0.0 ('Where We Going') 32bit built on
Jun 9 2014 15:08:34
_STATISTICS_WRITING_APP-eng: mkvmerge v7.0.0 ('Where We Going') 32bit buil
t on Jun 9 2014 15:08:34
_STATISTICS_WRITING_DATE_UTC: 2015-01-07 06:01:37
_STATISTICS_WRITING_DATE_UTC-eng: 2015-01-07 06:01:37
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Output #0, sdl, to 'Video':
Metadata:
encoder : Lavf56.34.100
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 720x304 [SAR 1:1
DAR 45:19], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc (default)
Metadata:
BPS : 813254
BPS-eng : 813254
DURATION : 02:13:35.090000000
DURATION-eng : 02:13:35.090000000
NUMBER_OF_FRAMES: 192170
NUMBER_OF_FRAMES-eng: 192170
NUMBER_OF_BYTES : 814788601
NUMBER_OF_BYTES-eng: 814788601
_STATISTICS_WRITING_APP: mkvmerge v7.0.0 ('Where We Going') 32bit built on
Jun 9 2014 15:08:34
_STATISTICS_WRITING_APP-eng: mkvmerge v7.0.0 ('Where We Going') 32bit buil
t on Jun 9 2014 15:08:34
_STATISTICS_WRITING_DATE_UTC: 2015-01-07 06:01:37
_STATISTICS_WRITING_DATE_UTC-eng: 2015-01-07 06:01:37
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
encoder : Lavc56.41.101 rawvideo
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> rawvideo (native))
Press [q] to stop, [?] for help
frame=28726 fps=244 q=0.0 Lsize=N/A time=00:20:00.20 bitrate=N/A
video:9210274kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxi
ng overhead: unknown

最佳答案

在试验和阅读文档之后,我最终找到了我的问题的答案:

ffmpeg -re -i input.mkv -f sdl "Video"

解释 : 两个 -r , -framerate选项以及 fps filter all 会影响生成的视频帧率,并将其作为元数据写入输出文件,以供视频播放器稍后使用。对于 sdl (和其他一些)这没有效果,因为视频只是逐帧输出到OpenGL表面。执行此操作的速度仅取决于 ffmpeg 处理速度(在我的情况下约为 500fps)。为了限制这一点, -re选项存在,它将处理速度设置为输入定义的速度。

关于video - ffmpeg sdl 输出帧率太高,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31091107/

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