Page 1 of 1

Setting aspect ratio via command line

Posted: 20 Jun 2013 13:45
by earth
I am streaming an XviD MPEG4 variant rtsp stream to disk. The resulting file shows a display aspect ratio of 1.11111 (10:9) in the metadata when viewed with MediaInfo.

The command line docs suggest you can set the aspect ratio by an option but I'm having no joy with it:

vlc.exe rtsp://192.168.20.102:554/ch0_unicast_firststream --sout="#duplicate{dst=display, dst={std{access=file, mux=avi, dst='c:\users\rja\desktop\aspectratiotest.avi'}}}" --no-sout-audio --aspect-ratio=4:3

Any suggestions as to what is wrong there?



Thanks,
Richard

Re: Setting aspect ratio via command line

Posted: 24 Jun 2013 16:57
by Jean-Baptiste Kempf
Did you try to set the size directly in the transcode options?

Re: Setting aspect ratio via command line

Posted: 25 Jun 2013 14:19
by earth
I haven't tried that but I don't want to transcode anyway.

Am I right in thinking the display aspect ratio int he meta data is simply a description of the aspect ratio that the viewer should attempt to view the video in? By that I mean there is no change to make to the video data if the display aspect ratio is changed?

Re: Setting aspect ratio via command line

Posted: 27 Jun 2013 18:00
by earth
Did you try to set the size directly in the transcode options?

I've used transcode now as follows:

H:\>vlc.exe rtsp://192.168.20.102:554/ch0_unicast_firststream --aspect-ratio=1.333 --sout="#transcode{vcodec=mp4v, width=320, height=240}:duplicate{dst=display, dst={std{access=file, mux=avi, dst='C:\Users\rja\Desktop\aspectratiotest.avi'}}}
"

Two things changed there.

1. Moved --aspect-ratio to before --sout. I find the display window is now set to the correct aspect ratio and if I look at the metadata with MediaInfo while streaming then the display aspect ratio is set to 4:3 as I would like. However When the streaming to the file is stopped the display aspect ratio meta data is set to 1.1111 (10:9) which is the aspect ratio of the source.

2. Added the transcode option set the horistontal and vertical resolution to what I want. The meta data in the file shows this resolution and when played from Window Media Player it appears as the correct aspect ratio but playing the file in VLC player results in the wrong ratio. I think this is because WMP ignores the display aspect ratio setting in the meta data and vlc does not. As I mentioned above the display aspect ratio is set incorrectly when the stream is closed.

Re: Setting aspect ratio via command line

Posted: 27 Jun 2013 18:01
by earth
The other thing is transcoding greatly lowers the video quality.

Re: Setting aspect ratio via command line

Posted: 17 Dec 2019 14:17
by OzzWizard
Did you try to set the size directly in the transcode options?

I've used transcode now as follows:

H:\>vlc.exe rtsp://192.168.20.102:554/ch0_unicast_firststream --aspect-ratio=1.333 --sout="#transcode{vcodec=mp4v, width=320, height=240}:duplicate{dst=display, dst={std{access=file, mux=avi, dst='C:\Users\rja\Desktop\aspectratiotest.avi'}}}
"

Two things changed there.

1. Moved --aspect-ratio to before --sout. I find the display window is now set to the correct aspect ratio and if I look at the metadata with MediaInfo while streaming then the display aspect ratio is set to 4:3 as I would like. However When the streaming to the file is stopped the display aspect ratio meta data is set to 1.1111 (10:9) which is the aspect ratio of the source.

2. Added the transcode option set the horistontal and vertical resolution to what I want. The meta data in the file shows this resolution and when played from Window Media Player it appears as the correct aspect ratio but playing the file in VLC player results in the wrong ratio. I think this is because WMP ignores the display aspect ratio setting in the meta data and vlc does not. As I mentioned above the display aspect ratio is set incorrectly when the stream is closed.
Rly thanks a lot bro. I opened an account to thank you.