[FFmpeg-devel] [PATCH] asf-format doesn't work as stream for XBox360

Patric Stout patric
Mon Oct 15 11:46:03 CEST 2007


Baptiste Coudurier schreef:
> Hi
>
> Patric Stout wrote:
>   
>> Vladimir Pantelic schreef:
>>     
>>> Patric Stout wrote:
>>>
>>>   
>>>       
>>>> I tried to change all the other fields that showed up on the diff 
>>>> between a streamed wmv and a stored wmv, no other field did anything
>>>> for the good. This is the only field that makes it to work, or breaks
>>>> it. So I am pretty sure this is what the Xbox expects.
>>>>     
>>>>         
>>> IIRC asf "live" streams have the broadcast flag = 1, seekable = 0 and
>>> the *size* is not 0 but the size of the ASF header plus the data header,
>>> so everything up to the first packet.
>>>
>>>   
>>>       
>> You are almost correct ;) The only other allowed number which my XBox
>> accepted, besides the very big value, is 50, which is exactly the
>> current size after writing the header - asf->data_offset. Basicly, all
>> bytes written after the data_offset at that time (so not including the
>> ASF header). This is identical with the way the data-chunk-size is later
>> on in the code patched up for stored asfs.
>>
>> Also, because the url is streamed, the broadcast flag already was set to
>> 1 correctly.
>>
>>
>> So, in a third attempt, here is the patch setting the data-chunk-size to
>> 50 by default. I had a bit of trouble getting a good comment line, feel
>> free to edit it to something better ;)
>> It has to be noted that this can't really damage anything, as for
>> example mplayer ignores this value when reading a stream, and both
>> Windows Media Player as XBox360 play this perfectly. And all stored asfs
>> get this value overridden anyway.
>>
>>     
>
> Did you try not setting seekable flag ?
>
> Specs clearly says:
> "Object Size
>
> Specifies the size of the Data Object. Valid values are at least 50
> bytes. Note that if the Broadcast Flag bit of the Flags field is set on
> the File Properties Object, then the Object Size field may be 0. This is
> a special case that indicates the size of the Data Object is unknown. It
> is not valid to have a value of 0 for the Object Size field if the
> Broadcast Flag is not set.
For the XBox the seekable flag doesn't matter: the streams are never
seekable.

And sorry to say, but the specs and the Xbox360 do not agree. So either
the specs are wrong, or Microsoft did a poor job implementing their own
format on the Xbox360. The latter I truly doubt, as it works perfectly
if you use a Windows machine to stream the files (via transcoding).

What I did, was making sure the broadcast flag was active, and the
seekable flag wasn't, and with a datasize of 0, this result in an
error-code. The only values that are accepted are either 50, or any
value larger. If, for example, you use the value 50000, it shows the
movie only for a short time (which makes sense). With the value of 50 it
continues till the end of the stream, and exists cleanly. So seemly, by
trail-and-error, 50 seems to be the correct value (anyway, for the
Xbox), in case the size is not known yet.

Anyway, I will try to find a tool that can capture upnp streams on
Linux, so I can check what Windows sends as header values and compare it
to the result of ffmpeg.


With kind regards,

Patric Stout






More information about the ffmpeg-devel mailing list