L-SMASH-Works icon indicating copy to clipboard operation
L-SMASH-Works copied to clipboard

LWLibavSource crashes with specific file with VapourSynth

Open ChrisK2 opened this issue 9 years ago • 14 comments

When trying to decode sample.m2ts with latest LWLibavSource, it immediately crashes python. mpv plays the file fine and without decoder errors. FFMS2 also decodes it but discards the first frame (seems to be another bug).

OS X crash report lwi file

Script:

import sys
from subprocess import Popen, PIPE

import vapoursynth as vs
core = vs.get_core()

file = str("sample.m2ts")

video = core.lsmas.LWLibavSource(source=file)
video = core.std.Trim(clip=video, first=0, last=99)

#video.set_output(0)

cmd = ['x264', '-', '--frames', '100', '--input-csp', 'i420', '--demuxer', 'raw', '--input-depth', '8', '--input-res', '1920x1080', '--fps', '24000/1001', '-o', 'testencode.mp4', '--colorprim', 'bt709', '--colormatrix', 'bt709']

p = Popen(cmd, stdin=PIPE)
video.output(p.stdin)
p.communicate()

Using vspipe also leads to a crash.

ChrisK2 avatar Sep 27 '15 11:09 ChrisK2

Also happens on Linux (ubuntu). Too bad nobody cares.

ChrisK2 avatar Oct 15 '15 23:10 ChrisK2

I haven't test on Linux yet, but Windows 32bit build works with the VapourSynth R28 pre-built binaries with Python 3.5 (32bit) vps_32working_lsw

MaverickTse avatar Oct 16 '15 02:10 MaverickTse

Thanks for testing. I used self-compiled 64 bit Binaries built from git HEAD.

ChrisK2 avatar Oct 16 '15 10:10 ChrisK2

i get this on my archlinux 64bits

vspipe: src/core/vslog.cpp:73: void vsLog(const char*, long int, VSMessageType, const char*, ...): Assertion `false' failed.

VS R30 (from GIT) and lsmashsource r868 (from GIT)

with VSEdit can decode the firts 16 frames, in the frame 17,18 and 19 crash the program. the rest also can decode ok (from 20 to 99)

sl1pkn07 avatar Jan 27 '16 10:01 sl1pkn07

@sl1pkn07: The message printed just before that is what matters.

dubhater avatar Jan 27 '16 16:01 dubhater

└───╼  vspipe -y lsmash-test.vpy esee.raw
No frame returned at the end of processing by LWLibavSource
vspipe: src/core/vslog.cpp:73: void vsLog(const char*, long int, VSMessageType, const char*, ...): Assertion `false' failed.
Abortado (`core' generado)

gdb vsedit: http://sl1pkn07.wtf/paste/view/67a77488 gdb vspipe: http://sl1pkn07.wtf/paste/view/9c492a95

sl1pkn07 avatar Jan 27 '16 16:01 sl1pkn07

Try again with the latest lsmashsource. It should at least return a proper error now instead of crashing.

myrsloik avatar Jan 31 '16 22:01 myrsloik

Error: Failed to retrieve frame 17 with error: lsmas: failed to output a video frame.

in gdb:

[Inferior 1 (process 31105) exited with code 01]

sl1pkn07 avatar Jan 31 '16 22:01 sl1pkn07

And the other obvious question that will probably help me and/or the author. Does it work in avisynth?

myrsloik avatar Jan 31 '16 22:01 myrsloik

can confirm "works" (decoding without crash) in avsplus r1825 MT and lmashsource r859 (both 32bits) (wine staging 1.9.2)

but the frames 17, 18 and 19 have weird color, and i think corruptions

frame 16 frame 17 frame 18 frame 19 frame 20

i think the main problem is in the source instead of lsmashsource

sl1pkn07 avatar Jan 31 '16 23:01 sl1pkn07

Yes, it is. In avisynth it simply returns an uninitialized frame for many of the possible errors. So you get random memory which is usually a recycled previous frame. Definitely not what's expected either. If anything returning the most recent ok frame makes more sense if you want to do error concealing.

myrsloik avatar Jan 31 '16 23:01 myrsloik

With ffms2 eats that bad frames

lsmashsource (VS) frame22

and same frame whit ffms2 (VS) frame22

same behavior in (avs) frame22 frame22

all after removing the index files

sl1pkn07 avatar Feb 12 '16 00:02 sl1pkn07

I have found a workaround for this issue. My platform is 64 bit windows/64 bit VS, non Linux, but I get the same lsmas: failed to output a video frame error on most m2ts files that I open with vs lsmash - at the same frame, 17-19. It only occurs on m2ts files that have been remuxed with tsmuxer or clownbd. If I open the original 00800.m2ts or whatever, the error does not occur. The workaround is to use BDREBUILDER. If I remux (set to 50gb output), which will direct stream copy with this option, the error does not occur. Although bdrb uses tsmuxer, somehow it is using it differently or specifying different parameters. This doesn't help if you have already created the m2ts remuxes of course. I must also get around to trying a pure 32bit VS environment.

Cheers, Divxmaster

divxmaster avatar Dec 29 '16 19:12 divxmaster

Also found a way to fix m2ts files that you have already processed with tsmuxer or clownbd. In bdrebuilder, use the import -> video files option. This takes a while, but when it finally processes/loads it will have created a new 00000.m2ts file in the working directories. There is no need to tell bdrebuilder to 'save', you can just grab the temporary file. This file works fine with lsmas.

divxmaster avatar Dec 31 '16 19:12 divxmaster