VideoHelp.com forum archive
http://www.supermediastore.com/



Forum Archive Home -> Advanced Video Conversion -> Extract part of picture while keeping right aspect ratio



Extract part of picture while keeping right aspect ratio
cd090580 posted 2008 Sep 27 10:16
Hi,

I had some problem with my mini dv camera while shooting a holiday film :( My camera was displaying "head cleaning required" or "Error E04: Unit in safe mode. Please remove and reattache battery". While I got error E04, I eared the motor spinning in full speed like if it was overvolted or not connected to any mechanism.

So when I tried to play my tape, my camera was just showing an empty screen :( SO I had to borrow a friend's camera which plays the tape but with lot of artifacts. That's the best I got.

Now my camera is dead, no power at all from PSU or battery.

Here is what I got:



Source PAL DV 720*576 shooted in 4:3 format.

So now, I'm trying to keep only the right part of the screen. But I don't know how to crop it to keep aspect ratio. Do I need to select a size which make a ratio of 1.25 ??? (like the 720*576).

Second, do I need to deinterlace before doing this king of crop ???

My final purpose if to keep the video from the right part of the clip by cropping and resizing to make it full screen again. To do this I know I will loose top and bottom of the video.

Also, is there any filter than can remove the colored macroblocks appearing ??? (there are white on the first screen, colored on the second part) ????



Thanks.



guns1inger posted 2008 Sep 27 19:25
The short answer is that you cannot do exactly what you are trying to do.

Your choices are

1. Crop off the lefthand end of the video to remove the damage, then crop off the top or bottom or both until you get back to a 16:9 aspect ratio

2. Crop off the lefthand side to remove the damage, resize vertically until you get back to a 16:9 aspect ratio, but understanding that the results will be distorted

3. Use a decent editor, and simply mask out the damage portion of the footage so you maintain the correct aspect ratio of the remaining image.

Doing a simple crop does not require deinterlacing, however resizing the footage does.

I don't know of any filter to remove those artifacts, although something like despot might work.



45tripp posted 2008 Sep 27 20:27
it's 4/3

you didn't say what the target is...

if you're going back to 720x576
i'd pillarbox it at least to a degree.

best way to decide on it is to use zoombox as an aid.
http://forum.doom9.org/showthread.php?t=135776&highlight=zoombox

:

avisource("")
import("zoombox.avs")
Crop(304, 0, -0, -0)
addborders(152,0,152,0)
Tdeint(1)
zoombox(720,576,zoomfactor=120)


tweak zoomfactor to reduce/increase pillarboxing
this of course is a symetrical to top/bottom cropping,
you may indeed want that to be lopsided.
use the 'pany' parameter of zoombox for that


tripp



guns1inger posted 2008 Sep 27 22:32
Missde the 4/3 bit - looking at the image it looks stretched to me.


cd090580 posted 2008 Sep 28 05:05
Hi,
The source is 4:3, and the target is also 4:3.

I'll try the zoom box tip.

How do I need to reencode my new video since it has been deinterlaced and that part must be reinserted between 2 interlaced clips ?????


Just for info, was it a head problem or an electronic failure in my (dead) camera ????



45tripp posted 2008 Sep 28 06:29
:

avisource("")
import("zoombox.avs")
Crop(304, 0, -0, -0)
addborders(152,0,152,0)
Tdeint(1)
zoombox(720,576,zoomfactor=120)
assumebff() #or assumetff if it happens to be tff, unlikely
separatefields().selectevery(4,0,3).weave()



i wondered :)
if it was all damaged, or if you were bringing it into good stuff.
if they're not separate scenes,
if may be better to mask the crap like gunslinger said



cd090580 posted 2008 Sep 28 08:05
My purpose was in bringing it into the good stuff.

The first 4 minutes are OK, the 2 last OK. The damaged part was 16 minutes, only 7 are acceptable and they will be inserted between the 2 good parts.

Here is a sample after using the zoom function. Just the moving macroblocks cannot be removed. I don't find any filter than can at least reduce them.

sample.avi



guns1inger posted 2008 Sep 28 08:26
I suspect you are pretty much screwed for a simple solution to the major breakup, however with a bit of work you can reduce the noise of the smaller damage.

This script :

:

LoadPlugin("C:\Video\AviSynth 2.5\plugins\removedirt.dll")
LoadPlugin("C:\Video\AviSynth 2.5\plugins\removegrain.dll")
LoadPlugin("C:\Video\AviSynth 2.5\plugins\repair.dll")
LoadPlugin("C:\Video\AviSynth 2.5\plugins\deflicker.dll")
LoadPlugin("C:\Video\AviSynth 2.5\plugins\msharpen.dll")

function RemoveDirt(clip input, bool "_grey", int "repmode")
{
    _grey=default(_grey, false)
   repmode=default(repmode, 16)
   clmode=17
   clensed=Clense(input, grey=_grey, cache=4)
   sbegin = ForwardClense(input, grey=_grey, cache=-1)
   send = BackwardClense(input, grey=_grey, cache=-1)
   alt=Repair(SCSelect(input, sbegin, send, clensed, debug=true), input, mode=repmode, modeU = _grey ? -1 : repmode )
   restore=Repair(clensed, input, mode=repmode, modeU = _grey ? -1 : repmode)
   corrected=RestoreMotionBlocks(clensed, restore, neighbour=input, alternative=alt, gmthreshold=70, dist=1, dmode=2, debug=false, noise=10, noisy=12, grey=_grey)
   return RemoveGrain(corrected, mode=clmode, modeU = _grey ? -1 : clmode )
}
   
base=AVISource("sample.avi").AssumeFPS(25)

baseYV=ConvertToYV12(base)

RemoveDirt(baseYV, false, 8).MSharpen(10,100,true,false,false)



does a reasonable job at reducing the smaller digital damage without costing you image detail.

The attached video shows a side by side of your source (left) and the script (right). Step through it frame by frame a look at the differences. A good example is frame 35. Look at the area around the red van and the car behind it in the bottom left corner.

Of course only you can make a call on if the effort is worth the result.

sample%20rest.avi



cd090580 posted 2008 Sep 28 08:41
Thanks for this script.

I don't have any commercial products. I do my videos with only free softwares (Avisynth, Virtualdub + filters for each).
Just my authoring software is commercial.



cd090580 posted 2008 Sep 29 13:26
I tried your script but it crashes :(

Avisynth read error: CAvisynthStream: Unknown System Exception - 0xc000001e at 0x198531a



cd090580 posted 2008 Sep 29 13:58
Now it work. Strange...
Maybe a bug of avisynth (I'm using the lastest alpha release)



cd090580 posted 2008 Sep 30 13:44
I've found some advices about Motion Compensation and that reduce quite well another artifacts :)

Do you know Motion Compensation filters ???

I tried with MSU Motion Compensation filter for virtualdub.



cd090580 posted 2008 Oct 06 06:04
Do you have any other recommandations for Motion Compensation (like the MSU Motion compensation) ??????

Virtualdub or Avisynth (preference for avisynth)




Login/Register to our forum to be able to post here.








About   Advertise   Forum Archive   RSS Feeds   Statistics