[FFmpeg-devel] [RFC] SRT demuxer
Patrik Kullman
patrik
Wed Feb 11 15:21:45 CET 2009
I've been working on a SRT demuxer and decoder for some time now but something doesn't seem to be working with the demuxer or the subtitle support.
I noticed that there aren't any subtitle formats that both have a demuxer and a decoder so maybe I've hit something that have gone by unnoticed.
If I decode a SRT file into a VOB, the demuxer successfully makes packets and sends to the decoder and finishes after reaching end of file. (ffmpeg -i input.srt -scodec dvbsub out.vob)
However, after applying Bj?rn Axelsson's "[FFmpeg-devel] [PATCH]Basic XSUB encoder (take 5)" and trying to encode avi+srt into avi+xsub, the demuxer gets called once, ffmpeg starts encoding - but writes only 14KB until I press 'q' to stop, at which point it writes the encoded video/audio data and calls the srt decoder once:
$ ffmpeg -i input.srt -i input.avi -scodec xsub output.avi
FFmpeg version SVN-r17153, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --enable-debug=3 --enable-nonfree --enable-swscale --enable-gpl --enable-libfaac
libavutil 49.14. 0 / 49.14. 0
libavcodec 52.14. 0 / 52.14. 0
libavformat 52.26. 0 / 52.26. 0
libavdevice 52. 1. 0 / 52. 1. 0
libswscale 0. 6. 1 / 0. 6. 1
built on Feb 11 2009 13:10:02, gcc: 4.3.2
Input #0, srt, from 'input.srt':
Duration: N/A, start: 26.000000, bitrate: N/A
Stream #0.0: Subtitle: srt
[NULL @ 0x23324d0]Invalid and inefficient vfw-avi packed B frames detected
Seems stream 0 codec frame rate differs from container frame rate: 23.98 (65535/2733) -> 23.98 (2997/125)
Input #1, avi, from 'input.avi':
Duration: 01:33:56.80, start: 0.000000, bitrate: 1037 kb/s
Stream #1.0: Video: mpeg4, yuv420p, 624x352 [PAR 1:1 DAR 39:22], 23.98 tb(r)
Stream #1.1: Audio: mp3, 48000 Hz, stereo, s16, 32 kb/s
File 'output.avi' already exists. Overwrite ? [y/N] y
Output #0, avi, to 'output.avi':
Stream #0.0: Video: mpeg4, yuv420p, 624x352 [PAR 1:1 DAR 39:22], q=2-31, 200 kb/s, 23.98 tb(c)
Stream #0.1: Audio: mp2, 48000 Hz, stereo, s16, 64 kb/s
Stream #0.2: Subtitle: xsub
Stream mapping:
Stream #1.0 -> #0.0
Stream #1.1 -> #0.1
Stream #0.0 -> #0.2
[srt @ 0x2328d50]init SRT decoder!
Press [q] to stop encoding
[mpeg4 @ 0x23324d0]Invalid and inefficient vfw-avi packed B frames detected
[srt @ 0x2328d50]65 q=31.0 size= 14kB time=35.37 bitrate= 3.2kbits/s
call decode_frame - sub->pts: 940
frame= 941 fps=542 q=31.0 Lsize= 2150kB time=39.25 bitrate= 448.7kbits/s
video:1765kB audio:310kB global headers:0kB muxing overhead 3.621500%
ffmpeg -fdebug 1 tells me that av_read_packet/av_read_frame_internal is only called once for the srt demuxer:
[srt @ 0x1b4aa60]av_read_packet stream=0, pts=26000, dts=26000, size=79, flags=0
[srt @ 0x1b4aa60]av_read_frame_internal stream=0, pts=26000, dts=26000, size=79, flags=0
And comparing with the corresponding from avi:
[avi @ 0x1b54190]av_read_packet stream=1, pts=-9223372036854775808, dts=0, size=384, flags=1
[avi @ 0x1b54190]av_read_frame_internal stream=1, pts=0, dts=0, size=384, flags=1
[avi @ 0x1b54190]av_read_packet stream=1, pts=-9223372036854775808, dts=1, size=96, flags=1
[avi @ 0x1b54190]av_read_frame_internal stream=1, pts=1, dts=1, size=96, flags=1
[avi @ 0x1b54190]av_read_packet stream=1, pts=-9223372036854775808, dts=2, size=96, flags=1
[avi @ 0x1b54190]av_read_frame_internal stream=1, pts=2, dts=2, size=96, flags=1
I start to think that av_read_frame_internal is supposed to normalize the pts, which it doesn't for the SRT.
Any ideas what could be wrong?
Attaching the demuxer.
Thanks in advance,
Patrik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: srtdec.c
Type: text/x-csrc
Size: 3207 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090211/a2851865/attachment.c>
More information about the ffmpeg-devel
mailing list