[FFmpeg-devel] [PATCH] Bluray Subtitle Support, v7 (Updated patch to v12)

Reimar Döffinger Reimar.Doeffinger
Wed Aug 26 11:44:23 CEST 2009


On Wed, Aug 26, 2009 at 11:00:52AM +0200, Reimar D?ffinger wrote:
> When muxing into AVI for xsub I first get a crash, and after fixing that
> I get "scale/rate is 0/1 which is invalid. (This file has been generated by
> broken software.)" when trying to play the result.

Ok, I have a couple of issue with the AVI demuxer and other stuff.
The first one is that the time base of subtitle streams stays at
the default of 90 kHz, which is a bit questionable but probably
acceptable.
The second and bigger one is that the avi muxer uses the (completely
undocumented btw.) ff_parse_specific_params which seems to guess a time
base.
The issue with this is that for this it uses the codec values and only
those, which are never set for subtitles, overwriting the perfectly
good values from the stream time base. WTF?
Later this causes a crash due to a division by 0 when rescaling the
subtitle time base to the now broken stream time base.
This "fixes" it, but I have no idea if it makes anything actually work:

Index: avienc.c
===================================================================
--- avienc.c    (revision 19710)
+++ avienc.c    (working copy)
@@ -232,10 +232,11 @@
         put_le32(pb, 0); /* initial frame */
 
         ff_parse_specific_params(stream, &au_byterate, &au_ssize, &au_scale);
+        if (au_scale && au_byterate)
+            av_set_pts_info(s->streams[i], 64, au_scale, au_byterate);
 
-        put_le32(pb, au_scale); /* scale */
-        put_le32(pb, au_byterate); /* rate */
-        av_set_pts_info(s->streams[i], 64, au_scale, au_byterate);
+        put_le32(pb, s->streams[i]->time_base.num); /* scale */
+        put_le32(pb, s->streams[i]->time_base.den); /* rate */
 
         put_le32(pb, 0); /* start */
         avi->frames_hdr_strm[i] = url_ftell(pb); /* remember this offset to fill later */




More information about the ffmpeg-devel mailing list