Log in

View Full Version : Help on MOV to Mpeg4 using Avisynth and MainConcept.


Razorholt
22nd November 2005, 05:54
Hello everyone,

I'm trying to encode a MOV file to mpeg-4/H.264 using Avisynth and Mainconcept Mpeg4. I use Avisynth to add a logo and also to resize the video.
I've tried many AviSynth filters to improve the quality of the encoded file but I'm still not very impressed.

File Input: MOV, 44MB
File Output: Mpeg4, 17MB (size desired)


Avisynth script:


LoadVFAPIPlugin("C:\Program Files\AviSynth 2.5\plugins\QTReader.vfp","QTReader")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\ColorMatrix\Release\ColorMatrix.dll")

video = QTReader("C:\movie\mymovie.mov")
video = video.FlipVertical
video = video.BilinearResize(800,450)
video = video.colormatrix()
video = video.Deen("m2d",4)

logo = ImageSource("C:\movie\watermark\logo.png")
logomask = ImageSource("C:\movie\watermark\logo-mask.png")
Overlay(video, logo, mask=logomask)



Mainconcept Setting



Output format
|
|- MPEG type: H.264 High
|- Stream type: Program (Video+Audio)
|- Video mode: NTSC
|- Audio mode: Layer 2

Video
|
|- Width: 800
|- Height: 450
|- Bitrate: 880
|- Frane rate: 23.97
|- Deinterlacing: None
|- Passes: 2
|
|- Advanced
|
|- Basic Settings
| |
| |- Frame/Field Encoding: Progressive
| |
| |- Keyframe Interval: 10
| |- Set Keyframe at scene change: off
| |
| |- Birate Mode: Variable birate
| |- Average Bitrate: 880
| |- Maximum Birate: 1400
|
|
|
|- Advanced Video Settings
|
|- Profile: high
|- Level: 4.1
|
|- IDR Interval: 10
|- Reordering Delay: 1
|
|- use B-Slices: off
|- Multiple Slices: off
|
|- Reference Frames: 16
|- Spatial Range: 64
|- Search Mode: 8x8
|- Subpixel Mode: Full
|
|- Rate Distorsion Optimization: on
|- Fast Intra Decisions: off
|- Fast Inter DecisionS: off




My questions are:

1. Is there any other filters I should add to pre-process the input file?
2. Is my MainConcept software properly configured?


Thank you very much for your help :) .


- Dan

Sergey A. Sablin
22nd November 2005, 06:49
Hi Razorholt,

I'd recommend you to use next settings -

|- Advanced
|
|- Basic Settings
| |
| |- Frame/Field Encoding: Progressive
| |
| |- Keyframe Interval: 100 - see below
| |- Set Keyframe at scene change: on - always use SCD
| |
| |- Birate Mode: Variable birate
| |- Average Bitrate: 880
| |- Maximum Birate: 1400
|
|- Advanced Video Settings
|
|- Profile: high
|- Level: 4.1
|
|- IDR Interval: 100 - bigger value is better (max 300)
|- Reordering Delay: 4 - number of b-frames + 1, so here is 3 b-frames
|
|- use B-Slices: on - allows to use B-frames
|- use B-Slices as reference: on - allows pyramid coding
|- Multiple Slices: off
|
|- Reference Frames: 4 - 4 is enough is most of cases
|- Spatial Range: 64
|- Search Mode: 8x8
|- Subpixel Mode: Quarter - use quarter pixel locations for MC. This is best Motion Compensation precision
|
|- Rate Distorsion Optimization: on
|- Fast Intra Decisions: off - set to on if you want to speed-up encoding process
|- Fast Inter DecisionS: off - set to on if you want to speed-up encoding process


this will give you much better results as you have before.

bond
22nd November 2005, 12:45
1. Is there any other filters I should add to pre-process the input file?why do you use deen and bilinearresize? is the source so bad that filtering and this low quality resizer is necessary?

Razorholt
23rd November 2005, 01:16
@Sergey: when I use B-Slices I end up with with a very "choppy" video. But I have adjusted the settings based on your recommendations now. So, let's give it a try :) Thank you.

@bond: well, I was not impressed with the deen filter, in this case at least. And to answer your question, the file is a MOV one in very good quality. But what I'm trying to do is to compress the file as much as possible, keeping the same quality. Thanks.

bond
23rd November 2005, 01:19
@bond: well, I was not impressed with the deen filter, in this case at least. And to answer your question, the file is a MOV one in very good quality. But what I'm trying to do is to compress the file as much as possible, keeping the same quality. Thanks.filtering makes no sense on high quality sources, except the codec isnt good

my recommendation: dont use deen and use lanczosresize

Razorholt
23rd November 2005, 02:53
Ok, I've tried the new mainconcept's settings. Result: the file is very choppy and audio is out of sync. I played the file on a P4 2.1Ghz 1GB RAM.

Thanks,
- Dan

Razorholt
23rd November 2005, 03:47
Here is the message displayed while encoding:

Multiplexing information
Video stream 0 data rate : 122500 bytes/sec (980000 bits/sec)
Audio stream 0 data rate : 14000 bytes/sec (112000 bits/sec)
Overhead data rate : 66950 bytes/sec (535600 bits/sec)
Total data rate : 203450 bytes/sec (1627600 bits/sec)
M088:Video PTS (10316.00ms) underflow at pack 560 by 54.00ms
M088:Video PTS (11984.00ms) underflow at pack 721 by 6.00ms
M088:Video PTS (117006.00ms) underflow at pack 7852 by 17.00ms

Sergey A. Sablin
23rd November 2005, 04:54
Ok, I've tried the new mainconcept's settings. Result: the file is very choppy and audio is out of sync. I played the file on a P4 2.1Ghz 1GB RAM.

Thanks,
- Dan
Razorholt, can you upload source and resulting movies?

Razorholt
23rd November 2005, 05:21
Ok, let me upload the resulting movie.. The original can be found here (http://movies.apple.com/movies/wb/syriana/syriana_h480p.mov)

Thanks,
- Dan

Razorholt
23rd November 2005, 06:34
The resulting movie can be found here (http://66.227.5.253/trailers/syriana_VBR-880.mpg) (right-click to "save as" because I didn't zipped it... but I think you figured :))

I managed (don't know how) to get rid of the error messages mentioned earlier. As a result, the audio is now working fine but the video is still "blocky".

Thanks for helping out.

- Dan