Log in

View Full Version : Cannot achieve desired compression for DV type 1 file


tacman1123
3rd June 2008, 14:30
I'm having the opposite problem. I've transfered some DV Type 1 files from my Canon Camcorder, they're huge, but that's okay (for now). I want to encode them as h264 for playback on the web and/or an ipod. A simple 1-minute video is coming out at about 11 Meg, yet much longer and more detailed mp4 files I've seen a much smaller than that. So obviously I'm not compressing at the right point.

Question: should my AVISynth script reflect some compression? Or the encoder? I've been player around with Super, MeGUI and ASXGui, all of these are wrappers to x264.exe, as well as various encoders and muxers. They all tend to produce about the same size file, so either there's a setting I need to apply in these programs, or I need to add something in my avisynth script.

My avs script is pretty straightforward, load a couple of clips, add some captions, standardize the size, dissolve:

f=BlankClip(...)
c1=DirectShowSource("c:\avi\daver\272.331.avi").AssumeFPS(F).ConvertToYV12().ResampleAudio(R)
c1=c1.add_caption("Tac", "")
f=Dissolve(f,c1,20)

c2=DirectShowSource("c:\avi\daver\274.331.avi").AssumeFPS(F).ConvertToYV12().ResampleAudio(R)
c2=c2.add_caption("Al Piro", "")
f=Dissolve(f,c2,20)

f


add_caption is a wrapper to SubtitleEx.

Again, the avi files are pretty large, I didn't compress them when bringing them in from the DV. Where and how should I apply the compression?

Thx,

Tac

GodofaGap
3rd June 2008, 14:37
11 MB per minute is a bitrate of 8*11*(1024^2)/(60*1000) = 1538 kpbs (for audio and video together). That's not unheard of for standard definition video. If you want smaller sizes you need to pick a lower bitrate.

krisq
3rd June 2008, 15:23
@tacman1123
I don't see any deinterlacer in your script. Use Tdeint() or other, there are plenty to choose from :)

tacman1123
3rd June 2008, 17:16
Although I've read some on deinterlacing, I don't understand it, or more specifically, I don't understand why I'd need it, or where I'd put it. I didn't think DV files were interlaced, though I admit I know almost nothing about this!

Thanks for any guidance or pointers.

Tac

HymnToLife
3rd June 2008, 17:28
Do you see some "combing", like this (http://itsuki.fkraiem.org/stuff/SkyGirlsCombing.png)?

communist
3rd June 2008, 17:39
I didn't think DV files were interlaced,
They are most likely interlaced, I dont want to rule out that they are progressive (=! interlaced). Also open a new thread with your problem as you're engaging in thread hijacking - which is not very nice and mixes too many problems into one thread.

GodofaGap
3rd June 2008, 18:07
Since he's using directshowsource there is also a chance the video gets deinterlaced somewhere there. It wouldn't surprise me if some DV cameras have a progressive scan mode in any case.

tacman1123
3rd June 2008, 18:39
Thanks for the feedback. I reduced the bitrate, and the filesize went down accordingly.

But I still can't figure out why some h264 files are so tiny with great quality and mine seem bloated by comparison. Maybe I'll see if any tools can tell me how these smaller files were encoded.

AviSource won't open Type 1 DV files. I think DirectShowSource deals with interlacing, since none of the sample scripts I've seen use it.

I've read, but don't know how valid it is, that the paid version of Sorenson Squeeze does an excellent job with encoding, maybe some of these tiny files were done with it?

Tac

HymnToLife
3rd June 2008, 18:55
But I still can't figure out why some h264 files are so tiny with great quality and mine seem bloated by comparison. Maybe I'll see if any tools can tell me how these smaller files were encoded.

Most likely, they're encoded with x264 too. The amount of compression that one can apply to a source while retaining an acceptable quality varies greatly depending on the source. A source with much noise, grain or detail will be much less compressible than a more "clean" source. A good way to see how compressible your source is is to encode it with a constant quality codec/setting (lossless codecs like Lagarith, or x264 in Constant Quality mode are good for this), and see how big the resulting file is compared to another source encoded with the same settings.

tacman1123
3rd June 2008, 19:53
I did look at some of the smaller files, and saw a few things that made it compress better: 25fps, rather than 29.97, and a smaller resolution. I suspect that the reason the quality looked so much better was exactly what you said -- it started out crisp and clean, and that compressed well. I had thought that the gray background would compress well (my video was an interview with people sitting in front of a gray wall), but in fact after compression there were a lot of artifacts, much more visible on the solid wall than on the people).

When I compressed my videos using the same framerate and video size as the Kiss concert video on VideoLan's site, my file also compressed to about 7M.

I wouldn't have guessed that better cameras (clearer, sharper picture) would yield better compression than inexpensive cameras with lower quality lenses, so thanks for pointing out that noise and graininess can be expensive.

Tac

Guest
3rd June 2008, 20:09
I've moved this to it's own thread as it was a case of thread hijacking.

Gavino
3rd June 2008, 20:17
AviSource won't open Type 1 DV files. I think DirectShowSource deals with interlacing, since none of the sample scripts I've seen use it.
DV files from my Canon MVX330i, imported into AviSynth via DirectShowSource, are definitely interlaced. But whether yours are depends on your camera model (does it advertise itself as "progressive scan"?) and possibly on the DV codec you have installed (DirectShowSource itself just uses your installed (DirectShow) codec).

The easiest way to be sure is to look at the footage as imported (in VDub, AvsP, etc) and see if it has the characteristic combing artifacts in motion scenes.

And natuarally the frame rate and resolution will affect the file size - if you have more bits to start with (more and bigger frames), you have to compress more (hence lower quality) to achieve a given final kbps.

smok3
3rd June 2008, 22:25
you need to downsize, leaving DV footage in native resolution is mostly only sane for TV stuff, for web you can use something like 512x384 (if we are talking about 4:3).

Blue_MiSfit
4th June 2008, 01:55
DV is also usually very noisy, especially in the chroma planes. You might want to apply some chroma denoising at the very least..

~MiSfit