[FFmpeg-devel] [PATCH] Support for Dirac in ogg

David Conrad lessen42
Fri Nov 7 10:04:49 CET 2008

On Nov 6, 2008, at 12:36 AM, Anuradha Suraparaju wrote:

> Hi,
> On Wed, 2008-11-05 at 22:27 -0500, David Conrad wrote:
>> On Nov 5, 2008, at 10:09 PM, Anuradha Suraparaju wrote:
>>> Hi,
>>> On Wed, 2008-11-05 at 03:32 -0500, David Conrad wrote:
>>>> Hi,
>>>> Attached adds demuxing support for dirac in ogg files. It uses a
>>>> couple functions for the soc dirac decoder to parse the header,
>>>> updated to the latest specification.
>>> In function dirac_header in oggparsedirac.c do you need to parse the
>>> sequence header? The decoder will do that anyway won't it? If the
>>> parsing of the sequence header is skipped, then oggparsedirac.c and
>>> oggdec.c can be merged into the svn trunk straightaway, pending
>>> approval
>>> from the maintainers of course.
>> The ogg demuxer needs to know the frame rate in order to calculate  
>> the
>> duration of the stream, which happens before the decoder or parser  
>> get
>> a chance to do anything.
> Is this for seeking?

And metadata; a video player can't tell you what % of the way through  
a file you are unless it knows when it ends.

>> At any rate I found some subtle issues with dirac's timestamps in ogg
>> that prevent going merging. I'll try your improved parser to see if  
>> it
>> helps. (there are two issues, one being that all ogg dirac sample
>> files assume granulepos is the time when the associated packet starts
>> rather than the time when it ends as according to the specs. It seems
>> the mapping spec also assumes this. The second is that the stored pts
>> seems to be plain wrong.)
> Try using ffmpeg2dirac to transcode files to Dirac wrapped in Ogg.  
> It is
> basically a clone of ffmpeg2theora that replaces Theora with Dirac.  
> The
> files created by it seem to play back okay with VLC (Schroedinge  
> support
> enabled) and my local FFmpeg tree which was patched to support Dirac  
> in
> Ogg. Seeking doesn't appear to be a problem either. The source can be
> found in the Git repository on diracvideo.org.
> git clone git://diracvideo.org/git/ffmpeg2dirac.git
> If you want a sample file generated by ffmpeg2dirac just let me know
> where to upload it to.

Playback works, the problem is that remuxing to another container  
requires accurate timestamps. I already tried ffmpeg2dirac but the  
timestamps it generates aren't correct. The most correct I've seen so  
far is http://diracvideo.org/download/test-streams/ogg/ 
sage-640x360.ogg but it seems to me that delay should be half of what  
it is in that file.

Another problem is that unlike all current codecs in ogg, the dts from  
granulepos for dirac is the start of the associated frame, not the  
end, and can be negative. And using only the (corrected) pts makes  
playback worse than only using wrong dts values...

More information about the ffmpeg-devel mailing list