Log in

View Full Version : Avisynth + ffmpeg ntsc-dv woes


Umamio
15th October 2008, 17:46
On encoding using ffmpeg to ntsc-dv from an .avs source

"ffmpeg.exe -target ntsc-dv -aspect 4:3"

The encoding starts off fine until I receive this error

[pcm_s16le@00B20800 Can't process DV Frame #2672
Insufficient video data or severe sync problem

I have tried with several different videos through .avs and no matter the length or the framerate of the source, this message appears and is repeated from Frame 2672 onwards when converting to ntsc-dv.
Converting to pal-dv does not throw up this error, nor has it when using any other ffmpeg compression codec.
The error has only occured so far when being fed avisynth as an input. If I create an intermediary lossless/lossy file and convert it to ntsc-dv using identical ffmpeg arguments there is no such problem.

I have tried with 2 versions of ffmpeg. Sherpya's latest build (14277) and a preceding one (I do not remember the revision, built June 8 2008)

I'm not sure if this counts as an avisynth issue or an ffmpeg issue or an issue with my script or with dgdecode somehow but in case anyone has suffered a similar problem, you are not alone!


v = DGDecode_mpeg2source("3003_HankRon.d2v",info=3).ColorMatrix(hints=true, interlaced=true)
a = DirectShowSource("3003_HankRon T01 2_0ch 256Kbps DELAY 0ms.ac3")

Main = AudioDub(v,a)

Load_Stdcall_Plugin("C:\Program Files\megui\tools\yadif\yadif.dll")
Main = Main.Yadif

Left = 3
Top = 123
Right = 7
Bottom = 128
pixelShape = float(640)/720
Main = Main.checkedCrop(left = Left, top = Top, right = Right, bottom = Bottom)

TrueAR = Main.arCalc(pixelShape=pixelShape)

Main
toJoost(TrueAR, buf=5, w=720, h=480)


No plugins or filters are used in "arCalc", "checkedCrop" or "toJoost", they are essentially just a multiplication, a crop and resize. Directshowsource for ac3 uses ac3filter.

Any help is much appreciated. Apologies if this questions is not suited to this part of the forum. I don't really know where to put it. "Maybe you should submit it as an ffmpeg bug, fool!" Well, I would, but I'm not completely sure it's an ffmpeg bug, it could be me! "What about the DV forum! you are having problems with DV?" Well, I dont know that DV is the problem either just ffmpeg with avisynth and ntsc-dv in particular.

IanB
15th October 2008, 21:39
Try 2.5.8

Umamio
16th October 2008, 00:25
I've just tested on my dev machine which has 2.5.8 RC4 installed.

AVISource("C:\CR2K4NS.avi")

I used an avi source in case dgdecode was somehow implicated with my previous problem, but the same error occurs.

Edit: A google search brings up this (http://www.irisa.fr/texmex/people/dufouil/ffmpegdoxy/dvenc_8c-source.html) as the libavformat source for dv encoding (line 233) in case it helps

Fizick
16th October 2008, 06:45
Umamio,
do you raplace full your script by this avisorce line? If not, try it.
Please also report video and audio properties (with Info() command)

Umamio
16th October 2008, 15:00
do you raplace full your script by this avisorce line?

Yep, when I tested on 2.5.8 RC4 that was my whole script

The info for this particular video is
Frames: 2701
Time: 00:01:30:123
Colourspace:YV12
Width:720 Height:480
Frames Per Second: 29.9700 (30000/1001)
FieldBased: No
Parity: BFF
Vieo Pitch:736 bytes
Has Audio: YES
Audio Channels: 2
Sample Type: 16 bit
Samples Per Second 48000
Audio Length: 4325921 samples, 00:01:30:123
CPU Detected: x87 MMX ISSE SSE SSE2

I have tried different videos with different framerates different lengths different colourspaces but the same error is produced on two separate machines.

However, I have just discovered, if I resample the audio to 44100 and let ffmpeg resample up to 48000, ffmpeg does not produce this error. I suppose a workaround could be to resample to 96000 in avisynth and let ffmpeg do its own resampling down to 48000.

It is starting to sound more like an ffmpeg bug but I am unable to reproduce it without using avisynth sources.
Maybe a bug in ffmpeg's avisynth support? OR DV encoding? Ah well. I don't know why it would only affect encoding to ntsc-dv using avisynth and nothing else.