I've more or less understood stream mapping in ffmpeg, and I can create a single mkv file with srt or ass subtitles. I recently developed an interest in adding subtitles to .avi files instead, using ffmpeg. However, I learnt that avi files can only take Xsub subtitles. But when I tried to include them as Xsub, ( -scodec xsub ) ffmpeg says something about no bitmap being available. The subtitles were originally in an srt file. How do I resolve this? Can I use an srt file to generate and use Xsub subtitles using only ffmpeg and SubtitleEdit, or are other tools required? And I've also tried AVIAddXSubs.exe but the subtitles don't come the way I wan't them too. And ffmpeg doesn't seem to be able to read from idx/sub pairs.
+ Reply to Thread
Results 1 to 9 of 9
Thread: Xsub and Ffmpeg
AviAddXSubs will mux .srt into .avi and output .divx file with selectable subs. I've been using it to watch .avi/.divx on Divx certified DVD players for over 5 years. The embedded xsubs will not show on my WD set top box. For that I have AviAddXSubs output idx/sub. So just change the setting to produce xsubs instead of idx/sub. See the guide for the app
As I was trying to say earlier, I'd rather do it with ffmpeg, I just don't know how. There must be a way, because ffmpeg lists Xsub among it's codecs (As a decoder and an encoder as well). And I know how to create idx/sub pairs, it's Xsub I'm focusing on, preferably through ffmpeg. In any case, I've more or less figured out how to use AviAddXSubs, so there is no need for a guide for that. A guide on how it's done with ffmpeg would be more helpful, as I use ffmpeg for most of my audio/video manipulation. Thanks for the help, anyway.
I don't think you'll have much luck with xsubs. Even the author of AviAddXSubs told me he doesn't know how to extract them from .avi(in the case where I no longer had the subtitle source files but had .avi with the subs embedded.) Apparently there's no spec and he just learned how to mux them in from trial and error. You may need to use a 2 step process. Create the .avis then mux in the subs with AviAddXSubs.
In all the years I've been playing avi/divx with xsubs I haven't noticed any progress handling them other than many of the players can handle multiple languages in one file. Your best bet may be asking around on the developer sites. But as mkv and mp4 come more into favor avi isn't likely to see a lot of innovation. It's more likely just to hang around for backward compatibility reasons.
The precise output is as follows:
C:\Users\Admin>ffmpeg -i "D:\Input.avi" -i "D:\Input.srt" -vcodec copy -acodec copy -scodec xsub -map 0:0 -map 0:1 -map 1:0 "D:\Output.avi"
ffmpeg version N-47062-g26c531c Copyright (c) 2000-2012 the FFmpeg developers
built on Nov 25 2012 12:21:26 with gcc 4.7.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-pthreads --enable-runt
ime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass -
-enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enab
le-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-libo
pus --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheo
ra --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-li
bvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --ena
libavutil 52. 9.100 / 52. 9.100
libavcodec 54. 77.100 / 54. 77.100
libavformat 54. 37.100 / 54. 37.100
libavdevice 54. 3.100 / 54. 3.100
libavfilter 3. 23.102 / 3. 23.102
libswscale 2. 1.102 / 2. 1.102
libswresample 0. 17.101 / 0. 17.101
libpostproc 52. 2.100 / 52. 2.100
[mpeg4 @ 03b00900] Invalid and inefficient vfw-avi packed B frames detected
Input #0, avi, from 'D:\Input.avi':
encoder : Nandub v1.0rc2
Duration: 00:41:58.92, start: 0.000000, bitrate: 1167 kb/s
Stream #0:0: Video: mpeg4 (Simple Profile) (XVID / 0x44495658), yuv420p, 640
x352 [SAR 1:1 DAR 20:11], 25 tbr, 25 tbn, 25 tbc
Stream #0:1: Audio: mp3 (U / 0x0055), 48000 Hz, stereo, s16, 112 kb
[srt @ 03b37620] Estimating duration from bitrate, this may be inaccurate
Input #1, srt, from 'Input.srt':
Duration: N/A, bitrate: N/A
Stream #1:0: Subtitle: subrip
Output #0, avi, to 'D:\Output.avi':
ISFT : Lavf54.37.100
Stream #0:0: Video: mpeg4 (XVID / 0x44495658), yuv420p, 640x352 [SAR 1:1 DAR
20:11], q=2-31, 25 tbn, 25 tbc
Stream #0:1: Audio: mp3 (U / 0x0055), 48000 Hz, stereo, 112 kb/s
Stream #0:2: Subtitle: xsub (DXSB / 0x42535844)
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Stream #1:0 -> #0:2 (subrip -> xsub)
Press [q] to stop, [?] for help
[xsub @ 03b3db20] No subtitle bitmap available.
Subtitle encoding failed
Have you downloaded ffmpeg ?
Added ability for automatic conversion of mp4/mkv files to their avi equivalent so users can incorporate XSUB subtitles. Please note that this conversion is accomplished through ffmpeg command line executable that has to be downloaded separately. For more information on how to enable this feature read "Converting mp4/mkv to avi for XSUB subtitle incorporation" in the manual.
IdxSub2Srt removed from zip as obsolete.