Log in

View Full Version : ASF video loses 10 minutes on encoding with x264.


Vilx-
14th May 2012, 14:21
Short question:

I've got an ASF file with Windows Media Video/Audio in it. It's 52:54 in length. When I try to recode it with MeGUI to x264, it loses about 10-15 minutes of length. It becomes 40:05. The FPS is the same, and I've checked that the start and end are the same - no truncating. But the encoded frame count doesn't match. So where do these frames disappear? Are they dropped? Why? And how do I prevent that?

Long story, in hopes of additional hints:

A little while ago my wife was on radio (yay!). As it turned out, the radio station provides a live WMV video stream to the studio. Being the good geek I am, I ripped the whole interview with VLC media player. Before doing that I spent some research and found that the best(?) way to do it is to save it as a ASF file where the stream contents are directly dumped. Or at least that's what I think I did. Anyways, I now have a 160MB ASF file with 52:54 worth of video. The video quality is identical to that which I get from the live stream, so I guess I did that part right.

Unfortunately the ASF doesn't play well with the rest of the computer (neither at my workplace, nor home). Or maybe VLC has malformed it, I don't know. The fact is - whenever I come across the file in Windows Explorer, a dllhost.exe process starts up and goes into infinite loop, using up an entire CPU core until I kill it. After some research I found that it's the process which generates the thumbnails for Explorer. Thrilling. :P

So I'm trying to re-encode with x264 using latest MeGUI. But that's where things get really weird. First of all, trying to use YADIF on the movie (it's interlaced) produces a protected memory error. OK, whatever, I can live with the interlacing. But when I encode the movie, it loses about 10 minutes of playing time! Needless to say, the sound doesn't sync anymore. What I don't understand is where it disappears to. The start and end of the video seem to be there, and the FPS is the same. I also noticed in the LOG file that it has encoded 79377 frames - that's about 25,365 less than there should be, which matches the missing amount. But why, and how do I prevent that?

Here's the LOG file, which also includes the AviSynth script:

-[Information] Log for job1 (video, Wife.avs -> Wife.mkv)
--[Information] [2012.05.14. 15:50:06] Started handling job
--[Information] [2012.05.14. 15:50:06] Preprocessing
--[Information] [2012.05.14. 15:50:06] Avisynth input script
---[NoImage] # Load_Stdcall_Plugin("D:\Desktop\MeGUI_2112_x86\tools\yadif\yadif.dll")
---[NoImage] # LoadPlugin("D:\Desktop\MeGUI_2112_x86\tools\avisynth_plugin\TIVTC.dll")
---[NoImage] DirectShowSource("D:\Wife.asf", fps=33, audio=false, convertfps=false).AssumeFPS(33).LanczosResize(1080,324)
---[NoImage] #
---[NoImage] # Yadif(order=1)
---[NoImage] #crop
---[NoImage] #resize
---[NoImage] #denoise
--[Information] [2012.05.14. 15:50:07] Job commandline: "D:\Desktop\MeGUI_2112_x86\tools\x264\avs4x264mod.exe" --preset ultrafast --tune grain --crf 20 --keyint 330 --sar 1:1 --output "D:\Wife.mkv" "D:\Wife.avs"
--[Information] [2012.05.14. 15:50:07] Encoding started
--[Information] [2012.05.14. 15:56:21] Standard output stream
--[Information] [2012.05.14. 15:56:21] Standard error stream
---[NoImage] raw [info]: 1080x324p 1:1 @ 33/1 fps (cfr)
---[NoImage] x264 [info]: using SAR=1/1
---[NoImage] x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX
---[NoImage] x264 [info]: profile Constrained Baseline, level 3.1
---[NoImage]
---[NoImage] x264 [info]: frame I:241 Avg QP:17.18 size: 63245
---[NoImage] x264 [info]: frame P:79136 Avg QP:18.11 size: 11565
---[NoImage] x264 [info]: mb I I16..4: 100.0% 0.0% 0.0%
---[NoImage] x264 [info]: mb P I16..4: 0.5% 0.0% 0.0% P16..4: 66.3% 0.0% 0.0% 0.0% 0.0% skip:33.2%
---[NoImage] x264 [info]: coded y,uvDC,uvAC intra: 57.3% 66.5% 11.2% inter: 43.2% 26.5% 2.7%
---[NoImage] x264 [info]: i16 v,h,dc,p: 30% 36% 20% 13%
---[NoImage] x264 [info]: i8c dc,h,v,p: 35% 32% 20% 13%
---[NoImage] x264 [info]: kb/s:3094.48
---[NoImage] encoded 79377 frames, 212.46 fps, 3094.48 kb/s
--[Information] Final statistics
---[Information] [2012.05.14. 15:56:21] Constant Quality Mode: Quality 20 computed...
---[Information] [2012.05.14. 15:56:21] Video Bitrate Obtained (approximate): 2346 kbit/s
--[Information] [2012.05.14. 15:56:21] MediaInfo
---[Information] File: D:\Wife.mkv
---[Information] General
----[Information] Format: Matroska
----[Information] FormatString: Matroska
----[Information] FileSize: 930997606
----[Information] PlayTime: 00:40:05.364
---[Information] Video
----[Information] ID: 1
----[Information] StreamOrder: 0
----[Information] Width: 1080
----[Information] Height: 324
----[Information] FrameCount: 79377
----[Information] FrameRate: 33.000
----[Information] ScanType: Progressive
----[Information] Codec: V_MPEG4/ISO/AVC
----[Information] CodecString: AVC
----[Information] Format: AVC
----[Information] AspectRatio: 3.333
----[Information] AspectRatioString: 3.333
----[Information] Delay: 0
----[Information] Title:
----[Information] Language: en
----[Information] LanguageString: English
--[Information] [2012.05.14. 15:56:21] Postprocessing
---[Information] Deleting intermediate files
--[Information] [2012.05.14. 15:56:21] Job completed

Ghitulescu
14th May 2012, 14:41
maybe if you demux it first you can see whether the stream was defective or not ...

sneaker_ger
14th May 2012, 14:44
What happens if you set "convertfps" to "true" in your script?

Vilx-
14th May 2012, 14:59
Ghitulescu - I found a demuxer, but how do I check for health?

sneaker_ger - then nothing works anymore; errors are thrown, and conversion is instantaneous and produces a 32KB file. However I just found that if I also specify "seekzero=true", then suddenly "convertfps=true" also works, and even Yadif() produces the expected result! I'm converting now to see what happens. About 1 hour left...

Ghitulescu
14th May 2012, 15:11
I thought you need the audio. A radio does not broadcast video AFAIK :). To test an audio file, simply convert it with eac3to, it should spit out errors in case there are some.

Vilx-
14th May 2012, 15:22
As I said, this radio also offers a live video stream through the Internet, which is what I ripped. ;)

OK, seekzero didn't work out so well. It started fine, but became slower and slower. Then I realized that the problem was indexing - the ASF is not indexed (anyone know how to do it?), but apparently the encoder tried to seek the video stream every couple dozen frames, which resulted in AviSynth reparsing it from the start. I was about 25% done when I cancelled. I don't think it would have completed this week. :P

I'll try now with seek=false. That works too, but I'm not sure what side-effects there might be.

sneaker_ger
14th May 2012, 15:31
33 fps seems very strange, btw. More likely to be 29.97 (30/1.001) fps.

You may also want to try ffmpegsource (http://code.google.com/p/ffmpegsource/) instead of DirectShowSource, depending on how broken that file actually is. ( ffvideosource("d:\wife.mkv", fpsnum=30000, fpsden=1001) )

Vilx-
14th May 2012, 15:43
OOps, my bad. It was 30.0003, to be precise (or that's what VLC media player tells me). Anyways, will ffpmegsource be able to read ASF's?

sneaker_ger
14th May 2012, 15:45
Anyways, will ffpmegsource be able to read ASF's?

It may or may not be able to. Try it, if DirectShowSource doesn't work out.

Vilx-
14th May 2012, 15:57
Wow, kudos to you! It does! :) And it automatically generates an index too! Looks like this will work perfectly! :)

Vilx-
14th May 2012, 16:01
I'm still confused about the framerate though. VLC reports it as 30, but there are 79397 total frames, which gives a clean 25fps. I'm trying now without any fps hints to see what will come out of that.

Update: It worked, and it's a nice 25fps video. Go figure. Well, I'll go with 25, since it's the standard around these here parts anyway. Thanks everyone! :)

Vilx-
14th May 2012, 16:48
Aaaaaand a bit of searching finds the answer: http://forum.doom9.org/showthread.php?p=907867#post907867

After dumping the timecodes with wmvtimes.exe it seems that I indeed have a clean 25fps video. No idea where VLC got the idea about 30. I guess that was the main misleading information in all of this.