After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 625673 - If framerate cannot be ascertained them default to 25 fps...
If framerate cannot be ascertained them default to 25 fps...
Status: RESOLVED NOTABUG
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal major
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-07-30 18:55 UTC by Robert Krakora
Modified: 2011-05-26 12:28 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to default to 25 fps in element mpeg4videoparse if on framerate can be ascertained. (909 bytes, patch)
2010-07-30 18:55 UTC, Robert Krakora
rejected Details | Review

Description Robert Krakora 2010-07-30 18:55:14 UTC
Created attachment 166850 [details] [review]
Patch to default to 25 fps in element mpeg4videoparse if on framerate can be ascertained.

The Fluendo MPEG4 Codec does not parse well nor does it default to a sensible framerate if one cannot be ascertained.  Since it does not parse well it needs the mpeg4videoparse element anyway, so it is best to default to 25 fps here if the framerate cannot be ascertained.  Please see the attached patch.
Comment 1 Sebastian Dröge (slomo) 2010-08-01 08:57:51 UTC
Defaulting to 25fps is not a good idea, better don't have any framerate at all in those cases.
Comment 2 Robert Krakora 2010-08-01 13:58:31 UTC
...and why is it not a good idea as most content would be at either 25 fps or 30 fps...please explain.  With no framerate the video is essentially at 1 fps (extreme slow motion). Please elaborate as to why it is not a good idea.
Comment 3 Robert Krakora 2010-08-01 13:59:50 UTC
...also, the ffdec_mpeg4 plugin defaults to 25 fps if the framerate cannot be ascertained...is it then in error?
Comment 4 Sebastian Dröge (slomo) 2010-08-01 17:56:25 UTC
Yes, most content would be 25fps, 24fps, 30fps or 29.97fps. The problem is, that playback of all fps different than the one you've chosen will be still broken.

Does the MPEG4 spec say something about a default framerate if none is given? If not I'd say that we shouldn't assume a default because it will almost always be wrong.
Comment 5 Robert Krakora 2010-08-01 20:34:58 UTC
30 fps content plays back fine at 25 fps with mpeg4videoparse and the Fluendo MPEG4 Codec with the fix from a Linksys WVC200 PTZ Camera.  I will look at the MPEG4 specification.  However, why then does the ffdec_mpeg4 GStreamer element default to 25 fps?  Since most content is 25->30 fps then fallback to 25 fps and print an WARN indicating that no framerate can be ascertained and that a default of 25 fps is being assumed.  Better yet, maybe a parameter to allow one to force the framerate.  ;-)  Whatever the outcome, I thank you for your prompt response to my submission...
Comment 6 David Schleef 2010-08-01 20:48:51 UTC
It is possible to have MPEG-4 part 2 streams that have *no* timing information.

More likely, in this case, the decoder is ignoring the internal timestamping information in the stream.  Many low-end cameras do this instead of capturing at a constant frame rate.
Comment 7 Sebastian Dröge (slomo) 2010-08-02 08:00:05 UTC
David, so let's close this as NOTABUG? Or is there anything we can do better here?
Comment 8 Robert Krakora 2010-08-02 11:52:48 UTC
We use the Fluendo Codec Pack and GStreamer in our media ports.  I have filed a bug report with Fluendo.  However, it would be a nice enhancement to mpeg4videoparse for one to be able to specify frame rate via a parameter.  I believe mplayer and vlc have such a parameter.  When I opened this as a bug I should have opened it as an "enhancement" as it clearly is not a bug.  I am all for closing this, but please give the frame rate parameter some consideration.
Comment 9 Mark Nauwelaerts 2010-08-02 12:56:04 UTC
This is basically the same situation as in bug #587799, except that is MPEG4 here in stead of h264.  The 'remedy/trick' given there using existing components (capsfilter, stamp) works just as well here (and as such does not really need some custom framerate "parameter").
Comment 10 Robert Krakora 2010-08-02 13:48:19 UTC
Mark:

This works well, however, I use Totem for playback and I believe that it uses playbin or playbin2.  So, how would the "stamp" element come into play in this case?

Best Regards,

Rob Krakora
Comment 11 Robert Krakora 2010-08-02 13:50:03 UTC
Mark:

Also, how much more *overhead* does the "stamp" element add to the pipeline in regards to CPU usage?  ;-)

Best Regards,

Rob Krakora
Comment 12 Robert Krakora 2010-08-02 14:13:17 UTC
In gstffmpegdec.c the following code is present...

  if (!ffmpegdec->context->time_base.den || !ffmpegdec->context->time_base.num) {
    GST_DEBUG_OBJECT (ffmpegdec, "forcing 25/1 framerate");
    ffmpegdec->context->time_base.num = 1;
    ffmpegdec->context->time_base.den = 25;
  }

...should it not be removed?
Comment 13 Robert Krakora 2010-08-02 14:17:23 UTC
gstffmpegdec.c history...

https://bugzilla.gnome.org/show_bug.cgi?id=313970
Comment 14 Robert Krakora 2010-08-02 14:51:46 UTC
In mpeg4videodec.c in gst-ffmpeg-0.10.11 the following code is present:

    if (get_bits1(gb) != 0) {   /* fixed_vop_rate  */
        s->avctx->time_base.num = get_bits(gb, s->time_increment_bits);
    }else
        s->avctx->time_base.num = 1;

In mpeg4videoparse.c the following code is present:

  GET_BITS (&bs, 1, &bits);
  if (bits) {
    /* fixed time increment */
    int n;

    /* Length of the time increment is the minimal number of bits needed to
     * represent time_increment_resolution */
    for (n = 0; (time_increment_resolution >> n) != 0; n++);
    GET_BITS (&bs, n, &bits);

    fixed_time_increment = bits;
  } else {
    /* When fixed_vop_rate is not set we can't guess any framerate */
    fixed_time_increment = 0;
  }

If I change fixed_time_increment = 1 insteade of fixed_time_increment = 0 in the mpeg4videoparse.c code above with no other changes then the video stream with which I am having problems plays just fine with the Fluendo MPEG4 video codec.
Comment 15 Robert Krakora 2010-08-04 12:35:35 UTC
Any more comments/suggestions?
Comment 16 Sebastian Dröge (slomo) 2011-05-26 07:30:44 UTC
Not really, randomly choosing 25 fps is not going to improve the situation much, you could as well choose 23.4567 fps or any other random value.

To be able to play back mpeg4 streams without any timing information at all you have to place them in a container format that contains the timing information and mpeg4videoparse will passthrough this timing information.
Comment 17 Sebastian Dröge (slomo) 2011-05-26 07:33:20 UTC
So IMHO we should just close this bug and keep everything as is. mpeg4 video streams without any timing information anywhere are pretty useless and shouldn't be produced by anything.
Comment 18 Robert Krakora 2011-05-26 12:25:31 UTC
Hi Sebastian,

Fluendo has since added MPEG4 parsing to their MPEG4 Part 2 codec and this is no longer an issue for me.  I totally agree with your comments.  This bug report can be closed.

Best Regards,

Rob Krakora