Distorted video when using videoflip, videoscale and a video with image-orientation tag

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

Distorted video when using videoflip, videoscale and a video with image-orientation tag

domsch
I'm having problems displaying portrait orientation videos that have an
image-orientation tag (rotate-90).
To automatically rotate the video I'm using videoflip (method=automatic).
My video has a resolution of 1080x1920 and I want to scale it down to
540x960.

But gst-launch shows a distorted image:
gst-launch-1.0 -v playbin uri=file:///home/dmsch/portrait-fhd.mp4
video-sink="videoflip method=automatic ! videoscale !
video/x-raw,width=540,height=960 ! ximagesink"

Screenshot: https://imgur.com/a/XRvh6ZN
Video:
https://drive.google.com/file/d/1mYWEpHsWQljhBGlBB4RPgDe8qAuKm3r_/view?usp=sharing



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

Re: Distorted video when using videoflip, videoscale and a video with image-orientation tag

Nicolas Dufresne-5
Le vendredi 11 décembre 2020 à 03:24 -0600, domsch a écrit :

> I'm having problems displaying portrait orientation videos that have an
> image-orientation tag (rotate-90).
> To automatically rotate the video I'm using videoflip (method=automatic).
> My video has a resolution of 1080x1920 and I want to scale it down to
> 540x960.
>
> But gst-launch shows a distorted image:
> gst-launch-1.0 -v playbin uri=file:///home/dmsch/portrait-fhd.mp4
> video-sink="videoflip method=automatic ! videoscale !
> video/x-raw,width=540,height=960 ! ximagesink"

You need to specify an aspect ratio:

  video/x-raw,width=540,height=960,pixel-aspect-ratio=1/1

I don't remember why ximagesink does not force squared pixel aspect ratio, there
wa a reason, but by fixing the aspect ratio you prevent videoscale from scaling
that field rather then actually doing the scaling job. You should notice in the
CPU load the difference. It's a very common trap.

Nicolas


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

Re: Distorted video when using videoflip, videoscale and a video with image-orientation tag

domsch
Thanks for your answer, unfortunately adding pixel-aspect-ratio=1/1 to the
caps does not solve the problem.
I used the following command:

gst-launch-1.0 -v playbin uri=file:///home/dmsch/portrait-fhd.mp4
video-sink="videoflip method=automatic ! videoscale !
video/x-raw,width=540,height=960,pixel-aspect-ratio=1/1 ! ximagesink"


Nicolas Dufresne-5 wrote

> Le vendredi 11 décembre 2020 à 03:24 -0600, domsch a écrit :
>> I'm having problems displaying portrait orientation videos that have an
>> image-orientation tag (rotate-90).
>> To automatically rotate the video I'm using videoflip (method=automatic).
>> My video has a resolution of 1080x1920 and I want to scale it down to
>> 540x960.
>>
>> But gst-launch shows a distorted image:
>> gst-launch-1.0 -v playbin uri=file:///home/dmsch/portrait-fhd.mp4
>> video-sink="videoflip method=automatic ! videoscale !
>> video/x-raw,width=540,height=960 ! ximagesink"
>
> You need to specify an aspect ratio:
>
>   video/x-raw,width=540,height=960,pixel-aspect-ratio=1/1
>
> I don't remember why ximagesink does not force squared pixel aspect ratio,
> there
> wa a reason, but by fixing the aspect ratio you prevent videoscale from
> scaling
> that field rather then actually doing the scaling job. You should notice
> in the
> CPU load the difference. It's a very common trap.
>
> Nicolas
>
>>
>> Screenshot: https://imgur.com/a/XRvh6ZN
>> Video:
>> https://drive.google.com/file/d/1mYWEpHsWQljhBGlBB4RPgDe8qAuKm3r_/view?usp=sharing
>>
>>
>>
>> --
>> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
>> _______________________________________________
>> gstreamer-devel mailing list
>>

> gstreamer-devel@.freedesktop

>> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
> _______________________________________________
> gstreamer-devel mailing list

> gstreamer-devel@.freedesktop

> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel





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

Re: Distorted video when using videoflip, videoscale and a video with image-orientation tag

Nicolas Dufresne-5
Le mercredi 16 décembre 2020 à 04:43 -0600, domsch a écrit :
> Thanks for your answer, unfortunately adding pixel-aspect-ratio=1/1 to the
> caps does not solve the problem.
> I used the following command:
>
> gst-launch-1.0 -v playbin uri=file:///home/dmsch/portrait-fhd.mp4
> video-sink="videoflip method=automatic ! videoscale !
> video/x-raw,width=540,height=960,pixel-aspect-ratio=1/1 ! ximagesink"

At this point, you'll have to share the specific stream to allow us to check if
we can reproduce.

>
>
> Nicolas Dufresne-5 wrote
> > Le vendredi 11 décembre 2020 à 03:24 -0600, domsch a écrit :
> > > I'm having problems displaying portrait orientation videos that have an
> > > image-orientation tag (rotate-90).
> > > To automatically rotate the video I'm using videoflip (method=automatic).
> > > My video has a resolution of 1080x1920 and I want to scale it down to
> > > 540x960.
> > >
> > > But gst-launch shows a distorted image:
> > > gst-launch-1.0 -v playbin uri=file:///home/dmsch/portrait-fhd.mp4
> > > video-sink="videoflip method=automatic ! videoscale !
> > > video/x-raw,width=540,height=960 ! ximagesink"
> >
> > You need to specify an aspect ratio:
> >
> >   video/x-raw,width=540,height=960,pixel-aspect-ratio=1/1
> >
> > I don't remember why ximagesink does not force squared pixel aspect ratio,
> > there
> > wa a reason, but by fixing the aspect ratio you prevent videoscale from
> > scaling
> > that field rather then actually doing the scaling job. You should notice
> > in the
> > CPU load the difference. It's a very common trap.
> >
> > Nicolas
> >
> > >
> > > Screenshot: https://imgur.com/a/XRvh6ZN
> > > Video:
> > > https://drive.google.com/file/d/1mYWEpHsWQljhBGlBB4RPgDe8qAuKm3r_/view?usp=sharing
> > >
> > >
> > >
> > > --
> > > Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> > > _______________________________________________
> > > gstreamer-devel mailing list
> > >
>
> > gstreamer-devel@.freedesktop
>
> > > https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> >
> >
> > _______________________________________________
> > gstreamer-devel mailing list
>
> > gstreamer-devel@.freedesktop
>
> > https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


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

Re: Distorted video when using videoflip, videoscale and a video with image-orientation tag

domsch
Nicolas Dufresne-5 wrote

> Le mercredi 16 décembre 2020 à 04:43 -0600, domsch a écrit :
>> Thanks for your answer, unfortunately adding pixel-aspect-ratio=1/1 to
>> the
>> caps does not solve the problem.
>> I used the following command:
>>
>> gst-launch-1.0 -v playbin uri=file:///home/dmsch/portrait-fhd.mp4
>> video-sink="videoflip method=automatic ! videoscale !
>> video/x-raw,width=540,height=960,pixel-aspect-ratio=1/1 ! ximagesink"
>
> At this point, you'll have to share the specific stream to allow us to
> check if
> we can reproduce.

Hi Nicolas,

can you reproduce the issue with the following video and command?

Video:
https://drive.google.com/file/d/1mYWEpHsWQljhBGlBB4RPgDe8qAuKm3r_/view?usp=sharing

Command:
gst-launch-1.0 -v playbin uri=file:///home/dmsch/portrait-fhd.mp4
video-sink="videoflip method=automatic ! videoscale !
video/x-raw,width=540,height=960,pixel-aspect-ratio=1/1 ! ximagesink"

I'm using Ubuntu 20.04, my device is a Intel NUC i3, and the following
packages + versions are installed:

dpkg -l | grep gstreamer

ii  gir1.2-gstreamer-1.0:amd64           1.16.2-2                            
amd64        GObject introspection data for the GStreamer library
ii  gstreamer1.0-alsa:amd64              1.16.2-4                            
amd64        GStreamer plugin for ALSA
ii  gstreamer1.0-clutter-3.0:amd64       3.0.27-1                            
amd64        Clutter PLugin for GStreamer 1.0
ii  gstreamer1.0-doc                     1.16.2-2                            
all          GStreamer core documentation and manuals
ii  gstreamer1.0-gl:amd64                1.16.2-4                            
amd64        GStreamer plugins for GL
ii  gstreamer1.0-gtk3:amd64              1.16.2-1ubuntu2                      
amd64        GStreamer plugin for GTK+3
ii  gstreamer1.0-libav:amd64             1.16.2-2                            
amd64        ffmpeg plugin for GStreamer
ii  gstreamer1.0-plugins-bad:amd64       1.16.2-2.1ubuntu1                    
amd64        GStreamer plugins from the "bad" set
ii  gstreamer1.0-plugins-base:amd64      1.16.2-4                            
amd64        GStreamer plugins from the "base" set
ii  gstreamer1.0-plugins-good:amd64      1.16.2-1ubuntu2                      
amd64        GStreamer plugins from the "good" set
ii  gstreamer1.0-plugins-ugly:amd64      1.16.2-2build1                      
amd64        GStreamer plugins from the "ugly" set
ii  gstreamer1.0-pulseaudio:amd64        1.16.2-1ubuntu2                      
amd64        GStreamer plugin for PulseAudio
ii  gstreamer1.0-qt5:amd64               1.16.2-1ubuntu2                      
amd64        GStreamer plugin for Qt5
ii  gstreamer1.0-tools                   1.16.2-2                            
amd64        Tools for use with GStreamer
ii  gstreamer1.0-vaapi:amd64             1.16.2-2                            
amd64        VA-API plugins for GStreamer
ii  gstreamer1.0-x:amd64                 1.16.2-4                            
amd64        GStreamer plugins for X11 and Pango
ii  libgstreamer-gl1.0-0:amd64           1.16.2-4                            
amd64        GStreamer GL libraries
ii  libgstreamer-plugins-bad1.0-0:amd64  1.16.2-2.1ubuntu1                    
amd64        GStreamer libraries from the "bad" set
ii  libgstreamer-plugins-base1.0-0:amd64 1.16.2-4                            
amd64        GStreamer libraries from the "base" set
ii  libgstreamer-plugins-good1.0-0:amd64 1.16.2-1ubuntu2                      
amd64        GStreamer development files for libraries from the "good" set
ii  libgstreamer1.0-0:amd64              1.16.2-2                            
amd64        Core GStreamer libraries and elements
ii  libgstreamer1.0-dev:amd64            1.16.2-2                            
amd64        GStreamer core development files







--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel