Page 1 of 1

Wrong aspect ratio when transcoding video

Posted: 22 May 2009 14:04
by flyowynd
Hi

I tried to transcode and stream an h.264 udp stream using lower bitrate and half resolution using windows version of vlc 1.0-rc1.
Apparently there's a problem with the aspect ratio of the output stream even if I correctly set output heigth and width.

When I capture the output stream and use a video analyzer I've got this:

video stream type : AVC
resolution : 544x576
profile:level : Main:5.1
aspect ratio :136x37(Extended_SAR(52751:13600))
chroma format : 4:2:0
interlaced : no

136*37 value seems to be the problem.

In my case if I try to play the stream (or playing it localy) using another vlc I've got an elongated windows. If I force aspect ratio when playing it's ok but that's not a solution.

I use the GUI to transcode my stream with the following options:

:sout=#transcode{vcodec=h264,vb=800,fps=25,scale=0.5,acodec=mp4a,ab=96,channels=2,samplerate=11250}:display

It does the same with the following:

:sout=#transcode{vcodec=h264,vb=800,fps=25,scale=1,width=544,height=576,acodec=mp4a,ab=96,channels=2,samplerate=11250}:display

or

:sout=#transcode{vcodec=h264,vb=800,fps=25,width=272,height=288,acodec=mp4a,ab=96,channels=2,samplerate=11250}:display

Do you have any idea?

Thanks.

Re: Wrong aspect ratio when transcoding video

Posted: 22 May 2009 16:49
by VLC_help
Maybe you should set the width width=resolution*aspect ratio. Anamorphic stuff is usually problematic, so always encode as PAR 1:1 if possible.

Re: Wrong aspect ratio when transcoding video

Posted: 22 May 2009 17:16
by flyowynd
It's not really better when I try something like 320*240

I've got this video:

video stream type : AVC
resolution : 320x240
profile:level : Main:5.1
aspect ratio :320x87(Extended_SAR(52751:19200))
chroma format : 4:2:0
interlaced : no

with this command line:

:sout=#transcode{vcodec=h264,vb=800,fps=25,width=320,height=240,acodec=mp4a,ab=96,channels=2,samplerate=11250}:display

Re: Wrong aspect ratio when transcoding video

Posted: 23 May 2009 15:09
by VLC_help
You can try Yamb fixing the aspect ratio.
http://www.walterdevos.be/2008/10/24/fi ... quicktime/

Re: Wrong aspect ratio when transcoding video

Posted: 26 May 2009 13:20
by flyowynd
yep but at the end I wanna stream to MPEG-TS, not creating a file. Yamb seems not able to do that.
That's why VLC was so useful for me.

Re: Wrong aspect ratio when transcoding video

Posted: 26 May 2009 15:06
by VLC_help
Sorry, I misunderstood you. You have some sample video I could use to replicate this issue?

Re: Wrong aspect ratio when transcoding video

Posted: 27 May 2009 19:09
by flyowynd
No problem :D

I've created a rar file (~10Meg) and it's available on megaupload at this address: http://www.megaupload.com/?d=J18NBAHS

In this file you have the original stream (H.264, 544*576, aspect ratio 1055*576) and two different transcoded stream.

In first one I used this line to trancode:

:sout=#transcode{vcodec=h264,vb=800,scale=1,acodec=mp4a,ab=96,channels=2,samplerate=11250}:std{access=file,mux=ts,dst=c:\\test.ts}

For the second one id nearly the same, just half res:

:sout=#transcode{vcodec=h264,vb=800,scale=0.5,acodec=mp4a,ab=96,channels=2,samplerate=11250}:std{access=file,mux=ts,dst=c:\\test.ts}

I hope it could help you to find the problem.

But what I found is that aspect ratio when transcoded is always 136*37.

Re: Wrong aspect ratio when transcoding video

Posted: 28 May 2009 20:39
by VLC_help
Thanks. Confirmed. Trac ticket opened
http://trac.videolan.org/vlc/ticket/2793

Re: Wrong aspect ratio when transcoding video

Posted: 12 Oct 2009 20:14
by nereikianieko
I can't believe my eyes this ticket type changed from defect to enhancement . This is real bug.

Re: Wrong aspect ratio when transcoding video

Posted: 13 Oct 2009 07:37
by mphilip876
I have visited the links bt didn't get anything worthy...

Re: Wrong aspect ratio when transcoding video

Posted: 13 Oct 2009 16:59
by VLC_help
mphilip876: issue isn't fixed.

Re: Wrong aspect ratio when transcoding video

Posted: 05 Nov 2009 10:36
by nereikianieko
Is any way to pay to someone to get this corrected?

Re: Wrong aspect ratio when transcoding video

Posted: 05 Nov 2009 18:19
by VLC_help
Yep. Post your request to http://mailman.videolan.org/listinfo/vlc-devel and someone might fix this, if you offer money.

Re: Wrong aspect ratio when transcoding video

Posted: 17 Dec 2009 13:07
by vice
Ummm.. I've observed this same issue BUT not using the transcoding.

Let me explain.

I connect to a transport stream with a H264 encoded video and stream it out by RTP without transport stream and without transcoding. Only changing is transmission system (and by the way the network, but that's another history). When I connect to this VLC stream out, I observed the aspect ratio is incorrect.

I do a lot of tests, and found that the resolution is correct but aspect ratio information and correction is incorrect. I'm not shure because this was long time ago but it could be like applying two times the correct correction.

More detailed information:

Original source:
H264 video inside a UDP transport stream. Resolution: D1 PAL (720 × 576) a resolution (with non-squared pixels) so for displaying in common TFT displays it needs aspect rate correction to have a 768 x 576 resolution. A perfect 4:3 proportion with square pixels.

VLC media player connects to this stream and stream it with #rtp stream out module without transcoding or anything else. It's send exactly the same H264 video information but with a diferrent transport.

But the client render the video widther than it should be. It seems that the aspect ratio correction is applied twice.

Why I haven't posted about it? Because I've solved simply by forcing the aspect ratio to 4:3 on the client side.

I hopes this helps to locate the problem. And for users to have a simple workaround.

Best regards,
vicente

Re: Wrong aspect ratio when transcoding video

Posted: 21 Dec 2009 08:48
by nereikianieko
@VLC_help
Dear VLC_help, have you seen mine message in this list? I've tried to subscribe and have posted twice about asking to fix this, also offering money (50 - 100 $ - is this enough?) , but seems like message even didn't apear in this message list.
Maybe you can post it? I can send you message by PM or post it here.

@vice
We all know, that we can fix this forcing aspect ratio in client side, but this is so primitive and the worst - problem still remains. There are many situasions, there this "fix" will not work, as VLC is used to stream not only VLC-to-VLC, but also to many other clients, there simply forcing correct aspect is not possible.

Re: Wrong aspect ratio when transcoding video

Posted: 21 Dec 2009 17:07
by VLC_help
nereikianieko: unfortunately I won't represent anyone else in mailing list in that way. But I can try to help you with vlc-devel issues you are having.

Re: Wrong aspect ratio when transcoding video

Posted: 26 Dec 2009 18:45
by ILEoo
This should be fixed in head (upcoming 1.1) you can try nightly build tomorrow to check if it works for you.

Re: Wrong aspect ratio when transcoding video

Posted: 19 Apr 2010 01:31
by vice
I was just adding more information to try to track the problem.

And, yes, keep aspect ratio is just a simple workaround for (maybe) only VLC media player as client :)

Re: Wrong aspect ratio when transcoding video

Posted: 15 Jan 2013 02:31
by xfgxie
This should be fixed in head (upcoming 1.1) you can try nightly build tomorrow to check if it works for you.
I still seem to have this problem. I am using 1.1.11. Has this bug been really fixed? Thanks.

Re: Wrong aspect ratio when transcoding video

Posted: 15 Jan 2013 18:02
by Jean-Baptiste Kempf
Don't wake up 3 years old threads, please.