transcode aspect-ratio doesn't work with H264

About encoding, codec settings, muxers and filter usage
xfgxie
New Cone
New Cone
Posts: 3
Joined: 14 Jan 2013 22:51

transcode aspect-ratio doesn't work with H264

Postby xfgxie » 15 Jan 2013 19:49

I am using vlc windows command line to transcode video to change the aspect ratio. My source video resolution is 352x480, codec: MPEG-4 (mp4v)

The command line I use is:
vlc c:\SourceVideo.ts :sout=#transcode{vcodec=mpgv,vb=256,width=320,height=240,canvas-width=320,canvas-height=240,canvas-aspect=4:3,fps=25}:std{access=file,mux=ts,dst="C:\Test.ts"}

I can use this command line above to successfully change the video to 320x240. But if I change the vcodec=h264, the converted video seems like is 320x480 which keeps the original aspect-ratio. The interesting thing is that its Codec details shown in VLC player is Codec: H264 - MPEG-4 AVC (part 10) (h264), Resolution: 320x240.

The snapshots I take from these videos are:
Orignial video: although the resolution is 352x480, but the snapshots pixel is 352x528
http://bugatti.nvfast.org/vlcsnap-original.png

transcoded using vcodec=mpgv, snapshot pixel is 320x240, which is what I want.
http://bugatti.nvfast.org/vlcsnap-transcoded-mpgv.png

transcoded using vcodec=h264, snapshot pixel is 320x480. I need 320x240, this is not what I want.
http://bugatti.nvfast.org/vlcsnap-transcoded-h264.png

Please, someone can give me a hint to figure this out. It seems vcodec=h264 is not working correctly to change the aspect-ratio. I have to use h264 because I transcode my video for apple HLS streaming. Thanks.

xfgxie
New Cone
New Cone
Posts: 3
Joined: 14 Jan 2013 22:51

Re: transcode aspect-ratio doesn't work with H264

Postby xfgxie » 15 Jan 2013 20:26

If I add "venc=x264{profile=baseline,level=30,keyint=30,ref=1}" in the transcode options, the command line is:

vlc c:\SourceVideo.ts :sout=#transcode{vcodec=mpgv,vb=256,width=320,height=240,canvas-width=320,canvas-height=240,canvas-aspect=4:3,fps=25,venc=x264{profile=baseline,level=30,keyint=30,ref=1}}:std{access=file,mux=ts,dst="C:\Test.ts"}

Now the vcodec=mpgv doesn't change the aspect-ratio. Is there any conflict? Thanks.

recocnize
New Cone
New Cone
Posts: 3
Joined: 07 Jan 2013 05:28

Re: transcode aspect-ratio doesn't work with H264

Postby recocnize » 19 Jan 2013 01:56

will this alone not work for you?

vfilter=canvas{width=320,height=240,aspect=4:3}

This should set your aspect. There are padd and crop filters too. make sure to enable them in your video filters and encode filters.

Also try running your settings from the user interface. At the end of that process it should have a usable encode string for you.
Don't quote me but most people dont suggest using both a vfilter and height and width. You should try to do this with the filters.

Chadnaut
New Cone
New Cone
Posts: 5
Joined: 20 Sep 2013 11:37

Re: transcode aspect-ratio doesn't work with H264

Postby Chadnaut » 20 Sep 2013 16:04



Return to “VLC stream-output (sout)”

Who is online

Users browsing this forum: No registered users and 16 guests