Ticket #1828 (closed enhancement: fixed)
Start timestamp ignored when muxing dvd_subtitle
| Reported by: | billie | Owned by: | ubitux |
|---|---|---|---|
| Priority: | normal | Component: | avformat |
| Version: | git-master | Keywords: | dvdsub |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description (last modified by ubitux) (diff)
When adding a dvd_subtitle to a video file the starting time-stamp is ignored which causes all subsequent subtitles to be displayed to early by this time-stamp. I will attach a sample video file and the subtitle.idx/sub files. The subtitle file contains three subtitles starting after 5, 15 and 25 seconds with a duration of 2 seconds. When playing the resulting video file including the subtitle the subtitles are displayed after 0, 10 and 20 seconds.
The following command line can be used to reproduce the issue:
% ffmpeg -i test.mkv -i subtitle.sub -map 0 -map 1 -c: copy -f matroska test_subs.mkv
ffmpeg version N-45643-g6a762b6 Copyright (c) 2000-2012 the FFmpeg developers
built on Oct 17 2012 17:29:33 with gcc 4.5.4 (Gentoo 4.5.4 p1.0, pie-0.4.7)
configuration: --cc=i686-pc-linux-gnu-gcc --cxx=i686-pc-linux-gnu-g++ --ar=i686-pc-linux-gnu-ar --optflags='-march=native -O2 -pipe -fomit-frame-pointer' --extra-cflags='-march=native -O2 -pipe -fomit-frame-pointer' --extra-cxxflags='-march=native -O2 -pipe -fomit-frame-pointer' --enable-gpl --enable-version3 --enable-postproc --enable-avfilter --disable-stripping --disable-debug --disable-doc --disable-vdpau --disable-ffplay --enable-gnutls --enable-libmp3lame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-libaacplus --enable-nonfree --enable-libfaac --enable-nonfree --enable-libcdio --enable-libdc1394 --enable-openal --disable-indev=v4l --disable-indev=jack --enable-x11grab --enable-libv4l2 --disable-outdev=sdl --enable-frei0r --enable-libfreetype --enable-libass --enable-pthreads --enable-libopencore-amrwb --enable-libopencore-amrnb --enable-libgsm --enable-libmodplug --enable-libschroedinger --enable-libspeex --enable-libvp libavutil 51. 76.100 / 51. 76.100
libavcodec 54. 66.100 / 54. 66.100
libavformat 54. 33.100 / 54. 33.100
libavdevice 54. 3.100 / 54. 3.100
libavfilter 3. 19.103 / 3. 19.103
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 16.100 / 0. 16.100
libpostproc 52. 1.100 / 52. 1.100
Input #0, matroska,webm, from 'test.mkv':
Metadata:
ENCODER : Lavf53.32.100
Duration: 00:00:30.01, start: 0.000000, bitrate: 38 kb/s
Stream #0:0: Video: h264 (High), yuv420p, 320x240, SAR 1:1 DAR 4:3, 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
Stream #0:1: Audio: ac3, 48000 Hz, stereo, s16, 32 kb/s (default)
Input #1, mpeg, from 'subtitle.sub':
Duration: 00:00:20.00, start: 5.079989, bitrate: 2 kb/s
Stream #1:0[0x20]: Subtitle: dvd_subtitle
Output #0, matroska, to 'test_subs.mkv':
Metadata:
encoder : Lavf54.33.100
Stream #0:0: Video: h264, yuv420p, 320x240 [SAR 1:1 DAR 4:3], q=2-31, 25 fps, 1k tbn, 1k tbc (default)
Stream #0:1: Audio: ac3, 48000 Hz, stereo, 32 kb/s (default)
Stream #0:2: Subtitle: dvd_subtitle
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Stream #1:0 -> #0:2 (copy)
Press [q] to stop, [?] for help
frame= 750 fps=0.0 q=-1.0 Lsize= 143kB time=00:00:30.01 bitrate= 39.0kbits/s
video:13kB audio:117kB subtitle:1 global headers:0kB muxing overhead 8.907932%
Attachments
Change History
comment:2 Changed 7 months ago by ubitux
- Keywords vobsub added
- Owner set to ubitux
- Status changed from new to open
- Component changed from undetermined to avformat
- Type changed from defect to enhancement
The index file (.idx) contains timing information which are simply ignored (and use the timestamp in the MPEG stream of the .sub): FFmpeg doesn't support yet VobSub?. A demuxer is in development (still not usable), see http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2012-September/130546.html.
I'll update this ticket when it's done and applied.
comment:3 follow-up: ↓ 4 Changed 7 months ago by Cigaes
In the meantime before the vobsub demuxer is complete, you can use mkvmerge to merge the two vobsub files into a single Matroska file with just the subtitle stream: ffmpeg will be able to read it, with the correct timestamps.
comment:4 in reply to: ↑ 3 Changed 7 months ago by billie
Replying to Cigaes:
In the meantime before the vobsub demuxer is complete, you can use mkvmerge to merge the two vobsub files into a single Matroska file with just the subtitle stream: ffmpeg will be able to read it, with the correct timestamps.
Thank you for the tip but this is the workaround I am currently using.
comment:5 follow-up: ↓ 7 Changed 6 months ago by ubitux
- Status changed from open to closed
- Resolution set to fixed
Added in 710c4baf.
You can try to mux with -i sub.idx.
comment:7 in reply to: ↑ 5 ; follow-up: ↓ 8 Changed 5 months ago by billie
Replying to ubitux:
Added in 710c4baf.
You can try to mux with -i sub.idx.
Thank you very much for your work. Does this also work when directly using vob files as input? I tested one and it did work so I guess it does. When using version 0.10.5 I get errors like this for the subtitle streams:
Application provided invalid, non monotonically increasing dts to muxer in stream 2: 203320 >= 203320
av_interleaved_write_frame(): Invalid argument
comment:8 in reply to: ↑ 7 Changed 5 months ago by ubitux
Replying to billie:
Replying to ubitux:
Added in 710c4baf.
You can try to mux with -i sub.idx.
Thank you very much for your work. Does this also work when directly using vob files as input? I tested one and it did work so I guess it does. When using version 0.10.5 I get errors like this for the subtitle streams:
Application provided invalid, non monotonically increasing dts to muxer in stream 2: 203320 >= 203320
av_interleaved_write_frame(): Invalid argument
No, the ticket was about supporting idx/sub, so I added support for idx/sub :)
About demuxing DVD subtitles properly and being able to mux them as VobSub? belongs to another issue.




sample video file