Log in

View Full Version : Image Corruption


MysteryX
20th November 2015, 18:35
I'm currently using this script to play a video with 432hz audio pitch
PluginPath=""
LoadPlugin(PluginPath+"ffms2.dll")
LoadPlugin(PluginPath+"TimeStretch.dll")
SetMTMode(3,4)
FFmpegSource2(source="Medicine for the People.mp4", atrack=-1, cacheFile="Player.avs.ffindex", threads=1)
ConvertToYV12()
SetMTMode(2)
ResampleAudio(48000)
TimeStretchPlugin(pitch = 100.0 * 0.98181819915771484)


It is not ideal, but it is working pretty well as is the best option I found so far. Audio and video may sometimes go out of sync but it's holding pretty well.

It's working for 96% of the videos, but then there is an occasional video that causes the video to show corrupt, but only when also using SVP.

http://s20.postimg.org/ew5cth5cp/Player.jpg (http://postimg.org/image/ew5cth5cp/)

If I turn SVP (Smooth Video Project) off, then the image appears good, and when I turn it back on, then it shows up corrupt again. Only a few videos have this problem.

Here's one video that fails
https://www.youtube.com/watch?v=Nwh3Kc-Nta0

Here are the streams I have downloaded

Video: MPEG4 Video (H264) 854x480 29.97fps 1082kbps [V: h264 main L3.1, yuv420p, 854x480, 1082 kb/s]
Audio: AAC 44100Hz stereo 253kbps [A: SoundHandler (aac lc, 44100 Hz, stereo, 253 kb/s)]

When playing through the AVS script, here's how MPC-HC sees the streams

Video: I420 854x480 29.97fps [V: rawvideo, yuv420p, 854x480]
Audio: IEEE Float 48000Hz stereo 3072kbps [A: pcm_f32le, 48000 Hz, 2 channels, fp32, 3072 kb/s]

Any idea what's going on here?

Groucho2004
20th November 2015, 18:49
What happens when you disable MT?

MysteryX
20th November 2015, 18:54
What happens when you disable MT?
Same.

It seems to work most of the time when using the external TV, and it fails most of the time when using my laptop's display. In which case, if I disable SVP, the image appears OK but the audio is out of sync.

Groucho2004
20th November 2015, 19:13
A width of 854 is only mod2, maybe something in the chain requires mod4 or better.

wonkey_monkey
20th November 2015, 19:15
Add "info" to your Avisynth script and have a look at the "Video pitch:" information. Is it different for the video that exhibits the issue?

Or what Groucho said. I assumed all of the videos were 854x480, but if some are instead 852x480, that would explain why some work and some don't.

LemMotlow
20th November 2015, 19:35
856x480 is mod16, mod8, and mod4. Some encoders/decoders have problems with mod2. Some Avisynth filters want mod8.

MysteryX
20th November 2015, 20:25
Now that's interesting. On my laptop screen, all videos appears corrupted with SVP and it's working if I turn SVP of.

But for the video I posted above, that one still appears corrupt on my laptop display even with SVP off.

So it seems it's corrupting at 2 places. If I have that corrupt video + SVP on my laptop, even if it has a "double corruption", it looks the same as when it has only 1 corrupt factor.

With Windows Media Player, however, the video appears fine, even with SVP.

Here's the video info with WMP
http://s20.postimg.org/6jc45g7yx/Video_Info.jpg (http://postimg.org/image/6jc45g7yx/)

MysteryX
20th November 2015, 20:34
MAG79 of SVP said that LAV decoder wasn't being used because it wouldn't output Float32 audio, and that would be problem. But then I don't know why it's not using it nor how to change it.

raffriff42
21st November 2015, 06:22
A width of 854 is only mod2, maybe something in the chain requires mod4 or better.Agreed; the picture skew is an indicator of this.
I have had problems with 854 before - try 848 (which is mod (http://avisynth.nl/index.php/Modulo)16, 8, 4 & 2). FFmpegSource2(...)
#Crop(3, 0, -3, 0) ## if source is YV24 or RGB
Crop(4, 0, -2, 0) ## otherwise
ConvertToYV12()

foxyshadis
21st November 2015, 21:15
What renderer are you using? If SVP isn't the culprit, and Avisynth is up to date, it most likely has to be either ffmpegsource (unlikely) or the renderer.

MysteryX
22nd November 2015, 00:39
Agreed; the picture skew is an indicator of this.
I have had problems with 854 before - try 848 (which is mod (http://avisynth.nl/index.php/Modulo)16, 8, 4 & 2). FFmpegSource2(...)
#Crop(3, 0, -3, 0) ## if source is YV24 or RGB
Crop(4, 0, -2, 0) ## otherwise
ConvertToYV12()
That works...

MysteryX
22nd November 2015, 06:12
Here's another video that appears corrupt, only when adding SVP into the mix. This one doesn't have the padding limitation
https://www.youtube.com/watch?v=YOnAVn6iRf8

Video info
Video: MPEG4 Video (H264) 1280x720 24fps [V: h264 high L3.1, yuv420p, 1280x720 [default]]
Audio: AAC 44100Hz stereo [A: aac lc, 44100 Hz, stereo [default]]

Stream info when using AVS script
Video: I420 1280x720 24fps [V: rawvideo, yuv420p, 1280x720]
Audio: IEEE Float 48000Hz stereo 3072kbps [A: pcm_f32le, 48000 Hz, 2 channels, fp32, 3072 kb/s]


and another video that has image corruption
Video: Windows Media Video 9 640x360 25fps 736kbps [V: English [eng] (wmv3 main, yuv420p, 640x360, 736 kb/s)]
Audio: WMA 2 44100Hz stereo 64kbps [A: English [eng] (wmav2, 44100 Hz, 2 channels, 64 kb/s)]

MysteryX
22nd November 2015, 16:12
OK if I disable auto-crop in SVP3, then it works.

SVP4 won't have these padding issues.

MysteryX
22nd November 2015, 21:24
Agreed; the picture skew is an indicator of this.
I have had problems with 854 before - try 848 (which is mod (http://avisynth.nl/index.php/Modulo)16, 8, 4 & 2). FFmpegSource2(...)
#Crop(3, 0, -3, 0) ## if source is YV24 or RGB
Crop(4, 0, -2, 0) ## otherwise
ConvertToYV12()
What would be an AviSynth script to ensure the video has a certain padding? I could start like this, but then I'm not sure about specific technical details you guys may be more familiar with. The idea is to have a short script that ensures the video will remain valid when passing it through the processing chain. And then I can crop, or I could also pad.

Align=8
CropW=FMod(Width, Align)
Crop(...)

raffriff42
22nd November 2015, 22:31
See the thread, "Evenly padding to mod8/16?"
http://forum.doom9.org/showthread.php?t=172577

Especially my function, UUSize4 :)
http://forum.doom9.org/showthread.php?p=1739635#post1739635

MysteryX
23rd November 2015, 05:11
See the thread, "Evenly padding to mod8/16?"
http://forum.doom9.org/showthread.php?t=172577

Especially my function, UUSize4 :)
http://forum.doom9.org/showthread.php?p=1739635#post1739635
This is for live processing; what about the efficiency of that method?

raffriff42
23rd November 2015, 08:09
This is for live processing; what about the efficiency of that method?It's good enough. There is basically no effect on speed.