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 536472 - mpeg2dec reports wrong video/audio length
mpeg2dec reports wrong video/audio length
Status: RESOLVED WONTFIX
Product: GStreamer
Classification: Platform
Component: gst-plugins-ugly
0.10.x
Other All
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2008-06-03 17:38 UTC by Bastian Winkler
Modified: 2011-05-19 07:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
a small stress test (1.10 KB, text/x-python)
2008-06-03 17:39 UTC, Bastian Winkler
Details

Description Bastian Winkler 2008-06-03 17:38:22 UTC
Please describe the problem:
for inspecting media files I use gst-python's gst.extend.discoverer, which works pretty well on most media files, but with mpeg1/2 files I get different durations nearly every time. The time diff affects video as well as audio length and the diff is up to 3s with a small 30s file.

happens on my current Debian/sid installation with
gstreamer-0.10.19
gst-plugins-ugly 0.10.8
gst-python 0.10.11
mpeg2dec 0.4.1
as well as some older installations I was able to test

Steps to reproduce:
# discoverer stress test

import sys
import gobject
gobject.threads_init()

import gst
from gst.extend.discoverer import Discoverer

i = 0
min_vlength = gobject.G_MAXLONG
min_alength = gobject.G_MAXLONG
max_vlength = 0L
max_alength = 0L

def finished(d, result):
    global i
    global min_vlength, max_vlength
    global min_alength, max_alength
    min_alength = min(min_alength, d.audiolength)
    max_alength = max(max_alength, d.audiolength)
    min_vlength = min(min_vlength, d.videolength)
    max_vlength = max(max_vlength, d.videolength)
    print 'A: %d V: %d' % (d.audiolength, d.videolength)
    i += 1
    if i >= 100:
        print 'MIN A: %s MIN V: %s' % (gst.TIME_ARGS(min_alength),
                gst.TIME_ARGS(min_vlength))
        print 'MAX A: %s MAX V: %s' % (gst.TIME_ARGS(max_alength),
                gst.TIME_ARGS(max_vlength))
        loop.quit()
    else:
        del d
        d = Discoverer(filename)
        d.connect('discovered', finished)
        d.discover()

filename = sys.argv[1]
d = Discoverer(filename)
d.connect('discovered', finished)
d.discover()
loop = gobject.MainLoop()
loop.run()


Actual results:


Expected results:


Does this happen every time?


Other information:
Comment 1 Bastian Winkler 2008-06-03 17:39:54 UTC
Created attachment 112070 [details]
a small stress test
Comment 2 Sebastian Dröge (slomo) 2008-06-04 06:05:36 UTC
This might be caused by the way the duration for mpeg1/2 videos is calculated. It's just an interpolation by the (to that time known) average bitrate and total file length.

So maybe the times when the discoverer finishes are slightly different and sometimes more buffers are processed already giving a more appropiate duration.

Not sure what can be done about this bug, you won't get exact durations in any case but maybe the discoverer could be improved a bit to give at least consistent results...
Comment 3 Reinout van Schouwen 2008-08-08 08:46:41 UTC
http://movies.archive.bibalex.org/3562.mpg
For this movie, Totem reports 12 minutes whereas the actual length is 43 minutes. I suppose that's related to this bug...?
Comment 4 Sebastian Dröge (slomo) 2011-05-19 07:42:12 UTC
I'll close this as WONTFIX now. Getting correct durations for MPEG1/2 videos is impossible unless you parse the complete file.