Log in

View Full Version : Problem with video length after encode


johnson911
4th August 2005, 00:54
I recently reinstalled Windows, and I've done several encodes since then, and none of them have been turning out right. Everytime I encode a video, it ends up changing the length (mm:ss) of the video.

Sources are Xvid. I've tried both 25fps and 23.976fps videos.

I first tried HC enc with AVISynth, then ran the pulldown that comes with DVD2SVCD on it. The resultant video files were 15:42 m:s. The problem with this is the source file is 42:05 m:s.

I tried the same thing using CCE 2.67 with the same results. I used AVIsynth with CCE, so I'm wondering if the problem is with AVISynth, but I'm using the same avs files I always use:

LoadPlugin("D:\INSTAL~1\DVD2SVCD\AVISYN~1.5PL\Mpeg2dec\MPEG2D~1.DLL")
AviSource("E:\DVDs\Temp\bsg11.avi",audio=false)
BicubicResize(720,480,0.0,0.6)

What bothers me is in the HC enc logfile.

frames: 1 62912
framerate: 25.00

62912/25fps/60 = 41:56, which is the length of the source file. So what's causing it to change the running length?

I've done countless re-encodes of 23.976 and never had any problems with this.

It's being played fast in VLC, Nero ST, and WMP.

While I'm here, how do I run an m2v file through avisynth? Is that dgdecode.dll? I've been wanting to run the m2v files through avisynth and tying AssumeFPS() on them.

Thanks!

Inventive Software
4th August 2005, 13:18
On the M2V files, the way you specified is the way to do it. DGDecode is arguably the best DVD decoder for AviSynth currently. I've used it countless times and not had any problems of the sort.

Only way the video could be going fast (by your explanation) is that AviSynth assumes that all videos it throws at the encoder are a different FPS. Try using AssumeFPS() after loading the file. If this doesn't solve your problem, come back and explain some more.

johnson911
4th August 2005, 14:10
A few things (I'm at work, so I can't go in great detail).

I tried AssumeFPS(24.967) (or whatever the fps is) as I passed the file to the encoder with the same results. I tried pushing the m2v through AVISynth with dgdecode, but I got the error that it "can't open the file, or it's an out of date m2v". That error happened with both CCE and HC encoded video.

I tried encoding completely with DVD2SVCD, and it worked... sort of. It encoded the video as PAL, and it played back at the right length. I tried to find a setting in DVD2SVCD that told it to do PAL, but I couldn't find any. How does DVD2SVCD determine to encode to NTSC/PAL?

The AVS file that DVD2SVCD created didn't have anything unexpected in it. I'll post it when I get home if that'll help. I'll have to rerun the encode. Also, I used CCE with DVD2SVCD.

Guest
4th August 2005, 14:14
I tried pushing the m2v through AVISynth with dgdecode, but I got the error that it "can't open the file, or it's an out of date m2v". Actually, the error message refers to an obsolete D2V file. You're not using DGMPGDec correctly. Please read the accompanying documents. DGDecode must read a D2V file created by DGIndex. The versions of DGIndex and DGDecode must match.

johnson911
5th August 2005, 00:29
Oops, thanks for pointing that out neuron2, I didn't bother reading the documentation last night.

So here's the deal.
I fed a 23.976fps, 640x480, DivX v5 video to HC enc 0.15 Using AVISynth 2.5.5. All of the above was checked with GSpot and AVICodec.

I used the following AVISynth file:
LoadPluginLoadPlugin("D:\INSTAL~1\DVD2SVCD\AVISYN~1.5PL\Mpeg2dec\MPEG2D~1.DLL")
AviSource("E:\DVDs\Temp\bsg11.avi",audio=false)
Trim(1,1000)
BicubicResize(720,480,0.0,0.6)
AssumeFPS(23.967)

I used Trim so I could do it quickly and so I know the # of frames. I get the same results if I leave it out. I also get the same results if I leave AssumeFPS out. 24 fps for 1000 frames should be 41 seconds. If I play the avs file in a media player, it is 41 seconds long.

This is the HC.ini file used.
*PROFILE fast
*ASPECT 4:3
*MAXBITRATE 5000
*CQ 5.0
*DC_PREC 10
*MATRIX QLB
*LOGFILE E:\DVDs\Temp\HC.txt

This is the HC log file:
--------------------------------------------
| HCbatch - MPEG2 encoder - rel. 0.15 beta |
--------------------------------------------

input: e:\dvds\temp\vid01.avs
output: e:\dvds\temp\vid01.m2v

--------------------
| encoder settings |
--------------------

profile: FAST
frames: 1 1000
framerate: 23.97
aspect ratio: 4:3
bitrate: NA
max. bitrate: NA
pass: 1 (Constant Quant)
constant Q: 5.000
closed gops: no
VBV check: no
scene change det.: yes
interlaced: no
goplen,B-pic: AUTO
dc_precision: 10
scan method: ZIGZAG
bias: 0
time code: 0 0 0 0
CPU: MMX/ISSE
matrix: QLB

--------------------
| source stats |
--------------------

nr. of frames in source: 1000
width*height: 720*480
fps: 23.97
nr. of frames to encode: 1000
frames to encode: 1 - 1000

---------------------
| encoding - pass 1 |
---------------------

pass 1 encoding time: 0:00:32 (32 s)
average fps: 31.3

------------------
| encoding stats |

------------------

total encoding time: 0:00:32 (32 s)

intra matrix used
8 16 19 22 26 27 29 34
16 16 22 24 27 29 34 37
19 22 26 27 29 34 37 39
22 22 26 27 29 34 38 42
22 26 27 29 32 36 40 50
26 27 29 32 36 40 50 61
26 27 29 35 40 50 59 75
27 29 35 40 50 59 75 89

non-intra matrix used
16 17 18 19 20 21 22 23
17 18 19 20 21 22 23 25
18 19 20 21 22 23 24 26
19 20 21 22 23 24 26 28
20 21 22 23 25 26 28 29
21 22 23 24 26 28 29 31
22 23 24 26 28 29 31 34
23 24 25 28 29 31 34 38

nr. of gops: 70
nr. of frames: 1000
nr. of I-frames: 70
nr. of P-frames: 280
nr. of B-frames: 650
average quant (non linear): 5.000
VBV underflows detected: disabled
VBV underflows fixed: disabled
minimum bitrate: 150
maximum bitrate: 4481
average bitrate: 1734

HC recognizes it as 23.97 fps and 1000 frames. It encodes the 1000 frames and the output checked in AVICodec (i know it's not an avi, but it still works) is 23.976 fps for the encoded .m2v and the pulldown m2v is 29.97. Both of these files show 999 frames in bitrate viewer, but when played in any media player, they're only 16 seconds long. All 999 frames are there, it's just playing it at 62.43 fps.

The source AVI was one I encoded with AVISynth and HC Encoder last week with no problems prior to reinstalling windows. I used the same AVS file too.

This also happens when using CCE 2.67. I reinstalled AVISynth thinking that might be it, in addition to uninstalling the GK rip pack.

Also, how do I get DVD2SVCD to stop encoding to PAL? Anyone know?

Oh yeah, when I used this AVS file on the encoded m2v, it played fine. So I do currently have a workaround, but OMG is it a pain in the ***.
LoadPlugin("D:\Installed Apps\DGMPGDec\DGDecode.dll")
mpeg2Source("E:\DVDs\Temp\dgindex.d2v")
AssumeFPS(29.967)

After all that, I just tested some old encoded files... same thing's happening. All of my m2v files are playing too fast?!?!?

johnson911
5th August 2005, 14:36
To explain the bottom line further. I have some m2v files on my drive that I encoded prior to reinstalling windows. Prior to reinstalling, they played at normal speed (29.97 fps). Now they too are playing at around 60 fps. I'm going to try out some DVDs and see if the problem is with all mpeg2 files.

Any other ideas?

Mug Funky
6th August 2005, 11:18
try playing them in virtualdubmod or mplayer and see how they go - these players have their own decoding systems and don't use directshow for anything but output.

i've had issues on my old machine with directshow mpeg-2 splitters playing as fast as they can decode on m2vs, but program streams would play fine.

try muxing some audio in and seeing if they play back right? if they do, it's probably your mpeg-2 splitter filter. maybe installing a different one will help (or using the one internal to media player classic).

directshow is messy business :)

johnson911
8th August 2005, 01:51
The time listed on the bottom of VirtualDubMod is correct, but VDM still plays it a hair faster (1-2 seconds faster per minute). This isn't coming from a DVD btw, it's an AVI. Would the demuxer for that still cause problems?

I reinstalled windows to try and find the problem. VLC appears to play the re-encoded m2v files at the correct time (it wasn't displaying the time). After installing Nero Vision Express, everything was playing the files at the faster framerate. I uninstalled and it still happened, so I tried Elecard's mpeg-2 software codec. That caused WMP to play the files *almost* on time. It dropped about 3 seconds for every 30 minutes.

Anyway, I reinstalled windows again to get a fresh system, and didn't install NVE this time. VLC still appears to play the video with the correct time, but I can not get the audio to be in synch after I mux. The audio ends up being about 30 seconds off for every 30 minutes of video. I tried muxing with bbmpeg and tmpg dvd author and got the same results. I think I might be able to get a workaround if I can find a way to mux the files using dgdecode with AVISynth to serve the m2v file with AssumeFPS. bbmpeg and dvd author won't accept an avs file though, so I'm at a loss.

Even still, that doesn't explain why I'm having problems now when I wasn't having any problems before.

The only apps that I have installed are:
AviSynth 2.5.5
BitrateView
Direct Show Ogg Vorbis Filter
DVD2SVCD
Huffyuv AVI lossless video codec
TMPGEnc DVD Author 1.6
VLC 0.8.2
XviD MPEG-4 Viceo Codec
(Azureus, J2SE 5.0, Shockwave player, Firefox, and Thunderbird, Win XP sp2)

I've also used Virtual Dub Mod and bbMPEG.

Those are the same programs I used before. Can any of those cause problems like what I'm experiencing?

Any more ideas?

Edit: That's not true. The AVI is 41:56, the reencoded m2v is 41:56, but the pulldown m2v is 43:43. This appears to be my problem with the audio synch issues. Why would the pulldown increase the length? Also, is there an easy way to re-synch the audio?

vlada
8th August 2005, 06:32
I live in a PAL country, so I don't know too much about pulldown. Hopefully neuron2 can help with this. What about doing the 24 to 30 fps conversion (telecine) before encoding?
Anyway you can stretch an audio file using AviSynth for example, but I would rather solve the problem with pulldown. For DVD (MPEG-2) playback I use VLC, MPC or DScaler 5 DirectShow decoder.
For muxing your .m2v with audio I would try Muxman or DVDAuthor GUI. These programs only mux already created m2v with mp2, ac3 or dts audio. You can't feed them with Avisynth.

johnson911
8th August 2005, 22:58
Doh! I forgot that this video was 25fps and not 23.976. I'm assuming that the 2:3 pulldown increased the fps beyond 29.97, but windows and my DVD Player are playing it at 29.97, which is what caused the audio-synch issues and the extra time on the pulldown video? If I run a pulldown on a 23.976 fps video, it works fine.

I'm going to chalk up the m2v file playing normal on my last install to having elecard's mpeg2 decoder installed. I didn't think I installed it before, but I could be wrong. I can't think of any other reason, and since it's not actually affecting my final videos, I'll just ignore it.

If I'm wrong about why the 25fps video was having the video length increased after pulldown, please let me know. I'll search through the 50,000,000 PAL > NTSC threads now.

Thanks everyone!