It's just complicated -- thanks to the wide variety of ways that
containers implement timestamps.
>
>> So much for theory. Here's what to do:
>>
>> 1) For decoding, in most cases you can ignore TimeBases as we'll
>> figure them out. In your case though since we have no headers, set
>> your IStreamCoder timebase to 1/10 to emulate the input frame rate.
>
> I don't set the input coder timebase at all, only its framerate (to
> 10/1)... but it still works anyway. Why's this?
I think it depends. In your case you don't always have the
meta-information about your stream, and so the IStreamCoder isn't able
to guess all items for input (for a on-disk MOV file for example, you
don't even need to set the Frame Rate when reading -- we'll guess it
from the MOOV atom).
> So I don't ever need to set the timebase for an IStream, right? It
> will be automatically set by Xuggler when I get it via
> IContainer#getStream?
Yes, if we know the ContainerFormat, then getStream(...) and
addNewStream(...) should set the right time base.
>
> And finally, an unrelated question I just thought of...
> Why does most of your example code do IStreamCoder#setGlobalQuality
> (0)? That's but one of the things you can set on an IStreamCoder,
> seems a bit random, and doesn't seem to make any difference if you
> remove it.
It's ignored by some codecs (e.g. h.264), but the mpeg4 video codec
pays attention to it. To see it in action, try converting a file to a
Quicktime MOV with mpeg4 video. With the setGlobalQuality() ffmpeg
chooses a lower quality and the video looks degrated.
- Art
It's ignored by some codecs (e.g. h.264), but the mpeg4 video codec
>
> And finally, an unrelated question I just thought of...
> Why does most of your example code do IStreamCoder#setGlobalQuality
> (0)? That's but one of the things you can set on an IStreamCoder,
> seems a bit random, and doesn't seem to make any difference if you
> remove it.
pays attention to it. To see it in action, try converting a file to a
Quicktime MOV with mpeg4 video. With the setGlobalQuality() ffmpeg
chooses a lower quality and the video looks degrated.
Assuming:
AVCodecContext *foo;
I set:
foo->global_quality
to what you set. Beyond that, take a look in ffmpeg/libavcodec and
see who uses 'global_quality'.
- Art
p.s. our code for setting this is in:
csrc/com/xuggle/xuggler/StreamCoder.cpp:500
to what you set. Beyond that, take a look in ffmpeg/libavcodec and
see who uses 'global_quality'.
Looks like not then. It was used back when we originally wrote the
code. We'll deprecate it.
- Art