Reputation: 1328
I'm using the following command-line to play a video via SDL:
ffmpeg -i input.mkv -f sdl "Video"
The video is being played too fast, ffmpeg prints that the framerate is ~500 (not constant, just playing as fast as possible) I've tried to limit the framerate as follows, but none of this has any effect:
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"
I'm using ffmpeg version ffmpeg-20150605-git-7be0f48-win64-static
on Windows 7.
ffplay input.mkv
works pretty well.
Thank you!
EDIT: console output for ffmpeg -i input.mkv -r 25 -f sdl "Video"
follows:
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
Upvotes: 2
Views: 2647
Reputation: 1328
After experimenting and reading docs, I have eventually figured the answer to my question:
ffmpeg -re -i input.mkv -f sdl "Video"
Explanation: both -r
, -framerate
options as well as fps
filter all affect the produced video framerate and write it as metadata to the output file to be later consumed by a video player. For sdl
(and some others) this has no effect because the video is just being outputted to and OpenGL surface, frame by frame. The speed at which this is performed depends solely on the ffmpeg processing speed (which in my case was somewhere ~500fps). In order to restrict this, -re
option exists, which sets the processing speed to that defined by the input.
Upvotes: 4