Jump to content


Photo

GStreamer 1.0

gstreamer 1.0 openpli

  • Please log in to reply
2520 replies to this topic

Re: GStreamer 1.0 #261 betacentauri

  • PLi® Core member
  • 7,185 posts

+323
Excellent

Posted 10 November 2014 - 20:38

@Athoik: With the modified caps (profile = (string) { simple, advanced-simple }) codec_data is available in the gst_dvbvideosink_set_caps procedure. But the data doesn't include the needed informations. Look here. I hexdumped the codec_data. There is no XviD included.

download failed, no cuesheet interface                                                                                                                                                                                      
RemovePopup, id = ZapError                                                                                                                                                                                                  
0:00:57.323530485 ^[[332m 1705^[[00m 0x7417b090 ^[[36mINFO   ^[[00m ^[[00m        dvbvideosink gstdvbvideosink.c:1381:gst_dvbvideosink_set_caps:<dvbvideosink1>^[[00m MPEG4 have codec data                                 
0x000000: 00 00 01 b0 f5 00 00 01 ........                                                                                                                                                                                  
0x000008: b5 09 00 00 01 00 00 00 ........                                                                                                                                                                                  
0x000010: 01 20 08 86 87 ff ff 0a . ......                                                                                                                                                                                  
0x000018: ad 88 82 19 0a 31       .....1                                                                                                                                                                                    
0:00:57.323760633 ^[[332m 1705^[[00m 0x7417b090 ^[[36mINFO   ^[[00m ^[[00m        dvbvideosink gstdvbvideosink.c:1398:gst_dvbvideosink_set_caps:<dvbvideosink1>^[[00m MIMETYPE video/mpeg4 -> VIDEO_SET_STREAMTYPE, 4       
eServiceMP3::getSubtitleList finished                                                                                                                                                                                       
[AutoRes] service changed                

Xtrend ET-9200, ET-8000, ET-10000, OpenPliPC on Ubuntu 12.04

Re: GStreamer 1.0 #262 athoik

  • PLi® Core member
  • 8,458 posts

+327
Excellent

Posted 10 November 2014 - 20:40

@betacentauri,
try with the latest patch from #260
Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: GStreamer 1.0 #263 betacentauri

  • PLi® Core member
  • 7,185 posts

+323
Excellent

Posted 10 November 2014 - 20:50

Hi Athoik,

 

that looks really good. Both XviD testfiles (one packed and one not) work properly.

But can you explain why it works? Do you really remove B frames? Shouldn't we get problems when frames are missing??


Xtrend ET-9200, ET-8000, ET-10000, OpenPliPC on Ubuntu 12.04

Re: GStreamer 1.0 #264 athoik

  • PLi® Core member
  • 8,458 posts

+327
Excellent

Posted 10 November 2014 - 21:51

First the mpeg4videoparser came into play.

Then during the tests I realized that unpacked videos work just fine with streamtype = 4 (like a normal mpeg4!).

Afterwards I compared two exactly same videos (the one packed and the other unpacked with the tool unpackmp4 from #254), what is written in render.

Comparing the two logs a pattern was there, the packed xvid was almost the same, the difference was the DivX503b1393p (packed bitstream) and dummy B-Frames with length 7.

First I tried to remove the packed bitstream from userdata (nothing was changed) then I dropped the dummy B-Frames (in the same way as Raspberry Pi see #230) and things started to getting better.

I think the frames we are dropping are N-VOP that mpeg4videoparser forgot? to remove after unpacking?

See for more details here: https://bugzilla.gno...g.cgi?id=739196

If everything runs smoothly like this, probably mpeg4videoparser must drop those packages and remove DivX503b1393p (packed bitstream) from userdata.
Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: GStreamer 1.0 #265 mx3L

  • Senior Member
  • 616 posts

+79
Good

Posted 10 November 2014 - 22:11

@athoik

excellent work!

 

with latest patch every xvid video works after slight adjustment in caps:

diff --git a/gstdvbvideosink.c b/gstdvbvideosink.c
index d8d5635..d65befa 100755
--- a/gstdvbvideosink.c
+++ b/gstdvbvideosink.c
@@ -176,12 +176,14 @@ GST_STATIC_PAD_TEMPLATE (
        GST_PAD_SINK,
        GST_PAD_ALWAYS,
        GST_STATIC_CAPS (
-       "video/mpeg, "
 #ifdef HAVE_MPEG4
-               "mpegversion = (int) { 1, 2, 4 }, "
-#else
-               "mpegversion = (int) { 1, 2 }, "
+       "video/mpeg, "
+               "mpegversion = (int) 4, "
+               "parsed = (boolean)true, "
+               VIDEO_CAPS "; "
 #endif
+       "video/mpeg, "
+               "mpegversion = (int) { 1, 2 }, "
                VIDEO_CAPS "; "
 #ifdef HAVE_H264
        "video/x-h264, "
@@ -815,6 +817,9 @@ static GstFlowReturn gst_dvbvideosink_render(GstBaseSink *sink, GstBuffer *buffe
                }
        }
 #endif
+       /* remove dummy packed B-Frame */
+       if (self->codec_type == CT_MPEG4_PART2 && data_len <= 7)
+               goto ok;
 
        pes_header[0] = 0;
        pes_header[1] = 0;

Some xvid AVI's don't have profile set, after removing profile from caps and require parsed field to be true, there are no issues anymore.

 

There is problem with divx3 videos now, without PTS/DTS patch they don't work at all.



Re: GStreamer 1.0 #266 athoik

  • PLi® Core member
  • 8,458 posts

+327
Excellent

Posted 10 November 2014 - 22:26

Can you print DTS & PTS and see if they differ? If they are the same we should not write them both to PES.

Also if you have a sample without profile might be interesting for GStreamer devs. Mediainfo shows profile right?

Edited by athoik, 10 November 2014 - 22:26.

Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: GStreamer 1.0 #267 mx3L

  • Senior Member
  • 616 posts

+79
Good

Posted 10 November 2014 - 23:48

No it doesn't

marko@marko-Vostro-1500:/media/NAS_MEDIA/Serialy/Frasier [EN]/Season 1$ mediainfo S01E02\ -\ Space\ Quest.avi
General
Complete name                            : S01E02 - Space Quest.avi
Format                                   : AVI
Format/Info                              : Audio Video Interleave
File size                                : 175 MiB
Duration                                 : 22mn 35s
Overall bit rate mode                    : Variable
Overall bit rate                         : 1 085 Kbps
Writing application                      : Nandub v1.0rc2
Writing library                          : Nandub build 1852/release

Video
ID                                       : 0
Format                                   : MPEG-4 Visual
Format settings, BVOP                    : No
Format settings, QPel                    : No
Format settings, GMC                     : No warppoints
Format settings, Matrix                  : Default (MPEG)
Codec ID                                 : XVID
Codec ID/Hint                            : XviD
Duration                                 : 22mn 35s
Bit rate                                 : 957 Kbps
Width                                    : 512 pixels
Height                                   : 384 pixels
Display aspect ratio                     : 4:3
Frame rate                               : 23.976 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.203
Stream size                              : 155 MiB (88%)

Audio
ID                                       : 1
Format                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 3
Mode                                     : Joint stereo
Mode extension                           : MS Stereo
Codec ID                                 : 55
Codec ID/Hint                            : MP3
Duration                                 : 22mn 35s
Bit rate mode                            : Variable
Bit rate                                 : 115 Kbps
Nominal bit rate                         : 128 Kbps
Channel(s)                               : 2 channels
Sampling rate                            : 48.0 KHz
Compression mode                         : Lossy
Stream size                              : 18.6 MiB (11%)
Alignment                                : Aligned on interleaves
Interleave, duration                     : 24 ms (0.58 video frame)
Interleave, preload duration             : 276 ms
Writing library                          : LAME3.92
Encoding settings                        : -m j -V 0 -q 2 -lowpass 15.3 --abr 128

Looks like that DTS is on every frame. When PTS is available PTS==DTS for divx3.

So we need to set only DTS to pes for divx3 codec.

0:00:06.566783366   980 0x76092e60 INFO            dvbvideosink /home/marko/git/openpli-oe-core/build/tmp/work/et4x00-oe-linux/gstreamer1.0-plugin-dvbmediasink/1.0+gitAUTOINC+27b18f56cf-r101/git/gstdvbvideosink.c:848:gst_dvbvideosink_render:<dvbvideosink0> PTS and DTS available, PTS == DTS ( 0 == 0 )
0:00:06.573160551   980 0x76092e60 INFO            dvbvideosink /home/marko/git/openpli-oe-core/build/tmp/work/et4x00-oe-linux/gstreamer1.0-plugin-dvbmediasink/1.0+gitAUTOINC+27b18f56cf-r101/git/gstdvbvideosink.c:853:gst_dvbvideosink_render:<dvbvideosink0> only DTS available: 440000000
0:00:06.600829773   980 0x76092e60 INFO            dvbvideosink /home/marko/git/openpli-oe-core/build/tmp/work/et4x00-oe-linux/gstreamer1.0-plugin-dvbmediasink/1.0+gitAUTOINC+27b18f56cf-r101/git/gstdvbvideosink.c:853:gst_dvbvideosink_render:<dvbvideosink0> only DTS available: 480000000
0:00:06.610706736   980 0x76092e60 INFO            dvbvideosink /home/marko/git/openpli-oe-core/build/tmp/work/et4x00-oe-linux/gstreamer1.0-plugin-dvbmediasink/1.0+gitAUTOINC+27b18f56cf-r101/git/gstdvbvideosink.c:853:gst_dvbvideosink_render:<dvbvideosink0> only DTS available: 520000000
0:00:06.622989773   980 0x76092e60 INFO            dvbvideosink /home/marko/git/openpli-oe-core/build/tmp/work/et4x00-oe-linux/gstreamer1.0-plugin-dvbmediasink/1.0+gitAUTOINC+27b18f56cf-r101/git/gstdvbvideosink.c:853:gst_dvbvideosink_render:<dvbvideosink0> only DTS available: 560000000
0:00:06.636787292   980 0x76092e60 INFO            dvbvideosink /home/marko/git/openpli-oe-core/build/tmp/work/et4x00-oe-linux/gstreamer1.0-plugin-dvbmediasink/1.0+gitAUTOINC+27b18f56cf-r101/git/gstdvbvideosink.c:853:gst_dvbvideosink_render:<dvbvideosink0> only DTS available: 600000000
0:00:06.649784218   980 0x76092e60 INFO            dvbvideosink /home/marko/git/openpli-oe-core/build/tmp/work/et4x00-oe-linux/gstreamer1.0-plugin-dvbmediasink/1.0+gitAUTOINC+27b18f56cf-r101/git/gstdvbvideosink.c:853:gst_dvbvideosink_render:<dvbvideosink0> only DTS available: 640000000
0:00:06.660911847   980 0x76092e60 INFO            dvbvideosink /home/marko/git/openpli-oe-core/build/tmp/work/et4x00-oe-linux/gstreamer1.0-plugin-dvbmediasink/1.0+gitAUTOINC+27b18f56cf-r101/git/gstdvbvideosink.c:853:gst_dvbvideosink_render:<dvbvideosink0> only DTS available: 680000000
0:00:06.669818292   980 0x76092e60 INFO            dvbvideosink /home/marko/git/openpli-oe-core/build/tmp/work/et4x00-oe-linux/gstreamer1.0-plugin-dvbmediasink/1.0+gitAUTOINC+27b18f56cf-r101/git/gstdvbvideosink.c:853:gst_dvbvideosink_render:<dvbvideosink0> only DTS available: 720000000
New clock: GstSystemClock
0:00:06.685104107   980 0x76092e60 INFO            dvbvideosink /home/marko/git/openpli-oe-core/build/tmp/work/et4x00-oe-linux/gstreamer1.0-plugin-dvbmediasink/1.0+gitAUTOINC+27b18f56cf-r101/git/gstdvbvideosink.c:853:gst_dvbvideosink_render:<dvbvideosink0> only DTS available: 760000000
0:00:06.697750181   980 0x76092e60 INFO            dvbvideosink /home/marko/git/openpli-oe-core/build/tmp/work/et4x00-oe-linux/gstreamer1.0-plugin-dvbmediasink/1.0+gitAUTOINC+27b18f56cf-r101/git/gstdvbvideosink.c:853:gst_dvbvideosink_render:<dvbvideosink0> only DTS available: 800000000
0:00:06.702028033   980 0x76092e60 INFO            dvbvideosink /home/marko/git/openpli-oe-core/build/tmp/work/et4x00-oe-linux/gstreamer1.0-plugin-dvbmediasink/1.0+gitAUTOINC+27b18f56cf-r101/git/gstdvbvideosink.c:596:video_write:<dvbvideosink0> VIDEO_EVENT 2
0:00:06.713152292   980 0x76092e60 INFO            dvbvideosink /home/marko/git/openpli-oe-core/build/tmp/work/et4x00-oe-linux/gstreamer1.0-plugin-dvbmediasink/1.0+gitAUTOINC+27b18f56cf-r101/git/gstdvbvideosink.c:596:video_write:<dvbvideosink0> VIDEO_EVENT 1
0:00:06.723724773   980 0x76092e60 INFO            dvbvideosink /home/marko/git/openpli-oe-core/build/tmp/work/et4x00-oe-linux/gstreamer1.0-plugin-dvbmediasink/1.0+gitAUTOINC+27b18f56cf-r101/git/gstdvbvideosink.c:853:gst_dvbvideosink_render:<dvbvideosink0> only DTS available: 840000000
0:00:06.729921440   980 0x76092e60 INFO            dvbvideosink /home/marko/git/openpli-oe-core/build/tmp/work/et4x00-oe-linux/gstreamer1.0-plugin-dvbmediasink/1.0+gitAUTOINC+27b18f56cf-r101/git/gstdvbvideosink.c:596:video_write:<dvbvideosink0> VIDEO_EVENT 16
0:00:06.741507440   980 0x76092e60 INFO            dvbvideosink /home/marko/git/openpli-oe-core/build/tmp/work/et4x00-oe-linux/gstreamer1.0-plugin-dvbmediasink/1.0+gitAUTOINC+27b18f56cf-r101/git/gstdvbvideosink.c:853:gst_dvbvideosink_render:<dvbvideosink0> only DTS available: 880000000
...............
0:00:08.753422846   980 0x76092e60 INFO            dvbvideosink /home/marko/git/openpli-oe-core/build/tmp/work/et4x00-oe-linux/gstreamer1.0-plugin-dvbmediasink/1.0+gitAUTOINC+27b18f56cf-r101/git/gstdvbvideosink.c:853:gst_dvbvideosink_render:<dvbvideosink0> only DTS available: 8200000000
0:00:08.765598587   980 0x76092e60 INFO            dvbvideosink /home/marko/git/openpli-oe-core/build/tmp/work/et4x00-oe-linux/gstreamer1.0-plugin-dvbmediasink/1.0+gitAUTOINC+27b18f56cf-r101/git/gstdvbvideosink.c:848:gst_dvbvideosink_render:<dvbvideosink0> PTS and DTS available, PTS == DTS ( 8240000000 == 8240000000 )
0:00:08.779958624   980 0x76092e60 INFO            dvbvideosink /home/marko/git/openpli-oe-core/build/tmp/work/et4x00-oe-linux/gstreamer1.0-plugin-dvbmediasink/1.0+gitAUTOINC+27b18f56cf-r101/git/gstdvbvideosink.c:853:gst_dvbvideosink_render:<dvbvideosink0> only DTS available: 8280000000
0:00:08.790607698   980 0x76092e60 INFO            dvbvideosink /home/marko/git/openpli-oe-core/build/tmp/work/et4x00-oe-linux/gstreamer1.0-plugin-dvbmediasink/1.0+gitAUTOINC+27b18f56cf-r101/git/gstdvbvideosink.c:853:gst_dvbvideosink_render:<dvbvideosink0> only DTS available: 8320000000

for now only

diff --git a/gstdvbvideosink.c b/gstdvbvideosink.c
index d8d5635..c1112d5 100755
--- a/gstdvbvideosink.c
+++ b/gstdvbvideosink.c
@@ -176,12 +176,14 @@ GST_STATIC_PAD_TEMPLATE (
        GST_PAD_SINK,
        GST_PAD_ALWAYS,
        GST_STATIC_CAPS (
-       "video/mpeg, "
 #ifdef HAVE_MPEG4
-               "mpegversion = (int) { 1, 2, 4 }, "
-#else
-               "mpegversion = (int) { 1, 2 }, "
+       "video/mpeg, "
+               "mpegversion = (int) 4, "
+               "parsed = (boolean)true, "
+               VIDEO_CAPS "; "
 #endif
+       "video/mpeg, "
+               "mpegversion = (int) { 1, 2 }, "
                VIDEO_CAPS "; "
 #ifdef HAVE_H264
        "video/x-h264, "
@@ -815,6 +817,9 @@ static GstFlowReturn gst_dvbvideosink_render(GstBaseSink *sink, GstBuffer *buffe
                }
        }
 #endif
+       /* remove dummy packed B-Frame */
+       if (self->codec_type == CT_MPEG4_PART2 && data_len <= 7)
+               goto ok;
 
        pes_header[0] = 0;
        pes_header[1] = 0;
@@ -837,6 +842,19 @@ static GstFlowReturn gst_dvbvideosink_render(GstBaseSink *sink, GstBuffer *buffe
 #if GST_VERSION_MAJOR < 1
        if (GST_BUFFER_TIMESTAMP(buffer) != GST_CLOCK_TIME_NONE)
 #else
+       if (GST_BUFFER_DTS(buffer) != GST_CLOCK_TIME_NONE && GST_BUFFER_PTS(buffer) != GST_CLOCK_TIME_NONE)
+       {
+                       if (GST_BUFFER_DTS(buffer) == GST_BUFFER_PTS(buffer))
+                               GST_INFO_OBJECT (self, "PTS and DTS available, PTS == DTS ( %lld == %lld )", GST_BUFFER_PTS(buffer), GST_BUFFER_DTS(buffer));
+                       else
+                               GST_INFO_OBJECT(self, "PTS and DTS available, PTS != DTS ( %lld != %lld )", GST_BUFFER_PTS(buffer), GST_BUFFER_DTS(buffer));
+       }
+       else if (GST_BUFFER_DTS(buffer) != GST_CLOCK_TIME_NONE)
+               GST_INFO_OBJECT (self, "only DTS available: %lld", GST_BUFFER_DTS(buffer));
+       else if (GST_BUFFER_PTS(buffer) != GST_CLOCK_TIME_NONE)
+               GST_INFO_OBJECT (self, "only PTS available: %lld", GST_BUFFER_PTS(buffer));
+       else
+               GST_INFO_OBJECT(self, "no PTS/DTS available");
        if (GST_BUFFER_PTS(buffer) != GST_CLOCK_TIME_NONE)
 #endif
        {



Re: GStreamer 1.0 #268 athoik

  • PLi® Core member
  • 8,458 posts

+327
Excellent

Posted 11 November 2014 - 06:55

Maybe we can failback to DTS when PTS is not available (without writing PTS and DTS to PES).
 
diff --git a/gstdvbvideosink.c b/gstdvbvideosink.c
index d8d5635..68b405f 100755
--- a/gstdvbvideosink.c
+++ b/gstdvbvideosink.c
@@ -176,12 +176,14 @@ GST_STATIC_PAD_TEMPLATE (
        GST_PAD_SINK,
        GST_PAD_ALWAYS,
        GST_STATIC_CAPS (
-       "video/mpeg, "
 #ifdef HAVE_MPEG4
-               "mpegversion = (int) { 1, 2, 4 }, "
-#else
-               "mpegversion = (int) { 1, 2 }, "
+       "video/mpeg, "
+               "mpegversion = (int) 4, "
+               "parsed = (boolean) true, "
+               VIDEO_CAPS "; "
 #endif
+       "video/mpeg, "
+               "mpegversion = (int) { 1, 2 }, "
                VIDEO_CAPS "; "
 #ifdef HAVE_H264
        "video/x-h264, "
@@ -815,6 +817,9 @@ static GstFlowReturn gst_dvbvideosink_render(GstBaseSink *sink, GstBuffer *buffe
                }
        }
 #endif
+       /* remove dummy packed B-Frame */
+       if (self->codec_type == CT_MPEG4_PART2 && data_len <= 7)
+               goto ok;

        pes_header[0] = 0;
        pes_header[1] = 0;
@@ -837,7 +842,7 @@ static GstFlowReturn gst_dvbvideosink_render(GstBaseSink *sink, GstBuffer *buffe
 #if GST_VERSION_MAJOR < 1
        if (GST_BUFFER_TIMESTAMP(buffer) != GST_CLOCK_TIME_NONE)
 #else
-       if (GST_BUFFER_PTS(buffer) != GST_CLOCK_TIME_NONE)
+       if (GST_BUFFER_PTS_IS_VALID(buffer) || GST_BUFFER_DTS_IS_VALID(buffer))
 #endif
        {
                pes_header[7] = 0x80; /* pts */
@@ -846,7 +851,7 @@ static GstFlowReturn gst_dvbvideosink_render(GstBaseSink *sink, GstBuffer *buffe
 #if GST_VERSION_MAJOR < 1
                pes_set_pts(GST_BUFFER_TIMESTAMP(buffer), pes_header);
 #else
-               pes_set_pts(GST_BUFFER_PTS(buffer), pes_header);
+               pes_set_pts(GST_BUFFER_PTS_IS_VALID(buffer) ? GST_BUFFER_PTS(buffer) : GST_BUFFER_DTS(buffer), pes_header);
 #endif

                if (self->codec_data)
@@ -1220,7 +1225,7 @@ static GstFlowReturn gst_dvbvideosink_render(GstBaseSink *sink, GstBuffer *buffe
 #if GST_VERSION_MAJOR < 1
        if (GST_BUFFER_TIMESTAMP(buffer) != GST_CLOCK_TIME_NONE)
 #else
-       if (GST_BUFFER_PTS(buffer) != GST_CLOCK_TIME_NONE)
+       if (GST_BUFFER_PTS_IS_VALID(buffer) || GST_BUFFER_DTS_IS_VALID(buffer))
 #endif
        {
                self->pts_written = TRUE;

Attached Files


Edited by athoik, 11 November 2014 - 06:55.

Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: GStreamer 1.0 #269 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 11 November 2014 - 09:10

Maybe we can failback to DTS when PTS is not available (without writing PTS and DTS to PES).


No, I'd not do that. DTS might differ from PTS.
Note that the hardware does not require pts in every pes packet, it can pretty well keep time in between.
As long as it has some reference points to sync audio/video.

Re: GStreamer 1.0 #270 athoik

  • PLi® Core member
  • 8,458 posts

+327
Excellent

Posted 11 November 2014 - 09:25

 

Maybe we can failback to DTS when PTS is not available (without writing PTS and DTS to PES).


No, I'd not do that. DTS might differ from PTS.
Note that the hardware does not require pts in every pes packet, it can pretty well keep time in between.
As long as it has some reference points to sync audio/video.

 

 

Yes, it seems that writing DTS when PTS is not available in PES makes at least the videos with XviD playing not so smooth (also with the DTS and PTS patch).

 

What might be the case with divx3 videos that mx3L is mentioning?


Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: GStreamer 1.0 #271 athoik

  • PLi® Core member
  • 8,458 posts

+327
Excellent

Posted 11 November 2014 - 19:11

@mx3L, can you upload the divx3 sample to have a look?
Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: GStreamer 1.0 #272 betacentauri

  • PLi® Core member
  • 7,185 posts

+323
Excellent

Posted 11 November 2014 - 19:15

I looked into mx3L patch which writes both PTS and DTS timestamps to pes header. That's not a good idea. I guess the hardware looks at specific offset for the timestamp. It cannot use second timestamp. Or does the PES header support that?

 

I have here a divx3 file. Audio is almost good, but I only see some still pictures (I frames?).

 

I guess we should summarize the differences between gstreamer 0.10 and 1.x in this case. I can see that gstreamer 1.x uses streamtype 13. So that looks good. So does gstreamer use other components now?

 

Edit: @Athoik: Regarding file see pm


Edited by betacentauri, 11 November 2014 - 19:18.

Xtrend ET-9200, ET-8000, ET-10000, OpenPliPC on Ubuntu 12.04

Re: GStreamer 1.0 #273 mx3L

  • Senior Member
  • 616 posts

+79
Good

Posted 11 November 2014 - 19:16

@athoik

with dvbvideosink.patch xvid is not smooth anymore.

 

According to http://www.bretl.com/mpeghtml/DTS.HTM,

 

The Decode Time Stamp (DTS) indicates the time at which an access unit should be instantaneously removed from the receiver buffer and decoded.  It differs from the Presentation Time Stamp (PTS) only when picture reordering is used for B pictures.  If DTS is used, PTS must also be provided in the bit stream.

I did mistake when writing both DTS and PTS to PES:

if (pts && dts)
+       {
+               pes_header[9] =  0x61 | ((pts >> 29) & 0xE);

should be:

if (pts && dts)
+       {
+               pes_header[9] =  0x31 | ((pts >> 29) & 0xE);

I did test this(DTS written only when PTS is available) and still no sound/picture on divx3.

 

 

When DTS is written to PES header instead of PTS only then divx3 works.

 

So I'm suggesting following workaround:

diff --git a/gstdvbvideosink.c b/gstdvbvideosink.c
index d8d5635..52647ea 100755
--- a/gstdvbvideosink.c
+++ b/gstdvbvideosink.c
@@ -176,12 +176,14 @@ GST_STATIC_PAD_TEMPLATE (
        GST_PAD_SINK,
        GST_PAD_ALWAYS,
        GST_STATIC_CAPS (
-       "video/mpeg, "
 #ifdef HAVE_MPEG4
-               "mpegversion = (int) { 1, 2, 4 }, "
-#else
-               "mpegversion = (int) { 1, 2 }, "
+       "video/mpeg, "
+               "mpegversion = (int) 4, "
+               "parsed = (boolean)true, "
+               VIDEO_CAPS "; "
 #endif
+       "video/mpeg, "
+               "mpegversion = (int) { 1, 2 }, "
                VIDEO_CAPS "; "
 #ifdef HAVE_H264
        "video/x-h264, "
@@ -323,6 +325,9 @@ static void gst_dvbvideosink_init(GstDVBVideoSink *self)
        self->pesheader_buffer = NULL;
        self->codec_data = NULL;
        self->codec_type = CT_H264;
+#if GST_VERSION_MAJOR >= 1
+       self->use_dts = FALSE;
+#endif
 #ifdef PACK_UNPACKED_XVID_DIVX5_BITSTREAM
        self->must_pack_bitstream = FALSE;
        self->num_non_keyframes = 0;
@@ -815,6 +820,9 @@ static GstFlowReturn gst_dvbvideosink_render(GstBaseSink *sink, GstBuffer *buffe
                }
        }
 #endif
+       /* remove dummy packed B-Frame */
+       if (self->codec_type == CT_MPEG4_PART2 && data_len <= 7)
+               goto ok;
 
        pes_header[0] = 0;
        pes_header[1] = 0;
@@ -837,7 +845,7 @@ static GstFlowReturn gst_dvbvideosink_render(GstBaseSink *sink, GstBuffer *buffe
 #if GST_VERSION_MAJOR < 1
        if (GST_BUFFER_TIMESTAMP(buffer) != GST_CLOCK_TIME_NONE)
 #else
-       if (GST_BUFFER_PTS(buffer) != GST_CLOCK_TIME_NONE)
+       if ((self->use_dts && GST_BUFFER_DTS_IS_VALID(buffer)) || (!self->use_dts && GST_BUFFER_PTS_IS_VALID(buffer)))
 #endif
        {
                pes_header[7] = 0x80; /* pts */
@@ -846,7 +854,10 @@ static GstFlowReturn gst_dvbvideosink_render(GstBaseSink *sink, GstBuffer *buffe
 #if GST_VERSION_MAJOR < 1
                pes_set_pts(GST_BUFFER_TIMESTAMP(buffer), pes_header);
 #else
-               pes_set_pts(GST_BUFFER_PTS(buffer), pes_header);
+               if (self->use_dts)
+                       pes_set_pts(GST_BUFFER_DTS(buffer), pes_header);
+               else
+                       pes_set_pts(GST_BUFFER_PTS(buffer), pes_header);
 #endif
 
                if (self->codec_data)
@@ -1220,7 +1231,7 @@ static GstFlowReturn gst_dvbvideosink_render(GstBaseSink *sink, GstBuffer *buffe
 #if GST_VERSION_MAJOR < 1
        if (GST_BUFFER_TIMESTAMP(buffer) != GST_CLOCK_TIME_NONE)
 #else
-       if (GST_BUFFER_PTS(buffer) != GST_CLOCK_TIME_NONE)
+       if ((self->use_dts && GST_BUFFER_DTS_IS_VALID(buffer)) || (!self->use_dts && GST_BUFFER_PTS_IS_VALID(buffer)))
 #endif
        {
                self->pts_written = TRUE;
@@ -1495,6 +1506,9 @@ static gboolean gst_dvbvideosink_set_caps(GstBaseSink *basesink, GstCaps *caps)
                                        B_SET_BITS("'100000'", 0x20, 5, 0);
                                streamtype = 13;
                                self->codec_type = CT_DIVX311;
+#if GST_VERSION_MAJOR >= 1
+                               self->use_dts = TRUE;
+#endif
                                GST_INFO_OBJECT (self, "MIMETYPE video/x-divx vers. 3 -> VIDEO_SET_STREAMTYPE, 13");
 #if GST_VERSION_MAJOR >= 1
                                gst_buffer_unmap(self->codec_data, &map);
diff --git a/gstdvbvideosink.h b/gstdvbvideosink.h
index e21d14d..40d1f20 100644
--- a/gstdvbvideosink.h
+++ b/gstdvbvideosink.h
@@ -80,6 +80,9 @@ struct _GstDVBVideoSink
 
        GstBuffer *codec_data;
        t_codec_type codec_type;
+#if GST_VERSION_MAJOR >= 1
+       gboolean use_dts;
+#endif
 
 #ifdef PACK_UNPACKED_XVID_DIVX5_BITSTREAM
        /* data needed to pack bitstream (divx5 / xvid) */


Attached Files



Re: GStreamer 1.0 #274 mx3L

  • Senior Member
  • 616 posts

+79
Good

Posted 11 November 2014 - 19:22

@betacentauri

PES header should support it http://dvd.sourcefor...fo/pes-hdr.html



Re: GStreamer 1.0 #275 athoik

  • PLi® Core member
  • 8,458 posts

+327
Excellent

Posted 11 November 2014 - 19:31

@athoik
with dvbvideosink.patch xvid is not smooth anymore.


Yes, it is not working (see #270)

When DTS is written to PES header instead of PTS only then divx3 works.


Maybe there is a bug in divx3 parser? (eg they are storing PTS in DTS field and DTS in PTS field ;))

Edited by athoik, 11 November 2014 - 19:31.

Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: GStreamer 1.0 #276 betacentauri

  • PLi® Core member
  • 7,185 posts

+323
Excellent

Posted 11 November 2014 - 19:37

We should check what timestamps occur in gstreamer 0.10 and which in gstreamer 1.x.

 

Edit ignore this:

@mx3L: But what happens in your patch when PTS is available and DTS is not available (Can this happen?). Then you write DTS = 0 to the header.


Edited by betacentauri, 11 November 2014 - 19:39.

Xtrend ET-9200, ET-8000, ET-10000, OpenPliPC on Ubuntu 12.04

Re: GStreamer 1.0 #277 athoik

  • PLi® Core member
  • 8,458 posts

+327
Excellent

Posted 11 November 2014 - 20:04

For CT_DIVX311 we are doing hacks again... eg custom pes header

static const guint8 brcm_divx311_sequence_header[] =
{
        0x00, 0x00, 0x01, 0xE0, 0x00, 0x34, 0x80, 0x80, // PES HEADER
        0x05, 0x2F, 0xFF, 0xFF, 0xFF, 0xFF,
        0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x20, /* 0 .. 7 */
        0x08, 0xC8, 0x0D, 0x40, 0x00, 0x53, 0x88, 0x40, /* 8 .. 15 */
        0x0C, 0x40, 0x01, 0x90, 0x00, 0x97, 0x53, 0x0A, /* 16 .. 24 */
        0x00, 0x00, 0x00, 0x00,
        0x30, 0x7F, 0x00, 0x00, 0x01, 0xB2, 0x44, 0x69, /* 0 .. 7 */
        0x76, 0x58, 0x33, 0x31, 0x31, 0x41, 0x4E, 0x44  /* 8 .. 15 */
};

Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: GStreamer 1.0 #278 betacentauri

  • PLi® Core member
  • 7,185 posts

+323
Excellent

Posted 11 November 2014 - 21:02

I have checked the used timestamps in gstreamer 0.10 and gstreamer 1.x when divx3 is played back.

 

Gstreamer0.10 uses DTS timestamps:

gst_dvbvideosink_render:<dvbvideosink0>^[[00m time: 0 
gst_dvbvideosink_render:<dvbvideosink0>^[[00m time: 40000000
gst_dvbvideosink_render:<dvbvideosink0>^[[00m time: 80000000
gst_dvbvideosink_render:<dvbvideosink0>^[[00m time: 10800000
...

Unmodified Gstreamer 1.x uses PTS timestamps:

gst_dvbvideosink_render:<dvbvideosink0>^[[00m PTS available: 0
gst_dvbvideosink_render:<dvbvideosink0>^[[00m DTS available: 0
gst_dvbvideosink_render:<dvbvideosink0>^[[00m DTS available: 40000000
gst_dvbvideosink_render:<dvbvideosink0>^[[00m DTS available: 80000000
gst_dvbvideosink_render:<dvbvideosink0>^[[00m DTS available: 108000000
...

Only few PTS timestamps are included in the file.

 

So I think mx3L patch looks quite good.


Xtrend ET-9200, ET-8000, ET-10000, OpenPliPC on Ubuntu 12.04

Re: GStreamer 1.0 #279 athoik

  • PLi® Core member
  • 8,458 posts

+327
Excellent

Posted 11 November 2014 - 21:32

Confirmed...

Bug 736190 - avidemux output invalid pts https://bugzilla.gno...g.cgi?id=736190
Bug 659489 - h264parse: Calculate PTS from DTS (and vice-versa)

So if we need to fix temporary better to create a define with some comments on it.
 
/* Bug 736190 - avidemux output invalid pts */
#define AVIDEMUX_PTS_BUG 
...

#ifdef AVIDEMUX_PTS_BUG
...
#endif
Edit1. Or we can simply use the patch from bug 736190 until resolved

https://bugzilla.gno...tachment=285570

PS. same story for mkv ;)

Edited by athoik, 11 November 2014 - 21:36.

Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: GStreamer 1.0 #280 betacentauri

  • PLi® Core member
  • 7,185 posts

+323
Excellent

Posted 11 November 2014 - 21:50

Nice find!


Xtrend ET-9200, ET-8000, ET-10000, OpenPliPC on Ubuntu 12.04



5 user(s) are reading this topic

0 members, 5 guests, 0 anonymous users