Re: Bug#863663: libgstreamer1.0-0: plays MJPEG AVI files (and possibly other formats) at degraded quality

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Bug#863663: libgstreamer1.0-0: plays MJPEG AVI files (and possibly other formats) at degraded quality

Francesco Poli
On Thu, 15 Jun 2017 10:09:10 +0300 Sebastian Dröge wrote:

[...]
> Please ask GStreamer development
> related question on the GStreamer mailing list, someone else will be
> able to help you there:
>   https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

Dear Sebastian, dear GStreamer developers,
while waiting for the actual bug to be fixed in GStreamer, I am trying
to modify the application (pdf-presenter-console, which is written in
Vala) in order to work around the bug and force the GStreamer library
to use avdec_mjpeg, in stead of jpegdec.

For those who need more context, please take a look at the [Debian bug
#863663] and at the [GStreamer bug 783267].

[Debian bug #863663]: <https://bugs.debian.org/863663>
[GStreamer bug 783267]: <https://bugzilla.gnome.org/show_bug.cgi?id=783267>


Well, my attempts to work around the bug are failing miserably!   :-(

Please someone help me!

The code I added gets a reference to the GStreamer registry singleton
by using  Gst.Registry.get() .
Then, it invokes its lookup_feature() method to find "jpegdec" and
"avdec_mjpeg".
It checks their ranks with get_rank() and finds

  jpegdec     → rank 256
  avdec_mjpeg → rank 64

It then sets swapped ranks with set_rank() :

  jpegdec     → rank 64
  avdec_mjpeg → rank 256

which are checked again and found to be set as desired.

Nonetheless, the AVI file is still played at degraded quality,
as if nothing had changed at all.

The added Vala code (which I hereby release under the terms of the GNU
GPL v2 or later) is:

            GLib.printerr("trying to access the GStreamer registry...\n");
            Gst.Registry regist = Gst.Registry.get();
            GLib.printerr("looking for jpegdec...\n");
            Gst.PluginFeature jdplugin = regist.lookup_feature("jpegdec");
            if (jdplugin != null) {
                GLib.printerr("jpegdec found with rank %u\n", jdplugin.get_rank());
                jdplugin.set_rank(64);
                GLib.printerr("jpegdec set to rank %u\n", jdplugin.get_rank());
            }
            else {
                GLib.printerr("jpegdec not found!\n");
            }
            GLib.printerr("looking for avdec_mjpeg...\n");
            Gst.PluginFeature mjplugin = regist.lookup_feature("avdec_mjpeg");
            if (mjplugin != null) {
                GLib.printerr("avdec_mjpeg found with rank %u\n", mjplugin.get_rank());
                mjplugin.set_rank(256);
                GLib.printerr("avdec_mjpeg set to rank %u\n", mjplugin.get_rank());
            }
            else {
                GLib.printerr("avdec_mjpeg not found!\n");
            }


The output that I get is:


  trying to access the GStreamer registry...
  looking for jpegdec...
  jpegdec found with rank 256
  jpegdec set to rank 64
  looking for avdec_mjpeg...
  avdec_mjpeg found with rank 64
  avdec_mjpeg set to rank 256


If I instead set jpegdec to rank 1, GStreamer spits out the following
error:

  Gstreamer error Your GStreamer installation is missing a plug-in.

Hence, it seems that I am actually modifying the ranks and that these
modified ranks actually change something.
But I seem to be unable to persuade GStreamer to use avdec_mjpeg in
stead of jpegdec!

Where am I going wrong?
Could someone please take a look at this and provide some help?

Thanks a lot for your time.



--
 http://www.inventati.org/frx/
 There's not a second to spare! To the laboratory!
..................................................... Francesco Poli .
 GnuPG key fpr == CA01 1147 9CD2 EFDF FB82  3925 3E1C 27E1 1F69 BFFE

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

attachment0 (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Bug#863663: libgstreamer1.0-0: plays MJPEG AVI files (and possibly other formats) at degraded quality

Sebastian Dröge-4
On Sun, 2017-06-18 at 13:01 +0200, Francesco Poli wrote:

> [...]
>   jpegdec     → rank 256
>   avdec_mjpeg → rank 64
>
> It then sets swapped ranks with set_rank() :
>
>   jpegdec     → rank 64
>   avdec_mjpeg → rank 256
>
> which are checked again and found to be set as desired.
>
> Nonetheless, the AVI file is still played at degraded quality,
> as if nothing had changed at all.
The problem here is that avdec_mjpeg needs jpegparse, jpegdec doesn't.
And jpegparse has a rank of 0, so will never be automatically used.

Try setting the jpegparse rank to 256 too, avdec_mjpeg to 256 and
jpegdec to 0.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (981 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Bug#863663: libgstreamer1.0-0: plays MJPEG AVI files (and possibly other formats) at degraded quality

Francesco Poli
On Tue, 20 Jun 2017 08:55:41 +0300 Sebastian Dröge wrote:

> On Sun, 2017-06-18 at 13:01 +0200, Francesco Poli wrote:
> > [...]
> >   jpegdec     → rank 256
> >   avdec_mjpeg → rank 64
> >
> > It then sets swapped ranks with set_rank() :
> >
> >   jpegdec     → rank 64
> >   avdec_mjpeg → rank 256
> >
> > which are checked again and found to be set as desired.
> >
> > Nonetheless, the AVI file is still played at degraded quality,
> > as if nothing had changed at all.
>
> The problem here is that avdec_mjpeg needs jpegparse, jpegdec doesn't.
> And jpegparse has a rank of 0, so will never be automatically used.
>
> Try setting the jpegparse rank to 256 too, avdec_mjpeg to 256 and
> jpegdec to 0.
I have just tried, but it does not seem to work.   :-(

I have also added the setting of videoconvert rank to 256 (it was 0),
since the manual pipeline that worked with gst-launch-1.0 also included
videoconvert.

The debug output (the format was slightly changed) was:

  accessing the GStreamer registry...
  jpegdec rank changed from 256 to 0
  avdec_mjpeg rank changed from 64 to 256
  jpegparse rank changed from 0 to 256
  videoconvert rank changed from 0 to 256
 
  Gstreamer error Your GStreamer installation is missing a plug-in.
  Gstreamer error Internal data stream error.

As you can see, setting jpegdec rank to 0 causes GStreamer to complain
about a missing plug-in and no movie is played.   :-(

If I instead set jpegdec rank to 64, I get no error, but the movie is
again played at degraded quality (showing that jpegdec is again
magically selected, despite having lower rank than everything else!).

The debug output was:

  accessing the GStreamer registry...
  jpegdec rank changed from 256 to 64
  avdec_mjpeg rank changed from 64 to 256
  jpegparse rank changed from 0 to 256
  videoconvert rank changed from 0 to 256


At this point I really cannot understand what's going on and why all my
attempts are failing...   :-(


--
 http://www.inventati.org/frx/
 There's not a second to spare! To the laboratory!
..................................................... Francesco Poli .
 GnuPG key fpr == CA01 1147 9CD2 EFDF FB82  3925 3E1C 27E1 1F69 BFFE

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

attachment0 (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Bug#863663: libgstreamer1.0-0: plays MJPEG AVI files (and possibly other formats) at degraded quality

Francesco Poli
On Wed, 21 Jun 2017 21:52:43 +0200 Francesco Poli wrote:

[...]
> At this point I really cannot understand what's going on and why all my
> attempts are failing...   :-(

Could someone please shed some light on this mystery?

Thanks for your time.
Bye.

--
 http://www.inventati.org/frx/
 There's not a second to spare! To the laboratory!
..................................................... Francesco Poli .
 GnuPG key fpr == CA01 1147 9CD2 EFDF FB82  3925 3E1C 27E1 1F69 BFFE

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

attachment0 (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Bug#863663: libgstreamer1.0-0: plays MJPEG AVI files (and possibly other formats) at degraded quality

Yasushi SHOJI-2
Hi,

On Sun, Jun 25, 2017 at 2:50 AM, Francesco Poli <[hidden email]> wrote:
>
> On Wed, 21 Jun 2017 21:52:43 +0200 Francesco Poli wrote:
>
> [...]
> > At this point I really cannot understand what's going on and why all my
> > attempts are failing...   :-(
>
> Could someone please shed some light on this mystery?

I might be misunderstanding but the following pipeline seems to work here without any
ranking change on my Debian Sid.

$ gst-launch-1.0 -v filesrc location=wave_anim.avi ! avidemux ! jpegparse ! avdec_mjpeg ! videoconvert ! autovideosink

and Yes, I can reproduce the degraded image with jpegdec

$ gst-launch-1.0 -v filesrc location=wave_anim.avi ! avidemux ! jpegparse ! jpegdec ! autovideosink

I'm using 1.12.1 it that matters.

$ gst-launch-1.0 --version
gst-launch-1.0 version 1.12.1
GStreamer 1.12.1
-- 
              yashi


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Bug#863663: libgstreamer1.0-0: plays MJPEG AVI files (and possibly other formats) at degraded quality

Francesco Poli
On Tue, 27 Jun 2017 10:34:54 +0900 Yasushi SHOJI wrote:

> Hi,

Hello, thanks for your reply.

>
> On Sun, Jun 25, 2017 at 2:50 AM, Francesco Poli <[hidden email]>
> wrote:
> >
> > On Wed, 21 Jun 2017 21:52:43 +0200 Francesco Poli wrote:
> >
> > [...]
> > > At this point I really cannot understand what's going on and why all my
> > > attempts are failing...   :-(
> >
> > Could someone please shed some light on this mystery?
>
> I might be misunderstanding but the following pipeline seems to work
> here without any
> ranking change on my Debian Sid.
>
> $ gst-launch-1.0 -v filesrc location=wave_anim.avi ! avidemux ! jpegparse !
> avdec_mjpeg ! videoconvert ! autovideosink
>
[...]

That's clear: the gst-launch-1.0 command line able to correctly play
the AVI file has already been suggested.

The problem here is: how can I modify an application (written in Vala)
that uses the GStreamer library to use avdec_mjpeg for MJPEG AVI files.

The attempts to modify the ranks were intended to guide the GStreamer
library in the automatic decoder selection process, so that it would
select avdec_mjpeg for MJPEG AVI files.

But, for some mysterious reason, all those attempts seem to fail
miserably...

Is there any alternative approach?


P.S.: Please Cc me, as well as the Debian bug address and the
gstreamer-devel mailing list. Thanks for your understanding!


--
 http://www.inventati.org/frx/
 There's not a second to spare! To the laboratory!
..................................................... Francesco Poli .
 GnuPG key fpr == CA01 1147 9CD2 EFDF FB82  3925 3E1C 27E1 1F69 BFFE

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

attachment0 (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Bug#863663: libgstreamer1.0-0: plays MJPEG AVI files (and possibly other formats) at degraded quality

Francesco Poli
On Tue, 27 Jun 2017 23:34:08 +0200 Francesco Poli wrote:

[...]
> Is there any alternative approach?

Just to clarify: while waiting for [bug 783267] to be fixed[^NOTE],
I am looking for a workaround.

[bug 783267]: <https://bugzilla.gnome.org/show_bug.cgi?id=783267>

[^NOTE]: by the way, is there any progress?!? could someone please
         fix the bug once and for all?!?

I was trying to adjust the ranks from within the application in order
to convince the GStreamer library to select the equivalent of the
following pipeline for MJPEG AVI files:

  $ gst-launch-1.0 filesrc location=wave_anim.avi \! avidemux \! jpegparse \! avdec_mjpeg \! videoconvert \! autovideosink

But all my attempts seem to fail.

On the other hand, since in my use case all the movies are MJPEG AVI
files, another temporary workaround could be to force the above
pipeline manually.

Could someone please help me?

The application is pdf-presenter-console also known as [pdfpc].
The code that sets the GStreamer pipeline is (I think) in the
establish_pipeline() method included in the file
[src/classes/action/movie.vala].
I believe that this method sets up a generic pipeline (suitable for any
file format supported by GStreamer).
How should I modify that method to force the use of the above mentioned
pipeline (avidemux \! jpegparse \! avdec_mjpeg \! videoconvert), which
is only suitable for MJPEG AVI files?

[pdfpc]: <https://pdfpc.github.io/>

[src/classes/action/movie.vala]: <https://github.com/pdfpc/pdfpc/blob/d1c17b0d91f0dcd2128ec60086c86d3d8dc251c4/src/classes/action/movie.vala>


 
> P.S.: Please Cc me, as well as the Debian bug address and the
> gstreamer-devel mailing list. Thanks for your understanding!


--
 http://www.inventati.org/frx/
 There's not a second to spare! To the laboratory!
..................................................... Francesco Poli .
 GnuPG key fpr == CA01 1147 9CD2 EFDF FB82  3925 3E1C 27E1 1F69 BFFE

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

attachment0 (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Bug#863663: libgstreamer1.0-0: plays MJPEG AVI files (and possibly other formats) at degraded quality

Francesco Poli
On Wed, 28 Jun 2017 22:27:00 +0200 Francesco Poli wrote:

[...]
> waiting for [bug 783267] to be fixed
[...]
>
> [bug 783267]: <https://bugzilla.gnome.org/show_bug.cgi?id=783267>

Is there any progress on this bug?
Please let me know: I am looking forward to seeing this issue fixed
once and for all...

Thanks for your time!


P.S.: Please Cc me, as well as the Debian bug address and the
gstreamer-devel mailing list. Thanks for your understanding!


--
 http://www.inventati.org/frx/
 There's not a second to spare! To the laboratory!
..................................................... Francesco Poli .
 GnuPG key fpr == CA01 1147 9CD2 EFDF FB82  3925 3E1C 27E1 1F69 BFFE

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

attachment0 (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Bug#863663: libgstreamer1.0-0: plays MJPEG AVI files (and possibly other formats) at degraded quality

Francesco Poli
On Sat, 19 Aug 2017 15:04:51 +0200 Francesco Poli wrote:

> On Wed, 28 Jun 2017 22:27:00 +0200 Francesco Poli wrote:
>
> [...]
> > waiting for [bug 783267] to be fixed
> [...]
> >
> > [bug 783267]: <https://bugzilla.gnome.org/show_bug.cgi?id=783267>
>
> Is there any progress on this bug?
> Please let me know: I am looking forward to seeing this issue fixed
> once and for all...
>
> Thanks for your time!
May I have a reply, please?
Thanks for your understanding.


> P.S.: Please Cc me, as well as the Debian bug address and the
> gstreamer-devel mailing list. Thanks for your understanding!



--
 http://www.inventati.org/frx/
 There's not a second to spare! To the laboratory!
..................................................... Francesco Poli .
 GnuPG key fpr == CA01 1147 9CD2 EFDF FB82  3925 3E1C 27E1 1F69 BFFE

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

attachment0 (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Bug#863663: libgstreamer1.0-0: plays MJPEG AVI files (and possibly other formats) at degraded quality

Tim-Philipp Müller-2
On Mon, 2017-09-04 at 22:51 +0200, Francesco Poli wrote:

> > [...]
> > > waiting for [bug 783267] to be fixed
> >
> > [...]
> > >
> > > [bug 783267]: <https://bugzilla.gnome.org/show_bug.cgi?id=783267>
> >
> > Is there any progress on this bug?
> > Please let me know: I am looking forward to seeing this issue fixed
> > once and for all...
> >
> > Thanks for your time!
>
> May I have a reply, please?
> Thanks for your understanding.

The best way to stay informed of any progress on the bug is to
subscribe (CC yourself) to the bug in bugzilla, or simply check in on
it from time to time. The latest status is in bugzilla.

Someone might have a look later this week.

Cheers
 -Tim
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Bug#863663: libgstreamer1.0-0: plays MJPEG AVI files (and possibly other formats) at degraded quality

Francesco Poli
On Tue, 05 Sep 2017 10:40:13 +0100 Tim-Philipp Müller wrote:

> On Mon, 2017-09-04 at 22:51 +0200, Francesco Poli wrote:
>
> > > [...]
> > > > waiting for [bug 783267] to be fixed
> > >
> > > [...]
> > > >
> > > > [bug 783267]: <https://bugzilla.gnome.org/show_bug.cgi?id=783267>
> > >
> > > Is there any progress on this bug?
> > > Please let me know: I am looking forward to seeing this issue fixed
> > > once and for all...
> > >
> > > Thanks for your time!
> >
> > May I have a reply, please?
> > Thanks for your understanding.
>
> The best way to stay informed of any progress on the bug is to
> subscribe (CC yourself) to the bug in bugzilla, or simply check in on
> it from time to time. The latest status is in bugzilla.
I am already checking the bugzilla bug from time to time, but no
progress has been documented there since 2017-06-15 ...

>
> Someone might have a look later this week.

This would be highly appreciated!


P.S.: Please keep the Debian bug address in Cc (I have just re-added
it). Thanks!


--
 http://www.inventati.org/frx/
 There's not a second to spare! To the laboratory!
..................................................... Francesco Poli .
 GnuPG key fpr == CA01 1147 9CD2 EFDF FB82  3925 3E1C 27E1 1F69 BFFE

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

attachment0 (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Bug#863663: libgstreamer1.0-0: plays MJPEG AVI files (and possibly other formats) at degraded quality

Francesco Poli
On Tue, 5 Sep 2017 23:16:57 +0200 Francesco Poli wrote:

> On Tue, 05 Sep 2017 10:40:13 +0100 Tim-Philipp Müller wrote:
[...]
> >
> > Someone might have a look later this week.
>
> This would be highly appreciated!
>

Is there any progress (not documented on the bugzilla [bug 783267])?

[bug 783267]: <https://bugzilla.gnome.org/show_bug.cgi?id=783267>

>
> P.S.: Please keep the Debian bug address in Cc. Thanks!


--
 http://www.inventati.org/frx/
 There's not a second to spare! To the laboratory!
..................................................... Francesco Poli .
 GnuPG key fpr == CA01 1147 9CD2 EFDF FB82  3925 3E1C 27E1 1F69 BFFE

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

attachment0 (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Bug#863663: libgstreamer1.0-0: plays MJPEG AVI files (and possibly other formats) at degraded quality

Francesco Poli
On Fri, 22 Sep 2017 23:58:39 +0200 Francesco Poli wrote:

> On Tue, 5 Sep 2017 23:16:57 +0200 Francesco Poli wrote:
>
> > On Tue, 05 Sep 2017 10:40:13 +0100 Tim-Philipp Müller wrote:
> [...]
> > >
> > > Someone might have a look later this week.
> >
> > This would be highly appreciated!
> >
>
> Is there any progress (not documented on the bugzilla [bug 783267])?
>
> [bug 783267]: <https://bugzilla.gnome.org/show_bug.cgi?id=783267>
Could someone please reply?
Thanks for your time!

>
> >
> > P.S.: Please keep the Debian bug address in Cc. Thanks!



--
 http://www.inventati.org/frx/
 There's not a second to spare! To the laboratory!
..................................................... Francesco Poli .
 GnuPG key fpr == CA01 1147 9CD2 EFDF FB82  3925 3E1C 27E1 1F69 BFFE

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

attachment0 (849 bytes) Download Attachment