Question on passing a buffer larger than the pixel size

James Hughes James.Hughes at dspg.com
Mon Nov 9 06:33:52 PST 2015


Thanks for the comments and hints. Unfortunately there is no crop settings on the omxh264enc component, and I am using gst-launch rather that implementing this in code, so am somewhat limited to 'what is there'. I've tried setting the output resolution on the output of the encoder but that breaks the pipeline.

James






-----Original Message-----
From: gstreamer-devel [mailto:gstreamer-devel-bounces at lists.freedesktop.org] On Behalf Of gstreamer-devel-request at lists.freedesktop.org
Sent: 09 November 2015 14:20
To: gstreamer-devel at lists.freedesktop.org
Subject: gstreamer-devel Digest, Vol 58, Issue 16

Send gstreamer-devel mailing list submissions to
	gstreamer-devel at lists.freedesktop.org

To subscribe or unsubscribe via the World Wide Web, visit
	http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
or, via email, send a message with subject or body 'help' to
	gstreamer-devel-request at lists.freedesktop.org

You can reach the person managing the list at
	gstreamer-devel-owner at lists.freedesktop.org

When replying, please edit your Subject line so it is more specific than "Re: Contents of gstreamer-devel digest..."


Today's Topics:

   1. AW: Question on passing a buffer larger than the pixel size
      (Thornton, Keith)
   2. Re: Fixed several GES examples, but confused with GESAsset
      and GESClip (Guofeng Zhang)
   3. Re: Fixed several GES examples, but confused with GESAsset
      and GESClip (Thibault Saunier)
   4. Re: Question on passing a buffer larger than the pixel size
      (Nicolas Dufresne)
   5. Re: Fixed several GES examples, but confused with GESAsset
      and GESClip (Guofeng Zhang)


----------------------------------------------------------------------

Message: 1
Date: Mon, 9 Nov 2015 11:34:42 +0000
From: "Thornton, Keith" <keith.thornton at zeiss.com>
To: Discussion of the development of and with GStreamer
	<gstreamer-devel at lists.freedesktop.org>
Subject: AW: Question on passing a buffer larger than the pixel size
Message-ID:
	<A9BCBA486CC7FC4086055001AC19D3A801149F91 at ADEFUE01SMS004.cznet.zeiss.org>
	
Content-Type: text/plain; charset="utf-8"

When using the Intel HW Encoder I can set the height to 1088 but can then set the CropW to 1080. I don't have access to omxh264enc but maybe some such similar possibility exists

Von: gstreamer-devel [mailto:gstreamer-devel-bounces at lists.freedesktop.org] Im Auftrag von James Hughes
Gesendet: Montag, 9. November 2015 12:02
An: gstreamer-devel at lists.freedesktop.org
Betreff: Question on passing a buffer larger than the pixel size

Odd title, but let me explain!

Using gstreamer1.0 on Raspberry Pi. The encoder component is omxh264enc, the source is a raw Y4M file at 1920x1080p50

There is a HW limitation on the Pi's encoders, which means the dimensions need to be multiples of 16, and unfortunately, 1080 isn't. So the encoder, although encoding to 1080, likes a buffer sized to 1088.

If I pass in a 1080p sized buffer, I get corruption on the last few lines of the frame, due to the random nature of the image from 1080-1088 (overflowing the buffer)

What I need to able to do is pass the large buffer in to the encoder, with black in the final 8 lines, but the encoder still expecting to encode at 1080p

I have tried videobox, videoscale etc, but these all result in the encoder encoding at 1088. Is there any way to use buffer sizes at 1088 but with actual image dimensions at 1080?

TIA

James

______________________________________________________________________
DSP Group, Inc. automatically scans all emails and attachments using MessageLabs Email Security System.
_____________________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20151109/a9ee9297/attachment-0001.html>

------------------------------

Message: 2
Date: Mon, 9 Nov 2015 20:06:50 +0800
From: Guofeng Zhang <guofengzh at auslides.com>
To: Discussion of the development of and with GStreamer
	<gstreamer-devel at lists.freedesktop.org>
Subject: Re: Fixed several GES examples, but confused with GESAsset
	and GESClip
Message-ID: <56408C5A.7050409 at auslides.com>
Content-Type: text/plain; charset=utf-8; format=flowed

Thibault,

Your are right, adding
     ges_timeline_commit (timeline);
before setting the pipepline to PLAYING solve it.

Thanks very much for your help.

Guofeng


On 2015/11/9 4:28, Thibault Saunier wrote:
> Hello,
>
> GES will add testsrc for gaps yes. No idea why it would not work. Make 
> sure the timeline is commited in that example.
>
> Regards,
>
> Thibault
>
> On Sun, Nov 8, 2015 at 5:18 PM, Guofeng Zhang <guofengzh at auslides.com> wrote:
>> Thibault
>>
>> For the simple1.c, If I change the value of the start property to a 
>> non-zero value, for example, 1 second, I heard nothing. If I reset 
>> its value to 0, it works as expected.
>>
>> Does this mean that I should make sure that there is not any gap in 
>> the timeline?  I think GES will use audiotestsrc for the audio gap, am I right?
>>
>> Thanks for your help.
>>
>> Guofeng
>>
>>
>> On 2015/10/30 18:14, Thibault Saunier wrote:
>>> Hello Guofeng,
>>>
>>>> test1.c worked well, it use:
>>>>      GESAsset *src_asset;
>>>>      ...
>>>>      src_asset = ges_asset_request (GES_TYPE_TEST_CLIP, NULL, 
>>>> NULL); to instantiate a GESTestClip.
>>>>
>>>> but test2.c and simple1.c does not work. They all use
>>>>      GESUriClip *src = ges_uri_clip_new (uri);
>>> I just fixed that with:
>>>
>>>       commit 5f81e64b596d3234406df75ccfde11009c422729
>>>       Author: Thibault Saunier <tsaunier at gnome.org>
>>>       Date:   Fri Oct 30 10:52:12 2015 +0100
>>>
>>>               uri-clip: Make sure to instantiate an asset to back 
>>> GESUriClip-s
>>>
>>>
>>>> I tried to use
>>>>      GESAsset *src = ges_asset_request (GES_TYPE_URI_CLIP, uri, 
>>>> NULL); but not succeeded.
>>>>
>>>> The comment for ges_asset_request() describes that I should use 
>>>> ges_uri_clip_asset_request_sync, so I made the following change:
>>>>      GESAsset *src = ges_uri_clip_asset_request_sync( uri, &error) ;
>>>>      ...
>>>>      ges_layer_add_asset (layer, src, offset, 0, 5 * GST_SECOND, 
>>>> GES_TRACK_TYPE_AUDIO); Now test2.c and simple1.c worked well.
>>> That is the correct way of doing it (GESUriClipAsset is a special 
>>> case as we concider in most cases it should be created async), we 
>>> still let the user create it synchronously with that helper.
>>>
>>>> What make me confused is
>>>> (1) ges_uri_clip_asset_request_sync() also use
>>>>      ges_asset_request (GES_TYPE_URI_CLIP, uri, &lerror) to 
>>>> instantiate the GESAsset, but it works (mine not), why?
>>> ges_uri_clip_asset_request_sync does ges_asset_request to check if 
>>> the media file has already been discovered in which case it just 
>>> uses the cached asset, in the case it is not it will go through a 
>>> particular mechanism of synchronous discovery.
>>>
>>>> (2) The GESTAsset and GESClip has one to one relationship, that is, 
>>>> as documented that assets will represent for example a GESUriClips, 
>>>> GESBaseEffect etc.
>>>> each clip has a asset associated with it. But GESTestClip has no 
>>>> GESTestClipAsset (something like it) defined, how could an asset 
>>>> existed for GESTestClip? or testsrc does not need a resource to 
>>>> represent it, so it does not need a corresponding asset? if so, for 
>>>> appsrc, I could only define a clip for it and it will work with the 
>>>> GES framework?
>>> GESTestClip does not need a specialized asset to represent it, so in 
>>> that case we just use the standard GESAsset (not a subclass of it).
>>>
>>> Hoping that answers your questions.
>>>
>>> Regards,
>>>
>>> Thibault
>>> _______________________________________________
>>> gstreamer-devel mailing list
>>> gstreamer-devel at lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



------------------------------

Message: 3
Date: Mon, 9 Nov 2015 13:17:20 +0100
From: Thibault Saunier <tsaunier at gnome.org>
To: Discussion of the development of and with GStreamer
	<gstreamer-devel at lists.freedesktop.org>
Subject: Re: Fixed several GES examples, but confused with GESAsset
	and GESClip
Message-ID:
	<CANYYV1y=62U0P2rUbak_kcmNLa9GcMRjj8W4vwHhevoXHxM2Pg at mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Hello,

Please provide patches when you fix bugs in the examples :)

Regards,

Thibault

On Mon, Nov 9, 2015 at 1:06 PM, Guofeng Zhang <guofengzh at auslides.com> wrote:
> Thibault,
>
> Your are right, adding
>     ges_timeline_commit (timeline);
> before setting the pipepline to PLAYING solve it.
>
> Thanks very much for your help.
>
> Guofeng
>
>
>
> On 2015/11/9 4:28, Thibault Saunier wrote:
>>
>> Hello,
>>
>> GES will add testsrc for gaps yes. No idea why it would not work. 
>> Make sure the timeline is commited in that example.
>>
>> Regards,
>>
>> Thibault
>>
>> On Sun, Nov 8, 2015 at 5:18 PM, Guofeng Zhang 
>> <guofengzh at auslides.com>
>> wrote:
>>>
>>> Thibault
>>>
>>> For the simple1.c, If I change the value of the start property to a 
>>> non-zero value, for example, 1 second, I heard nothing. If I reset 
>>> its value to 0, it works as expected.
>>>
>>> Does this mean that I should make sure that there is not any gap in 
>>> the timeline?  I think GES will use audiotestsrc for the audio gap, 
>>> am I right?
>>>
>>> Thanks for your help.
>>>
>>> Guofeng
>>>
>>>
>>> On 2015/10/30 18:14, Thibault Saunier wrote:
>>>>
>>>> Hello Guofeng,
>>>>
>>>>> test1.c worked well, it use:
>>>>>      GESAsset *src_asset;
>>>>>      ...
>>>>>      src_asset = ges_asset_request (GES_TYPE_TEST_CLIP, NULL, 
>>>>> NULL); to instantiate a GESTestClip.
>>>>>
>>>>> but test2.c and simple1.c does not work. They all use
>>>>>      GESUriClip *src = ges_uri_clip_new (uri);
>>>>
>>>> I just fixed that with:
>>>>
>>>>       commit 5f81e64b596d3234406df75ccfde11009c422729
>>>>       Author: Thibault Saunier <tsaunier at gnome.org>
>>>>       Date:   Fri Oct 30 10:52:12 2015 +0100
>>>>
>>>>               uri-clip: Make sure to instantiate an asset to back 
>>>> GESUriClip-s
>>>>
>>>>
>>>>> I tried to use
>>>>>      GESAsset *src = ges_asset_request (GES_TYPE_URI_CLIP, uri, 
>>>>> NULL); but not succeeded.
>>>>>
>>>>> The comment for ges_asset_request() describes that I should use 
>>>>> ges_uri_clip_asset_request_sync, so I made the following change:
>>>>>      GESAsset *src = ges_uri_clip_asset_request_sync( uri, &error) ;
>>>>>      ...
>>>>>      ges_layer_add_asset (layer, src, offset, 0, 5 * GST_SECOND, 
>>>>> GES_TRACK_TYPE_AUDIO); Now test2.c and simple1.c worked well.
>>>>
>>>> That is the correct way of doing it (GESUriClipAsset is a special 
>>>> case as we concider in most cases it should be created async), we 
>>>> still let the user create it synchronously with that helper.
>>>>
>>>>> What make me confused is
>>>>> (1) ges_uri_clip_asset_request_sync() also use
>>>>>      ges_asset_request (GES_TYPE_URI_CLIP, uri, &lerror) to 
>>>>> instantiate the GESAsset, but it works (mine not), why?
>>>>
>>>> ges_uri_clip_asset_request_sync does ges_asset_request to check if 
>>>> the media file has already been discovered in which case it just 
>>>> uses the cached asset, in the case it is not it will go through a 
>>>> particular mechanism of synchronous discovery.
>>>>
>>>>> (2) The GESTAsset and GESClip has one to one relationship, that 
>>>>> is, as documented that assets will represent for example a 
>>>>> GESUriClips, GESBaseEffect etc.
>>>>> each clip has a asset associated with it. But GESTestClip has no 
>>>>> GESTestClipAsset (something like it) defined, how could an asset 
>>>>> existed for GESTestClip? or testsrc does not need a resource to 
>>>>> represent it, so it does not need a corresponding asset? if so, 
>>>>> for appsrc, I could only define a clip for it and it will work 
>>>>> with the GES framework?
>>>>
>>>> GESTestClip does not need a specialized asset to represent it, so 
>>>> in that case we just use the standard GESAsset (not a subclass of 
>>>> it).
>>>>
>>>> Hoping that answers your questions.
>>>>
>>>> Regards,
>>>>
>>>> Thibault
>>>> _______________________________________________
>>>> gstreamer-devel mailing list
>>>> gstreamer-devel at lists.freedesktop.org
>>>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>>
>>>
>>> _______________________________________________
>>> gstreamer-devel mailing list
>>> gstreamer-devel at lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


------------------------------

Message: 4
Date: Mon, 09 Nov 2015 08:41:48 -0500
From: Nicolas Dufresne <nicolas.dufresne at collabora.com>
To: Discussion of the development of and with GStreamer
	<gstreamer-devel at lists.freedesktop.org>
Subject: Re: Question on passing a buffer larger than the pixel size
Message-ID: <1447076508.8372.8.camel at collabora.com>
Content-Type: text/plain; charset="utf-8"

Le lundi 09 novembre 2015 à 11:01 +0000, James Hughes a écrit :
> I have tried videobox, videoscale etc, but these all result in the 
> encoder encoding at 1088. Is there any way to use buffer sizes at
> 1088 but with actual image dimensions at 1080?

The encoder should implement a propose_allocation method, offering a pool (I guess GstVideoPool if none exist already) that is pre -configured with the required alignement (see GstVideoAlignement structure). Then on reception of buffers, it is requires to check the alignment of the buffer. This check can be tricky, you can check the GstMemory sizes, the GstVideoMeta offsets and figure-out if they are large enough, or you could check that the buffer is from a pool and read-back the alignment form there. The second method is not a catch all, but it's much easier to implement. If the alignment isn't correct, create an internal pool with the appropriate alignement and copy (see gst_video_frame_copy).

Nicolas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20151109/791be219/attachment-0001.sig>

------------------------------

Message: 5
Date: Mon, 9 Nov 2015 22:19:34 +0800
From: Guofeng Zhang <guofengzh at auslides.com>
To: Discussion of the development of and with GStreamer
	<gstreamer-devel at lists.freedesktop.org>
Subject: Re: Fixed several GES examples, but confused with GESAsset
	and GESClip
Message-ID: <5640AB76.9000400 at auslides.com>
Content-Type: text/plain; charset="utf-8"; Format="flowed"

see the attached.

note:
    1. It is 1.6.1 release
    2. for it to work, I merged your fix "5f81e64b596d3234406df75ccfde11009c422729" about ges_uri_clip_new().

On 2015/11/9 20:17, Thibault Saunier wrote:
> Hello,
>
> Please provide patches when you fix bugs in the examples :)
>
> Regards,
>
> Thibault
>
> On Mon, Nov 9, 2015 at 1:06 PM, Guofeng Zhang <guofengzh at auslides.com> wrote:
>> Thibault,
>>
>> Your are right, adding
>>      ges_timeline_commit (timeline);
>> before setting the pipepline to PLAYING solve it.
>>
>> Thanks very much for your help.
>>
>> Guofeng
>>
>>
>>
>> On 2015/11/9 4:28, Thibault Saunier wrote:
>>> Hello,
>>>
>>> GES will add testsrc for gaps yes. No idea why it would not work. 
>>> Make sure the timeline is commited in that example.
>>>
>>> Regards,
>>>
>>> Thibault
>>>
>>> On Sun, Nov 8, 2015 at 5:18 PM, Guofeng Zhang 
>>> <guofengzh at auslides.com>
>>> wrote:
>>>> Thibault
>>>>
>>>> For the simple1.c, If I change the value of the start property to a 
>>>> non-zero value, for example, 1 second, I heard nothing. If I reset 
>>>> its value to 0, it works as expected.
>>>>
>>>> Does this mean that I should make sure that there is not any gap in 
>>>> the timeline?  I think GES will use audiotestsrc for the audio gap, 
>>>> am I right?
>>>>
>>>> Thanks for your help.
>>>>
>>>> Guofeng
>>>>
>>>>
>>>> On 2015/10/30 18:14, Thibault Saunier wrote:
>>>>> Hello Guofeng,
>>>>>
>>>>>> test1.c worked well, it use:
>>>>>>       GESAsset *src_asset;
>>>>>>       ...
>>>>>>       src_asset = ges_asset_request (GES_TYPE_TEST_CLIP, NULL, 
>>>>>> NULL); to instantiate a GESTestClip.
>>>>>>
>>>>>> but test2.c and simple1.c does not work. They all use
>>>>>>       GESUriClip *src = ges_uri_clip_new (uri);
>>>>> I just fixed that with:
>>>>>
>>>>>        commit 5f81e64b596d3234406df75ccfde11009c422729
>>>>>        Author: Thibault Saunier <tsaunier at gnome.org>
>>>>>        Date:   Fri Oct 30 10:52:12 2015 +0100
>>>>>
>>>>>                uri-clip: Make sure to instantiate an asset to back 
>>>>> GESUriClip-s
>>>>>
>>>>>
>>>>>> I tried to use
>>>>>>       GESAsset *src = ges_asset_request (GES_TYPE_URI_CLIP, uri, 
>>>>>> NULL); but not succeeded.
>>>>>>
>>>>>> The comment for ges_asset_request() describes that I should use 
>>>>>> ges_uri_clip_asset_request_sync, so I made the following change:
>>>>>>       GESAsset *src = ges_uri_clip_asset_request_sync( uri, &error) ;
>>>>>>       ...
>>>>>>       ges_layer_add_asset (layer, src, offset, 0, 5 * GST_SECOND, 
>>>>>> GES_TRACK_TYPE_AUDIO); Now test2.c and simple1.c worked well.
>>>>> That is the correct way of doing it (GESUriClipAsset is a special 
>>>>> case as we concider in most cases it should be created async), we 
>>>>> still let the user create it synchronously with that helper.
>>>>>
>>>>>> What make me confused is
>>>>>> (1) ges_uri_clip_asset_request_sync() also use
>>>>>>       ges_asset_request (GES_TYPE_URI_CLIP, uri, &lerror) to 
>>>>>> instantiate the GESAsset, but it works (mine not), why?
>>>>> ges_uri_clip_asset_request_sync does ges_asset_request to check if 
>>>>> the media file has already been discovered in which case it just 
>>>>> uses the cached asset, in the case it is not it will go through a 
>>>>> particular mechanism of synchronous discovery.
>>>>>
>>>>>> (2) The GESTAsset and GESClip has one to one relationship, that 
>>>>>> is, as documented that assets will represent for example a 
>>>>>> GESUriClips, GESBaseEffect etc.
>>>>>> each clip has a asset associated with it. But GESTestClip has no 
>>>>>> GESTestClipAsset (something like it) defined, how could an asset 
>>>>>> existed for GESTestClip? or testsrc does not need a resource to 
>>>>>> represent it, so it does not need a corresponding asset? if so, 
>>>>>> for appsrc, I could only define a clip for it and it will work 
>>>>>> with the GES framework?
>>>>> GESTestClip does not need a specialized asset to represent it, so 
>>>>> in that case we just use the standard GESAsset (not a subclass of 
>>>>> it).
>>>>>
>>>>> Hoping that answers your questions.
>>>>>
>>>>> Regards,
>>>>>
>>>>> Thibault
>>>>> _______________________________________________
>>>>> gstreamer-devel mailing list
>>>>> gstreamer-devel at lists.freedesktop.org
>>>>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>>>
>>>> _______________________________________________
>>>> gstreamer-devel mailing list
>>>> gstreamer-devel at lists.freedesktop.org
>>>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>> _______________________________________________
>>> gstreamer-devel mailing list
>>> gstreamer-devel at lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

-------------- next part --------------
--- simple1.c	2015-10-22 16:09:39.000000000 +0800
+++ simple1-new.c	2015-11-09 22:11:07.688855568 +0800
@@ -95,6 +95,9 @@
     g_object_set (src, "start", 0, "in-point", inpoint * GST_SECOND,
         "duration", duration * GST_SECOND, "mute", mute, NULL);
     ges_layer_add_clip (layer1, GES_CLIP (src));
+
+    /* commit the timeline. it is required when the value of the start property is not 0 */
+    ges_timeline_commit (timeline);
   }
 
   /* Play the pipeline */

------------------------------

Subject: Digest Footer

_______________________________________________
gstreamer-devel mailing list
gstreamer-devel at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


------------------------------

End of gstreamer-devel Digest, Vol 58, Issue 16
***********************************************

______________________________________________________________________
DSP Group, Inc. automatically scans all emails and attachments using MessageLabs Email Security System.
_____________________________________________________________________

______________________________________________________________________
DSP Group, Inc. automatically scans all emails and attachments using MessageLabs Email Security System.
_____________________________________________________________________


More information about the gstreamer-devel mailing list