Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I copied some cartoons from a VCD to my hard drive, to be able to manage the content more easily. However, probably because of the VCD outdated technology, there are two issues with these clips:

  1. There are massive black margins at the top and bottom of the clips. It seems that these margins make a widescreen film fit an old style 4:3 screen, but it is not really relevant in my case. How can I get rid of these margins?
  2. The quality is rather horrible. The image is a bit blurred and because this is a cartoon it looks more horrible than it would look for a normal film. Can I sharpen the image somehow?

I am running Debian Testing.

share|improve this question
    
how did you copy the cartoons? –  Janus Troelsen Jul 25 '12 at 21:42
    
@ysangkok, using the rip VCD option in k3b. But when I watch the actual VCD using one of the multimedia players, the issues are exactly the same. –  Grzenio Jul 26 '12 at 9:00
add comment

3 Answers

From the mencoder man page:

   crop[=w:h:x:y]
          Crops the given part of the image and discards the rest.  Useful to remove black bands from widescreen movies.
             <w>,<h>
                  Cropped width and height, defaults to original width and height.
             <x>,<y>
                  Position of the cropped picture, defaults to center.

It is a video filter (vf) so you apply it like this: mencoder -o out.mp4 -vf crop=320:240:0:10 in.mp4 for cropping a 320x240 region from point (x,y)=(0,10).

There is a sharpen filter too:

   -ssf <mode>
          Specifies software scaler parameters.

          EXAMPLE:
             -vf scale -ssf lgb=3.0
             lgb=<0-100>
                  gaussian blur filter (luma)
             cgb=<0-100>
                  gaussian blur filter (chroma)
             ls=<-100-100>
                  sharpen filter (luma)
             cs=<-100-100>
                  sharpen filter (chroma)
             chs=<h>
                  chroma horizontal shifting
             cvs=<v>
                  chroma vertical shifting

You can apply the crop filter first, or you can apply the sharpen filter first, but it is probably faster to crop first since you are throwing data outside the crop region away anyway.

You're not gonna get much improvement. VCD uses MPEG-2 which is a pretty bad codec compared to modern standards.

The black bars are not inherently the fault of the VCD format. If your original source had the aspect ratio of 2.35:1, it would need to be letterboxed to fit in the supported 16:9 format. However, it is not necessary to letterbox a 16:9 source in 4:3.

share|improve this answer
    
Cheers, I will give it a try! –  Grzenio Jul 26 '12 at 9:54
    
I tried just the cropping bit, but I get the following error message: No audio encoder (-oac) selected. Select one (see -oac help) or use -nosound.. How do I know which audio encoder I need? –  Grzenio Jul 29 '12 at 7:21
    
You can copy the sound using -oac copy. No need to re-encode it unless you use an output container that doesn't support it. –  Janus Troelsen Jul 29 '12 at 11:59
    
Now I get the same message, but for video encoder. Which one is preferable? No video encoder (-ovc) selected. Select one (see -ovc help). –  Grzenio Jul 29 '12 at 17:42
    
Try lavf. Also, try stuff out before you ask. If the result is good, use it. If it isn't try something else. Codecs are often a matter of taste, you can't objectively say which one is better, it depends on your use case. In this day and age, MPEG-4 is often preferred. Try looking for examples online and see what they use. –  Janus Troelsen Jul 29 '12 at 17:45
add comment

FFmpeg is likely the tool you are looking for. Someone may even have written the exact tool you need.

http://ffmpeg.org/

share|improve this answer
1  
Maybe, but ffmpeg has a squillion options, many of them arcane. What options would be useful, with what value? –  Gilles Jul 25 '12 at 23:02
    
Yeah, I had a quick look at ffmpeg... but I would really appreciate precise options for my problems, because this stuff seems to do everything you can imagine and more... –  Grzenio Jul 26 '12 at 9:07
    
add comment

If you prefer a GUI method I would recommend Avidemux. It is basically a frontend to mencoder (of ffmpeg I cant remember) but it lets you easily set conversion options. I would say if you are running transforms such as sharpen be prepared for a long wait, even on a fast computer.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.