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 782424 - Vorbisenc/oggmux set incorrect duration
Vorbisenc/oggmux set incorrect duration
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
1.4.5
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-05-10 08:24 UTC by Alex
Modified: 2018-11-03 11:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
source pcap dump + filtered pcap dump + ogg result (789.08 KB, application/zip)
2017-05-10 08:24 UTC, Alex
Details

Description Alex 2017-05-10 08:24:35 UTC
Created attachment 351516 [details]
source pcap dump + filtered pcap dump + ogg result

Hi, I using Centos 7 Linux machine with Gstreamer 1.4.5 for encoding ogg files from captured network traffic.
As input I have network dump in *pcap format with 3 rtp streams inside: 1 video stream (VP8) and 2 audio streams (G711).

With tshark tool (from Wireshark tool-packet) I filtered out only audio data also to *pcap file. And then use gstreamer to encode to stereo ogg format.

gst command:

gst-launch-1.0 interleave name=i filesrc location=/tmp/audio1.pcap ! pcapparse dst-ip=10.10.4.10 ! application\/x-rtp,payload=0,clock-rate=8000,encoding-name=PCMU ! rtppcmudepay ! mulawdec ! audioconvert ! audioresample ! audio\/x-raw,rate=8000,format=F32LE ! queue ! i.sink_0 filesrc location=/tmp/audio1.pcap ! pcapparse src-ip=10.10.4.10 ! application\/x-rtp,payload=0,clock-rate=8000,encoding-name=PCMU ! rtppcmudepay ! mulawdec ! audioconvert ! audioresample ! audio\/x-raw,channels=\(int\)1,rate=8000,format=F32LE ! queue ! i.sink_1 i.src ! capssetter caps=audio\/x-raw,channels=2,channel-mask=\(bitmask\)0x3 ! audioresample ! audioconvert ! vorbisenc quality=0.5 ! mux. oggmux name=mux ! filesink location=/tmp/out.ogg

As resualt I have ogg file with incorrect duration:

oggz-info /tmp/out.ogg
Content-Duration: 5124095:34:33.629         <---- ????

Vorbis: serialno 1067813195
        414 packets in 232 pages, 1.8 packets/page, 9.188% Ogg overhead
        Audio-Samplerate: 8000 Hz
        Audio-Channels: 2

or

ogginfo /tmp/out.ogg
Processing file "/tmp/out.ogg"...

New logical stream (#1, serial: 3fa5894b): type vorbis
Vorbis headers parsed for stream 1, information follows...
Version: 0
Vendor: Xiph.Org libVorbis I 20120203 (Omnipresent)
Channels: 2
Rate: 8000

Nominal bitrate: 41.000000 kb/s
Upper bitrate not set
Lower bitrate not set
WARNING: EOS not set on stream 1
Vorbis stream 1:
        Total data length: 69994 bytes
        Playback length: 307445734m:33.629s             <---- ???
        Average bitrate: 0.000000 kb/s

In attachment added source pcap dump , filtered pcap dump with only audio inside and resulting ogg file.
Comment 1 Vincent Penquerc'h 2017-05-11 08:47:35 UTC
The root is in audioencoder, and is fixed by the following hack. However, I don't think it's right since it'll cause "wrong" timestamps when it triggers. A possible way out might be to always have an extra "safety margin" in base_ts, but that's iffy as well.
In any case, that hack yields a 13.32 second output (was that the expected duration ?).


diff --git a/gst-libs/gst/audio/gstaudioencoder.c b/gst-libs/gst/audio/gstaudioencoder.c
index 5c3b97b..6a4f7e0 100644
--- a/gst-libs/gst/audio/gstaudioencoder.c
+++ b/gst-libs/gst/audio/gstaudioencoder.c
@@ -1325,7 +1325,12 @@ gst_audio_encoder_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
     }
     if (discont) {
       /* now re-sync ts */
-      priv->base_ts += diff;
+      if (diff < 0 && -diff > priv->base_ts) {
+        GST_WARNING_OBJECT (enc, "Unable to offset base_ts past 0, clipping to 0");
+        priv->base_ts = 0;
+      } else {
+        priv->base_ts += diff;
+      }
       gst_audio_encoder_set_base_gp (enc);
       priv->discont |= discont;
     }
Comment 2 Alex 2017-05-12 07:59:53 UTC
The output duration is correct - it should be something around 13 sec.

How to implement or fix already installed gstreamer package ? Will it be included in next version ?
Comment 3 Vincent Penquerc'h 2017-05-12 08:42:18 UTC
It's more of a bodge than a fix I think. I'm just not sure how to fix it better.
Otherwise, you apply the patch to the version you're running, rebuild, reinstall. If you're building distro binaries, install with a $HOME prefix and add the lib dir with the new gst libs to LD_LIBRARY_PATH.
Comment 4 GStreamer system administrator 2018-11-03 11:56:54 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/355.