Log in

View Full Version : Crop VP6 without re-encoding?


KeyMs92
1st November 2011, 14:01
Hi,

I'm aware that there's already a larger number of threads on this topic, but none of them seem to be related specifically to VP6.

The bottom line everywhere seems to be that video cannot be cropped without re-encoding. However, I found one thread which offers an alternative method:

Open windows calc, enter the height of the current file, and the set it to hex. Open virtualdub, and open tools->hex editor. Load your file in. Click on "strf" which will highlight the important chunk. (Not strl or strh.) Now look in the highlighted area of the left pane for the height, it'll probably start right underneath strf (the bytes will be backwards, but you should recognize it from what calc showed). Subtract 8 from the number (use calc if you aren't handy with hex) and replace the first byte - you probably won't need to touch the others. Save, and see if it worked.
http://forum.doom9.org/archive/index.php/t-119748.html

I tried this method and unfortunately it doesn't work for me. As I'd feared, it only changes the aspect ratio (on some players) without cropping anything. Must I conclude that it is impossible to crop the video without re-encoding?

roozhou
2nd November 2011, 06:23
Are you talking about setting display dimension in AVI header? I'm afraid it won't work with most players.

KeyMs92
2nd November 2011, 10:50
Yeah, in the sense that it crops the edges off. It seems most players, play the video in the native resolution and some play it with a different aspect ratio. Only in VDub you see the edges cropped off, but unfortunately in the wrong 'direction'.

I don't think this is going to work :P

roozhou
2nd November 2011, 11:01
You should set cropping information in bitstream, like in sps for H.264. I have no idea whether VP6 has such a field in its bitstream header.

KeyMs92
2nd November 2011, 12:33
I found this document:

http://multimedia.cx/mirror/vp6_format.pdf

OutputVFragments. The vertical decoded height of the frame as it should be scaled on output in 8x8 block units. See definition of ScalingMode below.
ScalingMode. Internally a frame may be encoded at a different resolution to the eventual size that it is presented on output from the decoder. There are four ways to scale the frame on output MAINTAIN_ASPECT_RATIO, SCALE_TO_FIT, CENTER, OTHER.
Might this be something?

nm
2nd November 2011, 13:55
ScalingMode=CENTER with appropriate OutputVFragments and OutputHFragments might work for cropping the same amount on opposite sides.

KeyMs92
2nd November 2011, 18:31
Hmm... It seems that I need to look into the intra frame header, but I can't find any of the properies listed under the frame header in the hex editor! Am I doing something wrong or can't these properties be accessed?

cyberbeing
4th November 2011, 22:10
The majority of FLV VP6 videos are all mod16 with cropping flags to achieve the specified video dimensions, but as far as I can tell none of our DirectShow decoders/splitters seem to support it. Adobe Flash and things like Adobe Media Player do, but that's about it.

Midzuki
4th November 2011, 22:30
Hmm... It seems that I need to look into the intra frame header, but I can't find any of the properies listed under the frame header in the hex editor! Am I doing something wrong or can't these properties be accessed?

As I said in your VideoHelp thread, you'd need an ACTUAL hex-editor, instead of VirtualDub's built-in one:

http://forum.videohelp.com/threads/340457-Crop-VP6-video-using-frame-header?p=2118274&viewfull=1#post2118274

The majority of FLV VP6 videos are all mod8 with cropping flags to achieve the specified video dimensions, but as far as I can tell

none of our DirectShow decoders/splitters seem to support it. Adobe Flash and things like Adobe Media Player do, but that's about it.

That suxxx :(