[FFmpeg-trac] #5093(avformat:new): Accurate seek not possible with MPEG program stream and transport sream
FFmpeg
trac at avcodec.org
Fri Dec 18 07:59:47 CET 2015
#5093: Accurate seek not possible with MPEG program stream and transport sream
----------------------------------+---------------------------------------
Reporter: pkerling | Type: enhancement
Status: new | Priority: normal
Component: avformat | Version: unspecified
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
----------------------------------+---------------------------------------
According to the documentation, the "-ss" ffmpeg option should be frame-
accurate. Sadly, this is not the case for MPEG program and transport
streams. It always skips to the closest keyframe after the specified
timestamp.
How to reproduce:
{{{
% ffmpeg -loop 1 -i
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVQI12NgYGAAAAAEAAEnNCcKAAAAAElFTkSuQmCC'
-vf
scale=640:480,drawtext="fontfile=/usr/share/fonts/DejaVuSans.ttf:text='%{n}
%{pts}':x=5:y=5:fontsize=50:fontcolor=yellow:box=1:boxcolor=red" -r 25 -t
00:01:00 -codec:v mpeg2video -g 40 test.mpg
ffmpeg version 2.8.3 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 5.1.1 (GCC) 20150618 (Red Hat 5.1.1-4)
configuration: --prefix=/usr --bindir=/usr/bin
--datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg
--libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2
-g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-
gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64
-mtune=generic' --enable-bzlib --disable-crystalhd --enable-frei0r
--enable-gnutls --enable-ladspa --enable-libass --enable-libcdio --enable-
libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm
--enable-libmp3lame --enable-openal --enable-libopencv --enable-
libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger
--enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis
--enable-libv4l2 --enable-libvpx --enable-libx264 --enable-libx265
--enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample
--enable-postproc --enable-pthreads --disable-static --enable-shared
--enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64
--enable-runtime-cpudetect
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
Input #0, png_pipe, from
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVQI12NgYGAAAAAEAAEnNCcKAAAAAElFTkSuQmCC':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: png, rgb24(pc), 1x1, 25 fps, 25 tbr, 25 tbn, 25
tbc
[mpeg @ 0x16f59e0] VBV buffer size not set, using default size of 130KB
If you want the mpeg file to be compliant to some specification
Like DVD, VCD or others, make sure you set the correct buffer size
Output #0, mpeg, to 'test.mpg':
Metadata:
encoder : Lavf56.40.101
Stream #0:0: Video: mpeg2video, yuv420p, 640x480, q=2-31, 200 kb/s, 25
fps, 90k tbn, 25 tbc
Metadata:
encoder : Lavc56.60.100 mpeg2video
Stream mapping:
Stream #0:0 -> #0:0 (png (native) -> mpeg2video (native))
Press [q] to stop, [?] for help
frame= 1500 fps=716 q=21.7 Lsize= 1606kB time=00:00:59.96 bitrate=
219.4kbits/s
video:1586kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 1.251059%
% ffmpeg -ss 00:00:05 -i test.mpg -frames:v 1 test.png
ffmpeg version 2.8.3 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 5.1.1 (GCC) 20150618 (Red Hat 5.1.1-4)
configuration: --prefix=/usr --bindir=/usr/bin
--datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg
--libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2
-g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-
gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64
-mtune=generic' --enable-bzlib --disable-crystalhd --enable-frei0r
--enable-gnutls --enable-ladspa --enable-libass --enable-libcdio --enable-
libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm
--enable-libmp3lame --enable-openal --enable-libopencv --enable-
libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger
--enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis
--enable-libv4l2 --enable-libvpx --enable-libx264 --enable-libx265
--enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample
--enable-postproc --enable-pthreads --disable-static --enable-shared
--enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64
--enable-runtime-cpudetect
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
Input #0, mpeg, from 'test.mpg':
Duration: 00:01:00.00, start: 0.540000, bitrate: 219 kb/s
Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 640x480
[SAR 1:1 DAR 4:3], max. 104857 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Output #0, image2, to 'test.png':
Metadata:
encoder : Lavf56.40.101
Stream #0:0: Video: png, rgb24, 640x480 [SAR 1:1 DAR 4:3], q=2-31, 200
kb/s, 25 fps, 25 tbn, 25 tbc
Metadata:
encoder : Lavc56.60.100 png
Stream mapping:
Stream #0:0 -> #0:0 (mpeg2video (native) -> png (native))
Press [q] to stop, [?] for help
frame= 1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:01.48 bitrate=N/A
video:17kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: unknown
}}}
Result: Frame with PTS 6.4 seconds is shown instead of somewhere close to
5 seconds.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/5093>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list