View Full Version : Please suggest a better script for AVC > DVD
JDK187
30th October 2008, 15:09
Hello friends,
I have to convert one of our company MTS product demo files to DVD and am having a hard time getting decent quality.
Here's what I'm doing:
Dgavcdec (v 104) project file [honor flags /demux audio]
I get my dga index file and the audio:
x PID 1100 2_0ch 256Kbps DELAY -214ms.ac3
Here's my Avisynth script:
Loadplugin("C:\DGAVCDecode.dll")
Avcsource("C:\vid.dga")
#separatefields.selectodd()
Lanczosresize(720,480)
I have tried 2pass encodes ffmpeg (-r 30000/1001) and CCE basic with (what I believe) decent settings and still the
Output MPG has very subtle intermittent dropouts. I'm not very experienced with avisynth so I'm sure the problem is with the script.
Here's the log file from Dgavsdec:
Stream Type: Transport [192]
Profile: High
Level: 4
Frame Size: 1920x1080
SAR: Unspecified
Display Size:
Frame Rate: 30.000000 fps
Colorimetry: BT.709* [2]
Frame Structure: Fields (TFF)
Frame Type: not yet
Coded Number: 9000
Playback Number: 9000
Frame Repeats: 0
Field Repeats: 0
Bitrate: 15.998
Bitrate (Avg): 16.244
Bitrate (Max): 23.907
Audio Stream: 1100: AC3 2/0 256
Elapsed: 0:00:20
Remain: 0:00:00
FPS:
Info: Finished!
Thanks for any help guys!
J
Sagekilla
30th October 2008, 15:18
Nothing is wrong with your script, it seems more likely that the problem would be with FFMPEG than avisynth.
45tripp
30th October 2008, 15:41
there's no indication in what's wrtitten that cce did better.
JDK187
30th October 2008, 15:45
If there's nothing to improve on the script i will keep it as is and maybe try an encode with HC and see if there's any improvment.
Here's what i'm doing with ffmpeg:
ffmpeg -i %i -target ntsc-dvd -r 30000/1001 -mbd 2 -sameq -an -pass 1 video.m2v
ffmpeg -i %i -target ntsc-dvd -r 30000/1001 -mbd 2 -sameq -an -pass 2 -y video.m2v
that's it.
As for CCE, i'm running the script.avs through the DVD 2pass VBR template using the defaults - min 2k/avg 6k/max 9k
Any comments on my FFmpeg commands?
I also tried two pass with -qscale 2 -mbd 2 and still same results.
Perhaps it's a dropframe issue with 30fps>29.97?? Do you think the frame conversion would be better in my script then on the CLI?
I will have to research how to 30000/1001 in avisynth first.
Thanks guys
Sagekilla
30th October 2008, 15:49
DVD is technically 24 fps with pulldown to 29.97 (30/1.001) fps.
You can't just set the frame rate to 3000/1001 and expect it to work.
2Bdecided
30th October 2008, 17:03
What is the source? I know what DGindex says, but what is the actual video? 24p, 30p, 60i?
You can't just resize 60i as-is, and the "separatefields.selectodd()" line is commented out.
If it's 30p then fine.
I don't know how it could be 24p when DG reports 30fps, unless it's 24p-in-60i, but I didn't know AVC camcorders did that.
Cheers,
David.
Alex_ander
30th October 2008, 17:22
I'd explore the type of material before resizing. By log, it was encoded interlaced and unless you know exactly it had been shot in progressive mode 30fps, resizing it directly is not correct. E.g. if pure interlaced,enabling line 3 would make it better (you'd get it deinterlaced but a correct way). In case it is hard-telecined, IVTC is mandatory before resizing.
A less important thing is that original color space is BT709 and SD DVD is BT601 -> ColorMatrix filter would be useful here (after solving problems you identify as frame-dropping). So there's definitely something to improve.
JDK187
30th October 2008, 18:14
i didn't mean to have the separatefields.selectodd commented out.
The source is 1080/60i.
My dga confirms:
DGAVCIndexFile7
SIZ 1920 x 1080
FPS 60 / 2
CODED 9000
PLAYBACK 9000
I will check into a colour matrix as you suggested .. thx.
Guest
30th October 2008, 21:23
It's not clear what you mean by "subtle intermittent dropouts".
Sagekilla
31st October 2008, 04:22
If the source is 1920x1080i, resizing it to 720x480p poses no issue. It's like doing a ReduceBy2() to drop down to 960x540 to get rid of interlacing. I've done this before and had no issues and there's no reason why it shouldn't work.
vampiredom
31st October 2008, 05:27
Sagekilla's correct: But some folks don't like the field-blended look that occurs when the 1080i is scaled down to 720p. You want want to consider bobbing your source to 60p and selecting every other frame before scaling it down. You'll get lots of advice on which bobber or deinterlacer to use. Here's one combination I've found to be good (and fast) for interlaced HD->SD conversions:
http://forum.doom9.org/showthread.php?p=1179585#post1179585
Also note that scaling to 704x480 will achieve a more precise aspect ratio than 720x480. Or, alternatively, you can crop from 1920x1080 -> 1920x1056 and scale to 720x480. I also suggest using Spline36Resize(720x480) instead of Lanczos. If you find this is too sharp, try GaussResize(720, 480, p=50) and adjust <i>p</i> to where the sharpness looks best.
Here's my general recommend idea: (you'll need the Yadifmod, TomsMoComp and NicAudio plugins)
Avcsource("C:\vid.dga")
Crop(0,12,0,-12) # 1920x1056 (mod16)
# bob deinterlace using Yadifmod and TomsMoComp
yadifmod(mode=1, edeint=Interleave(TomsMoComp(-1, 0, 0), DoubleWeave().SelectOdd().TomsMoComp(-1, 0, 0)))
# do one of these below:
# choose every other frame...
SelectEven()
# ...or blend them together using variable weight ( <= .5)
# Merge(SelectEven(), SelectOdd(), weight=0.5)
Spline36Resize(720,480)
Now, if you want to try to match your 30.000 fps to 30000/1001, try slowing it down a hair and resampling the audio to 48kHz.
# get the audio from the demuxed ac3 track using NicAudio
a = NicAC3source("PID 1100 2_0ch 256Kbps DELAY -214ms.ac3")
AudioDub(a)
DelayAudio(-0.214)
# change the speed
AssumeFPS(30000, 1001, sync_audio=true)
# resample the audio
ar = 48000
Try {
v = v.SSRC(ar)
} Catch(err_msg1) {
Try {
v = v.ResampleAudio(ar*2).SSRC(ar)
} Catch(err_msg2) {
v = v.ResampleAudio(ar)
}
}
Alex_ander
31st October 2008, 09:27
If the source is 1920x1080i, resizing it to 720x480p poses no issue. It's like doing a ReduceBy2() to drop down to 960x540 to get rid of interlacing. I've done this before and had no issues and there's no reason why it shouldn't work.
This removes interlacing, but a the cost of blending fields which is unnecessary and not the best option. Every moving thing will get smeared, so most people avoid it. Deinterlacing an HD source by dropping even fields is free from that issue. It has its own downsides (in case original image is too sharp vertically), but in most practical cases they don't show up. I personally always prefer to keep interlacing and use a not-too-slow LeakKernel bobber. I'm not suggesting any particular script since in the discussed case, the type of video is not identified yet - what if it was 24p footage encoded with pulldown?
@ JDK187
Before any encoding, try to explore your initial script in VDub advancing by frame (use arrow key). In case the original video is true interlaced and not telecined from 24p (a possible footage mode in an HD camera), the deinterlaced (by dropping even) version shouldn't produce duplicated frames (otherwise you'll need inverse telecining, not deinterlacing or re-interlacing). Or you can explore the original video by disabling the processing lines; in case of telecining some frames will show interlacing, some will be progressive.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.