Cropping and Scaling

About encoding, codec settings, muxers and filter usage
forzaphil
New Cone
New Cone
Posts: 8
Joined: 06 Nov 2009 20:07

Cropping and Scaling

Postby forzaphil » 14 Nov 2009 13:38

I'm trying to crop a video and then scale it to a smaller size, but I can't figure out the command line for doing this. I've read the help file about crop-geometry but still can't figure it out.

If I have an input video that's say 640 x 480, and I want to crop 80 pixels off left and right and then scale it down to 320 x 320, can anyone tell me what the command line should be?

Thanks

Phil

kdh
Cone that earned his stripes
Cone that earned his stripes
Posts: 224
Joined: 16 Jun 2009 22:38

Re: Cropping and Scaling

Postby kdh » 15 Nov 2009 03:00

Hmm...

To crop the 80 pixels off the left and right, use the crop vide filter.. search from "crop" in this file: http://wiki.videolan.org/VLC_command-line_help

then the size you'd need to add height and width to the transcode part of your stream. Maybe crop to the sfilter argument as well. Not sure.

Here is a rought example, not sure if it would work, but it should get you started

vlc -vvv INPUTFILE.mpg --global-key-crop-left=80 --global-key-crop-right=80 --sout '#transcode{vcodec=mp2v,height=320,width=320,fps=30,acodec=
mp3,vb=160,ab=96,sfilter=crop}:std{access=file,mux=ts,dst=outputfile.mpg}'

Again, i didn't test the above so I'm not sure if it works.. but it should give you an idea of where to go next. best of luck and post how you got it to work. =)

forzaphil
New Cone
New Cone
Posts: 8
Joined: 06 Nov 2009 20:07

Re: Cropping and Scaling

Postby forzaphil » 15 Nov 2009 13:54

Thanks kdh, I will try that. In the tests I've been doing I've been trying to crop and scale at the same time as part of the transcode process. Splitting it out as you have seems more logical.

forzaphil
New Cone
New Cone
Posts: 8
Joined: 06 Nov 2009 20:07

Re: Cropping and Scaling

Postby forzaphil » 23 Nov 2009 23:07

Just a quick update on this. So far no more luck. I tried the following command line:

Code: Select all

/Applications/VLC.app/Contents/MacOS/VLC -vvv -I dummy "/Users/me/desktop/trenchrun.m4v" --global-key-crop-left=80 --global-key-crop-right=80 --sout '#transcode{vcodec=h264,vb=400,fps=25,height=270,width=345,sfilter=crop}:std{access=file,mux=mp4,dst=trenchrun.mp4}'
but immediately got an initialisation error

Code: Select all

vlc: unknown option or missing mandatory argument `--global-key-crop-left=80'
The command line help is quite thorough in listing options, but its short on examples so its difficult to come up with the correct command line just by looking at the help options. I still think that this is a step in the right direction, it may just be a syntax problem with the global option.

For the record, I also tried to run the crop video filter before the transcode with the following

Code: Select all

/Applications/VLC.app/Contents/MacOS/VLC -vvv -I dummy "/Users/me/desktop/trenchrun.m4v" --crop-geometry="270 x 345 + 80 + 80" --sout '#transcode{vcodec=h264,vb=400,fps=25}:std{access=file,mux=mp4,dst=trenchrun.mp4}'
but that gives me

Code: Select all

Warning: missing argument for option --sout
and I can't figure out why.

So I'm still stuck. Any ideas?

forzaphil
New Cone
New Cone
Posts: 8
Joined: 06 Nov 2009 20:07

Re: Cropping and Scaling

Postby forzaphil » 24 Nov 2009 17:03

To add to my previous post I've also tried

Code: Select all

/Applications/VLC.app/Contents/MacOS/VLC -vvv -I dummy "/Users/me/desktop/trenchrun.m4v" --sout="#transcode{vcodec=h264,vb=400,fps=25,cropleft=80,cropright=80,height=270,width=345}:standard{access=file,mux=mp4,dst=trenchrun.mp4}"
which uses the cropleft and cropright options shown in the command line help, but I get

Code: Select all

[0x282a08] main stream out warning: option cropleft is unknown [0x282a08] main stream out warning: option cropright is unknown
If anyone knows a way of cropping while transcoding please jump in!

BTW I'm using v1.0.3 for Mac.

kdh
Cone that earned his stripes
Cone that earned his stripes
Posts: 224
Joined: 16 Jun 2009 22:38

Re: Cropping and Scaling

Postby kdh » 24 Nov 2009 19:55

I did a search for crop and found this:

http://wiki.videolan.org/Transcode

and did a for crop, towards the bottom I found a little bit of info.

Your last example follows that that above page says and doesn't work correctly. It might be a bug.

search the forum for crop i found some information, but nothing that'll help.

I checked trac.videolan.org to see if a ticket had been created but didn't see anything directly related to you issue.

Maybe JB will see this thread and create a trac ticket.


Return to “VLC stream-output (sout)”

Who is online

Users browsing this forum: No registered users and 31 guests