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 99589 - [PATCH] mpeg created with mplexhi -V exhibit choppy video
[PATCH] mpeg created with mplexhi -V exhibit choppy video
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-ugly
git master
Other other
: Normal normal
: NONE
Assigned To: Ronald Bultje
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2002-11-26 07:06 UTC by Joshua N Pritikin
Modified: 2006-03-10 16:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed fix for next_scr (1.42 KB, patch)
2003-01-10 12:31 UTC, Joshua N Pritikin
none Details | Review
fuzzy patch, not cleaned up, integrated exact seeking (12.42 KB, patch)
2004-01-13 22:24 UTC, Ronald Bultje
none Details | Review
Updated precise seeking patch, fully disable timestamp adjustments (19.72 KB, patch)
2004-04-10 23:26 UTC, Ronald Bultje
none Details | Review

Description Joshua N Pritikin 2002-11-26 07:06:31 UTC
To reproduce, render separate mpeg audio & video.  You can easily do this
with cinelerra.  Mux these streams with "mplexhi -V".  The -V switch is for
variable bit rate.  Try playing the mux'd mpeg with gstreamer.  The video
looks choppy -- pause a little too long then show frames a little too fast,
etc.  i can provide an example mpeg if needed.

Without the -V flag, i can't figure out how to create very small (less than
20M for 3 minutes) mpeg streams.
Comment 1 Thomas Vander Stichele 2002-12-07 18:35:48 UTC
you will at least have to provide a sample video, yes.
Have you tried with other players ?
Comment 2 Joshua N Pritikin 2002-12-08 05:02:03 UTC
An example stream is available at:

  ftp://ftp.berlios.de/pub/redael/nau-scene1.mpg

It plays perfectly with MPlayer.  i suspect gstreamer is getting
confused because of the VBR encoding.
Comment 3 Wim Taymans 2002-12-08 14:23:24 UTC
The problem appears to be bad discontinuity detection in mpegparse,
I'm looking into it.
Comment 4 Wim Taymans 2002-12-08 15:09:58 UTC
this mpeg has wrong SCR values that don't match the stated muxrate.
you can temporarily get correct playback by making the discontinuity
checking less strict by adding max_discont=200000 to mpegdemux. I
don't really know yet how to solve this properly..
Comment 5 Joshua N Pritikin 2003-01-07 17:25:49 UTC
This problem seems to slow down seeking quite a lot.  It is a real
problem.  Can you make an index for SCR to speed this up?
Comment 6 Joshua N Pritikin 2003-01-09 03:13:37 UTC
For my application, this is the highest priority bug due to gstreamer.
 i really need a good solution for this as soon as possible.
Comment 7 Joshua N Pritikin 2003-01-10 12:30:40 UTC
i decided to try fixing this myself.  My proposed patch uses the index
to determine the next_scr.  Only if the index is unavailable, it
resorts to the old guesswork.  This seems to fix the problem.  i run
my indexer with max_discont=1000000 and run my playback with
max_discont=10000 and it works.

i'm not sure if this is the _correct_ fix or if i am just curing the
symptom of some deeper problem.  Wim, please comment.
Comment 8 Joshua N Pritikin 2003-01-10 12:31:45 UTC
Created attachment 13468 [details] [review]
proposed fix for next_scr
Comment 9 Joshua N Pritikin 2003-01-10 13:07:50 UTC
This still isn't a complete fix.  Somehow seeks are not getting
exactly the correct byte-offset and mpeg2dec is blowing up downstream.

==21648== Thread 2:
==21648== Invalid read of size 1
==21648==    at 0x470A6918: mpeg2_idct_copy_c (idct.c:171)
==21648==    by 0x470A08E2: mpeg2_slice (slice.c:980)
==21648==    by 0x4709AD0D: mpeg2_parse (decode.c:189)
==21648==    by 0x47097124: gst_mpeg2dec_chain (gstmpeg2dec.c:467)
==21648==    by 0x40240B8B: gst_pad_push (in
/home/joshua/gst/gstreamer/gst/.libs/libgstreamer-0.5.so.2.0.0)
==21648==    by 0x46FF5539: gst_mpeg_demux_parse_packet
(gstmpegdemux.c:663)
==21648==    by 0x46FF2DFF: gst_mpeg_parse_loop (gstmpegparse.c:430)
==21648==    by 0x41FF7901: loop_group_schedule_function
(gstoptimalscheduler.c:759)
==21648==    Address 0x470AA068 is not stack'd, malloc'd or free'd
Comment 10 Joshua N Pritikin 2003-02-16 10:34:28 UTC
i would be equally happy if the ffmpeg plugin was enhanced to support
frame accurate seeking.  Then i would re-encode all my mpeg films into
MSMPEG4v3, which is one of the most compact formats too.
Comment 11 alexander.winston 2004-01-03 00:50:49 UTC
Adding the PATCH keyword and upgrading the priority level to High
because of the attached fix.
Comment 12 Ronald Bultje 2004-01-09 14:24:24 UTC
I'm fetching this one. Let's see, from the patch, I'm guessing that
the real problem is the fact that the seeking in mpegparse assumes CBR
(quite obviously, since it uses muxrate for this). I've got several
VBR movies here, and the SCR (stream) & PTS (packet/content) values
are identical, which means that they're correct (take that from me).
Also, if I loop-seek to assure that the *PTS* (rather than the
adjusted timestamp) is equal to the time that I need, I get the
correct output. I can actually seek accurate up to a second or closer
in highly-variable-bitrate videos of 24 hours.

The whole timestamp-adjust-stuff (mpegparse->adjust) is broken, since
it adapts the PTS to match the muxrate (and thereby moves timestamps
back to how they would be if the stream was read as CBR) while
actually, the PTS values (or SCR) should be used for timestamps
without being adapted (that is correct). Without the adjust
adaptations, it works fine. Then, however, seeking inside the
mpegstream elements needs to be adapted to use this, too, else
discontinuity events will be inprecise. I'm working on a full-blown patch.

Joshua (or Wim), can you confirm all this?
Comment 13 Ronald Bultje 2004-01-13 22:24:53 UTC
Created attachment 23328 [details] [review]
fuzzy patch, not cleaned up, integrated exact seeking
Comment 14 Ronald Bultje 2004-04-10 23:26:12 UTC
Created attachment 26547 [details] [review]
Updated precise seeking patch, fully disable timestamp adjustments

This is a new updated version after the dvd separation, and it fully rmeoves
timestamp adjustments.
Comment 15 Stephane Loeuillet 2004-12-19 00:51:09 UTC
so, was it applied ronald ?
Comment 16 Ronald Bultje 2004-12-19 01:38:27 UTC
No.

1) it doesn't apply cleanly, I suspect
2) discontinuities need to be thought out better than now.
Comment 17 Luis Villa 2005-02-02 13:33:38 UTC
Ronald, is this the same bug I'm seeing with choppy playback on:

http://mirrors.creativecommons.org/movingimages/Building_on_the_Past.mpg

or is that something different?

[In a nutshell, totem seems confused about the length of the mpg, never its
place in the mpg- one moment it reports the mpg is two minutes long, which is
correct, next moment that it is nine moments long, and moves the slider
appropriately.]

[I'd like to put that video on a liveCD to commemorate Totem getting into the
distro, but... that doesn't appear to be possible until this is fixed :/
Comment 18 Luca Ognibene 2005-06-25 11:32:20 UTC
The file posted by Luis seems to work fine with current cvs. I can't test the
first file because the url no longer works.
Comment 19 Luca Ognibene 2005-10-11 18:25:36 UTC
Ronald, do you know if this bug is still valid ?
Comment 20 Ronald Bultje 2005-10-11 21:30:05 UTC
My patch was never applied, so I guess so, yes.
Comment 21 Wim Taymans 2006-03-08 09:13:04 UTC
file seems to work fine with HEAD cvs. closing.