animebook / animebook.github.io

In-browser video player for learning Japanese with subtitles
https://animebook.github.io
MIT License
268 stars 30 forks source link

[Bug] Error message with certain video types #48

Closed msw93 closed 2 years ago

msw93 commented 2 years ago

It seems that the extension has issues with certain video types. When I try to export the sentence to I get the following error message.

image

I think this is likely due to the video type because of error message?

I've also tried using same srt with different video file and its no problem. Here is this videos codec info! image

soamsy commented 2 years ago

There's a still jpg embedded into the video as an MJPG that animebook's ffmpeg is seeing and trying to use incorrectly. It looks like a BD cover. image

For a quick fix, you should get rid of the MJPG stream 1 from the files you converted. One way I know how to do this is to copy every stream that isn't stream 1 using ffmpeg's -map option.

ffmpeg -i {INPUT}.mkv -map 0:0 -map 0:2 -map 0:3 {OUTPUT}.mkv

Note how there isn't a -map 0:1

soamsy commented 2 years ago

And weirdly enough, I couldn't reproduce this until I converted the video's JP audio to aac. When I used the original video (which oddly enough uses aac for English) I could still make English audio flashcards, despite the MJPG still being there. It might have to do with the 'duration' field disappearing when these videos get run through your conversion script, since the MJPG technically had a duration of like 1/100 of a second before conversion.

msw93 commented 2 years ago

I forgot to mention that I converted the files 🤣, good catch

I think you command you sent works, but its so slow on my computer 😞, is this normal?

image

msw93 commented 2 years ago

I think I figured everything out and I hate myself because its almost 1am lol

I used this aac.bat script to convert original video file FOR %%i IN (%*) DO ffmpeg -i "%%~fi" -map 0:v -map 0:a -c:v copy -c:a aac "%%~di%%~pi%%~ni_converted%%~xi"

This adds the shitty bluray cover in ffmpeg's auto mapping. Switching over to your command was too slow but if I specify the codec to be copy it only takes seconds.

ffmpeg -i {converted_output}.mkv -map 0:0 -map 0:a -c:v copy -c:a copy {input}.mkv

Here is output codec, of the twice converted file. image

and the speed image

soamsy commented 2 years ago

Congrats, and sorry about that 🙃

I was only testing with one file, so I didn't realize putting -c:v copy -c:a copy would make it faster. Good to know.