Change aspect ratio without transcoding?

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

Change aspect ratio without transcoding?

Martijn Grendelman
Hi,

I have a feeling that I'm on the wrong track here, but I'm going to ask
anyway.

I have a MPEG-TS, containing H.264 video, in 4:3 aspect ratio. I'd like to
stretch the video to 16:9. Is that possible without transcoding, perhaps
by only remuxing?

Best regards,
Martijn Grendelman
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

AW: Change aspect ratio without transcoding?

BGraaf
Hi Martijn,

which sink-object you are using? Xvimagesink has a parameter for that

g_object_set (G_OBJECT (sinkobjectname), "force-aspect-ratio", 1, NULL);

BR
Bernhard

-----Ursprüngliche Nachricht-----
Von: gstreamer-devel-bounces+bernhard.graaf=[hidden email]
[mailto:gstreamer-devel-bounces+bernhard.graaf=[hidden email]]
Im Auftrag von Martijn Grendelman
Gesendet: Mittwoch, 4. April 2012 10:21
An: [hidden email]
Betreff: Change aspect ratio without transcoding?

Hi,

I have a feeling that I'm on the wrong track here, but I'm going to ask
anyway.

I have a MPEG-TS, containing H.264 video, in 4:3 aspect ratio. I'd like to
stretch the video to 16:9. Is that possible without transcoding, perhaps
by only remuxing?

Best regards,
Martijn Grendelman
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

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

Re: AW: Change aspect ratio without transcoding?

Martijn Grendelman
Hi,

> which sink-object you are using? Xvimagesink has a parameter for that
>
> g_object_set (G_OBJECT (sinkobjectname), "force-aspect-ratio", 1, NULL);

Ah, sorry, I should have mentioned that. We don't actually play the video
with Gstreamer. We're using a tcpserversink to serve the stream to our
distribution network.

I'd like the AR of the video to be 16:9 before that. Unfortunately, the
input (an analog-to-h.264 encoder) only supports 4:3 for the available
signal, even though the source is 16:9.

Best regards,
Martijn Grendelman





>
> -----Ursprüngliche Nachricht-----
> Von: gstreamer-devel-bounces+bernhard.graaf=[hidden email]
> [mailto:gstreamer-devel-bounces+bernhard.graaf=[hidden email]]
> Im Auftrag von Martijn Grendelman
> Gesendet: Mittwoch, 4. April 2012 10:21
> An: [hidden email]
> Betreff: Change aspect ratio without transcoding?
>
> Hi,
>
> I have a feeling that I'm on the wrong track here, but I'm going to ask
> anyway.
>
> I have a MPEG-TS, containing H.264 video, in 4:3 aspect ratio. I'd like to
> stretch the video to 16:9. Is that possible without transcoding, perhaps
> by only remuxing?
>
> Best regards,
> Martijn Grendelman
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>

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

AW: AW: Change aspect ratio without transcoding?

BGraaf
Hi Martijn,

have you tried something like 'videoscale'? I've never used this element
before, but it's seems to help for fixing your problem.
In other case you should decode/encode the stream into the needed format.
Sorry.....


-----Ursprüngliche Nachricht-----
Von: gstreamer-devel-bounces+bernhard.graaf=[hidden email]
[mailto:gstreamer-devel-bounces+bernhard.graaf=[hidden email]]
Im Auftrag von Martijn Grendelman
Gesendet: Mittwoch, 4. April 2012 12:41
An: [hidden email]
Betreff: Re: AW: Change aspect ratio without transcoding?

Hi,

> which sink-object you are using? Xvimagesink has a parameter for that
>
> g_object_set (G_OBJECT (sinkobjectname), "force-aspect-ratio", 1, NULL);

Ah, sorry, I should have mentioned that. We don't actually play the video
with Gstreamer. We're using a tcpserversink to serve the stream to our
distribution network.

I'd like the AR of the video to be 16:9 before that. Unfortunately, the
input (an analog-to-h.264 encoder) only supports 4:3 for the available
signal, even though the source is 16:9.

Best regards,
Martijn Grendelman





>
> -----Ursprüngliche Nachricht-----
> Von: gstreamer-devel-bounces+bernhard.graaf=[hidden email]
>
[mailto:gstreamer-devel-bounces+bernhard.graaf=[hidden email]]

> Im Auftrag von Martijn Grendelman
> Gesendet: Mittwoch, 4. April 2012 10:21
> An: [hidden email]
> Betreff: Change aspect ratio without transcoding?
>
> Hi,
>
> I have a feeling that I'm on the wrong track here, but I'm going to ask
> anyway.
>
> I have a MPEG-TS, containing H.264 video, in 4:3 aspect ratio. I'd like to
> stretch the video to 16:9. Is that possible without transcoding, perhaps
> by only remuxing?
>
> Best regards,
> Martijn Grendelman
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>

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

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

Re: AW: AW: Change aspect ratio without transcoding?

Martijn Grendelman
On 04-04-12 13:11, Bernhard Graaf wrote:
> have you tried something like 'videoscale'? I've never used this element
> before, but it's seems to help for fixing your problem.
> In other case you should decode/encode the stream into the needed format.
> Sorry.....

Well, videoscale obviously should do the trick, except that it only works
on raw video, meaning I have to transcode.

What I am looking for, is a way to change (overwrite) certain bits in a
transport stream. More specific: the aspect ratio of the video is present
in the sequence header of the PES payload packets of the video stream, I
have been told.

So, I wonder if that can be manipulated without demuxing the stream. I
assume no such functionality is present in Gstreamer. Unfortunately, this
is all I know about the matter, and I just barely understand myself what I
wrote here, so I guess I'm stuck ;-) Thanks.

Best regards,
Martijn Grendelman









> -----Ursprüngliche Nachricht-----
> Von: gstreamer-devel-bounces+bernhard.graaf=[hidden email]
> [mailto:gstreamer-devel-bounces+bernhard.graaf=[hidden email]]
> Im Auftrag von Martijn Grendelman
> Gesendet: Mittwoch, 4. April 2012 12:41
> An: [hidden email]
> Betreff: Re: AW: Change aspect ratio without transcoding?
>
> Hi,
>
>> which sink-object you are using? Xvimagesink has a parameter for that
>>
>> g_object_set (G_OBJECT (sinkobjectname), "force-aspect-ratio", 1, NULL);
>
> Ah, sorry, I should have mentioned that. We don't actually play the video
> with Gstreamer. We're using a tcpserversink to serve the stream to our
> distribution network.
>
> I'd like the AR of the video to be 16:9 before that. Unfortunately, the
> input (an analog-to-h.264 encoder) only supports 4:3 for the available
> signal, even though the source is 16:9.
>
> Best regards,
> Martijn Grendelman
>
>
>
>
>
>>
>> -----Ursprüngliche Nachricht-----
>> Von: gstreamer-devel-bounces+bernhard.graaf=[hidden email]
>>
> [mailto:gstreamer-devel-bounces+bernhard.graaf=[hidden email]]
>> Im Auftrag von Martijn Grendelman
>> Gesendet: Mittwoch, 4. April 2012 10:21
>> An: [hidden email]
>> Betreff: Change aspect ratio without transcoding?
>>
>> Hi,
>>
>> I have a feeling that I'm on the wrong track here, but I'm going to ask
>> anyway.
>>
>> I have a MPEG-TS, containing H.264 video, in 4:3 aspect ratio. I'd like to
>> stretch the video to 16:9. Is that possible without transcoding, perhaps
>> by only remuxing?
>>
>> Best regards,
>> Martijn Grendelman
>> _______________________________________________
>> gstreamer-devel mailing list
>> [hidden email]
>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>
>> _______________________________________________
>> gstreamer-devel mailing list
>> [hidden email]
>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>

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

AW: AW: AW: Change aspect ratio without transcoding?

BGraaf
Yes, you are right. You need to decode (f.e. decodebin2) at first, before
using videoscale.
It is possible to change the 'aspect ratio' on client side?

-----Ursprüngliche Nachricht-----
Von: gstreamer-devel-bounces+bernhard.graaf=[hidden email]
[mailto:gstreamer-devel-bounces+bernhard.graaf=[hidden email]]
Im Auftrag von Martijn Grendelman
Gesendet: Mittwoch, 4. April 2012 14:02
An: [hidden email]
Betreff: Re: AW: AW: Change aspect ratio without transcoding?

On 04-04-12 13:11, Bernhard Graaf wrote:
> have you tried something like 'videoscale'? I've never used this element
> before, but it's seems to help for fixing your problem.
> In other case you should decode/encode the stream into the needed format.
> Sorry.....

Well, videoscale obviously should do the trick, except that it only works
on raw video, meaning I have to transcode.

What I am looking for, is a way to change (overwrite) certain bits in a
transport stream. More specific: the aspect ratio of the video is present
in the sequence header of the PES payload packets of the video stream, I
have been told.

So, I wonder if that can be manipulated without demuxing the stream. I
assume no such functionality is present in Gstreamer. Unfortunately, this
is all I know about the matter, and I just barely understand myself what I
wrote here, so I guess I'm stuck ;-) Thanks.

Best regards,
Martijn Grendelman









> -----Ursprüngliche Nachricht-----
> Von: gstreamer-devel-bounces+bernhard.graaf=[hidden email]
>
[mailto:gstreamer-devel-bounces+bernhard.graaf=[hidden email]]

> Im Auftrag von Martijn Grendelman
> Gesendet: Mittwoch, 4. April 2012 12:41
> An: [hidden email]
> Betreff: Re: AW: Change aspect ratio without transcoding?
>
> Hi,
>
>> which sink-object you are using? Xvimagesink has a parameter for that
>>
>> g_object_set (G_OBJECT (sinkobjectname), "force-aspect-ratio", 1, NULL);
>
> Ah, sorry, I should have mentioned that. We don't actually play the video
> with Gstreamer. We're using a tcpserversink to serve the stream to our
> distribution network.
>
> I'd like the AR of the video to be 16:9 before that. Unfortunately, the
> input (an analog-to-h.264 encoder) only supports 4:3 for the available
> signal, even though the source is 16:9.
>
> Best regards,
> Martijn Grendelman
>
>
>
>
>
>>
>> -----Ursprüngliche Nachricht-----
>> Von: gstreamer-devel-bounces+bernhard.graaf=[hidden email]
>>
>
[mailto:gstreamer-devel-bounces+bernhard.graaf=[hidden email]]

>> Im Auftrag von Martijn Grendelman
>> Gesendet: Mittwoch, 4. April 2012 10:21
>> An: [hidden email]
>> Betreff: Change aspect ratio without transcoding?
>>
>> Hi,
>>
>> I have a feeling that I'm on the wrong track here, but I'm going to ask
>> anyway.
>>
>> I have a MPEG-TS, containing H.264 video, in 4:3 aspect ratio. I'd like
to

>> stretch the video to 16:9. Is that possible without transcoding, perhaps
>> by only remuxing?
>>
>> Best regards,
>> Martijn Grendelman
>> _______________________________________________
>> gstreamer-devel mailing list
>> [hidden email]
>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>
>> _______________________________________________
>> gstreamer-devel mailing list
>> [hidden email]
>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>

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

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

Re: AW: AW: AW: Change aspect ratio without transcoding?

Martijn Grendelman
On 04-04-12 14:58, Bernhard Graaf wrote:
> Yes, you are right. You need to decode (f.e. decodebin2) at first, before
> using videoscale.
> It is possible to change the 'aspect ratio' on client side?

Ultimately, the video will be displayed on a normal TV, so stretching the
image there (or even on the set-top box in front of it) will certainly
work. However, that requires the viewer's intervention, which is what I'm
trying to prevent.

Thanks,
Martijn.




>
> -----Ursprüngliche Nachricht-----
> Von: gstreamer-devel-bounces+bernhard.graaf=[hidden email]
> [mailto:gstreamer-devel-bounces+bernhard.graaf=[hidden email]]
> Im Auftrag von Martijn Grendelman
> Gesendet: Mittwoch, 4. April 2012 14:02
> An: [hidden email]
> Betreff: Re: AW: AW: Change aspect ratio without transcoding?
>
> On 04-04-12 13:11, Bernhard Graaf wrote:
>> have you tried something like 'videoscale'? I've never used this element
>> before, but it's seems to help for fixing your problem.
>> In other case you should decode/encode the stream into the needed format.
>> Sorry.....
>
> Well, videoscale obviously should do the trick, except that it only works
> on raw video, meaning I have to transcode.
>
> What I am looking for, is a way to change (overwrite) certain bits in a
> transport stream. More specific: the aspect ratio of the video is present
> in the sequence header of the PES payload packets of the video stream, I
> have been told.
>
> So, I wonder if that can be manipulated without demuxing the stream. I
> assume no such functionality is present in Gstreamer. Unfortunately, this
> is all I know about the matter, and I just barely understand myself what I
> wrote here, so I guess I'm stuck ;-) Thanks.
>
> Best regards,
> Martijn Grendelman
>
>
>
>
>
>
>
>
>
>> -----Ursprüngliche Nachricht-----
>> Von: gstreamer-devel-bounces+bernhard.graaf=[hidden email]
>>
> [mailto:gstreamer-devel-bounces+bernhard.graaf=[hidden email]]
>> Im Auftrag von Martijn Grendelman
>> Gesendet: Mittwoch, 4. April 2012 12:41
>> An: [hidden email]
>> Betreff: Re: AW: Change aspect ratio without transcoding?
>>
>> Hi,
>>
>>> which sink-object you are using? Xvimagesink has a parameter for that
>>>
>>> g_object_set (G_OBJECT (sinkobjectname), "force-aspect-ratio", 1, NULL);
>>
>> Ah, sorry, I should have mentioned that. We don't actually play the video
>> with Gstreamer. We're using a tcpserversink to serve the stream to our
>> distribution network.
>>
>> I'd like the AR of the video to be 16:9 before that. Unfortunately, the
>> input (an analog-to-h.264 encoder) only supports 4:3 for the available
>> signal, even though the source is 16:9.
>>
>> Best regards,
>> Martijn Grendelman
>>
>>
>>
>>
>>
>>>
>>> -----Ursprüngliche Nachricht-----
>>> Von: gstreamer-devel-bounces+bernhard.graaf=[hidden email]
>>>
>>
> [mailto:gstreamer-devel-bounces+bernhard.graaf=[hidden email]]
>>> Im Auftrag von Martijn Grendelman
>>> Gesendet: Mittwoch, 4. April 2012 10:21
>>> An: [hidden email]
>>> Betreff: Change aspect ratio without transcoding?
>>>
>>> Hi,
>>>
>>> I have a feeling that I'm on the wrong track here, but I'm going to ask
>>> anyway.
>>>
>>> I have a MPEG-TS, containing H.264 video, in 4:3 aspect ratio. I'd like
> to
>>> stretch the video to 16:9. Is that possible without transcoding, perhaps
>>> by only remuxing?
>>>
>>> Best regards,
>>> Martijn Grendelman
>>> _______________________________________________
>>> gstreamer-devel mailing list
>>> [hidden email]
>>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>>
>>> _______________________________________________
>>> gstreamer-devel mailing list
>>> [hidden email]
>>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>>
>>
>> _______________________________________________
>> gstreamer-devel mailing list
>> [hidden email]
>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>
>> _______________________________________________
>> gstreamer-devel mailing list
>> [hidden email]
>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>

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

Re: Change aspect ratio without transcoding?

Luciana Fujii Pontello-2
In reply to this post by Martijn Grendelman
On Wed, 2012-04-04 at 10:21 +0200, Martijn Grendelman wrote:
> Hi,
>
> I have a feeling that I'm on the wrong track here, but I'm going to ask
> anyway.
>
> I have a MPEG-TS, containing H.264 video, in 4:3 aspect ratio. I'd like to
> stretch the video to 16:9. Is that possible without transcoding, perhaps
> by only remuxing?

Hi, I don't know of any element that could do that on encoded video, but
you could make an element yourself that only changes the
pixel-aspect-ratio.

Regards,

Luciana Fujii

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

Re: Change aspect ratio without transcoding?

Martijn Grendelman
On 10-04-12 03:06, Luciana Fujii wrote:

> On Wed, 2012-04-04 at 10:21 +0200, Martijn Grendelman wrote:
>> Hi,
>>
>> I have a feeling that I'm on the wrong track here, but I'm going to ask
>> anyway.
>>
>> I have a MPEG-TS, containing H.264 video, in 4:3 aspect ratio. I'd like to
>> stretch the video to 16:9. Is that possible without transcoding, perhaps
>> by only remuxing?
>
> Hi, I don't know of any element that could do that on encoded video, but
> you could make an element yourself that only changes the
> pixel-aspect-ratio.

Yes, I have been researching a way to do this.

Using the information from [1], I should theoretically be able to replace
(using some for of 'binary sed') a certain byte sequence in the stream to
get what I want. The problem was, that I haven't been able to find the
sequence header ('000001B3') in the stream I was working on, so I gave it up.

Thanks.

[1] http://dvd.sourceforge.net/dvdinfo/mpeghdrs.html

Best regards,
Martijn Grendelman
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: [gmail] Re: Change aspect ratio without transcoding?

Marc Leeman
> >> I have a feeling that I'm on the wrong track here, but I'm going to ask

> >> anyway.
> >>
> >> I have a MPEG-TS, containing H.264 video, in 4:3 aspect ratio. I'd like to
> >> stretch the video to 16:9. Is that possible without transcoding, perhaps
> >> by only remuxing?
> >
> > Hi, I don't know of any element that could do that on encoded video, but
> > you could make an element yourself that only changes the
> > pixel-aspect-ratio.
>
> Yes, I have been researching a way to do this.
>
> Using the information from [1], I should theoretically be able to replace
> (using some for of 'binary sed') a certain byte sequence in the stream to
> get what I want. The problem was, that I haven't been able to find the
> sequence header ('000001B3') in the stream I was working on, so I gave it up.
>
> Thanks.
>
> [1] http://dvd.sourceforge.net/dvdinfo/mpeghdrs.html
Looks like something that could be appended to the parser; that one
should search for the correct headers.

It might be that your stream was not properly formatted, in some cases,
the parser corrects this.


--
  greetz, marc
harvey 2.6.29.1 #1 PREEMPT Mon Apr 6 22:33:31 CDT 2009 GNU/Linux

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

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

Re: [gmail] Re: Change aspect ratio without transcoding?

Martijn Grendelman
On 10-04-12 10:50, Marc Leeman wrote:

>>>> I have a feeling that I'm on the wrong track here, but I'm going to ask
>>>> anyway.
>>>>
>>>> I have a MPEG-TS, containing H.264 video, in 4:3 aspect ratio. I'd like to
>>>> stretch the video to 16:9. Is that possible without transcoding, perhaps
>>>> by only remuxing?
>>>
>>> Hi, I don't know of any element that could do that on encoded video, but
>>> you could make an element yourself that only changes the
>>> pixel-aspect-ratio.
>>
>> Yes, I have been researching a way to do this.
>>
>> Using the information from [1], I should theoretically be able to replace
>> (using some for of 'binary sed') a certain byte sequence in the stream to
>> get what I want. The problem was, that I haven't been able to find the
>> sequence header ('000001B3') in the stream I was working on, so I gave it up.
>>
>> Thanks.
>>
>> [1] http://dvd.sourceforge.net/dvdinfo/mpeghdrs.html
>
> Looks like something that could be appended to the parser; that one
> should search for the correct headers.
>
> It might be that your stream was not properly formatted, in some cases,
> the parser corrects this.

Another thing is, that I am not a C programmer, so writing my own or
adapting an existing plugin would not be doable for me.

If someone else want to see how feasable this would be, what I was trying
to do was the following:

- find a sequence header, identified by 000001B3 byte sequence
- within the sequence header, change the 4th byte. The highest 4 bits
represent the aspect ratio, where value of '2' means '4:3' and '3' means
'16:9'.

Best regards,
Martijn Grendelman

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