Ajatt-Tools / mpvacious

🍜 Adds mpv keybindings to create Anki cards from movies and TV shows.
https://tatsumoto-ren.github.io/blog/mining-from-movies-and-tv-shows.html
GNU General Public License v3.0
566 stars 51 forks source link

image_field fail to export to anki #24

Closed danielhuangsw closed 3 years ago

danielhuangsw commented 3 years ago

Environment:

Describe the bug image_field fail to export to anki when updating the last added card with binding m.

sub2srs.conf file:

# Anki
deck_name=sentence mining 
model_name=Migaku Japanese
sentence_field=Expression
audio_field=Audio
image_field=Image
note_tag= 

#Media quality
# tried with snapshot_format=jpg, resulting in the same error
snapshot_format=webp 

output from terminal:

Resuming playback. This behavior can be disabled with --no-resume-playback.
 (+) Video --vid=1 (*) (h264 1920x1080 23.976fps)
 (+) Audio --aid=1 --alang=jpn (*) (eac3 2ch 48000Hz)
 (+) Subs  --sid=1 --slang=jpn (subrip)
AO: [pulse] 48000Hz stereo 2ch float
[modules] Deck sentence mining : check completed. 
VO: [gpu] 1920x1080 yuv420p
[subs2srs] Deck sentence mining : check completed. 
(Paused) AV: 00:06:25 / 00:22:52 (28%) A-V:  0.000
[subs2srs] Timings have been set to the current sub. 
(Paused) AV: 00:06:25 / 00:22:52 (28%) A-V:  0.000
[subs2srs] Note #1614754854560 updated. 
(Paused) AV: 00:06:25 / 00:22:52 (28%) A-V:  0.000
[subs2srs] mpv: ../video/zimg.c:241: repack_entrypoint: Assertion `!(i & (mp_repack_get_align_y(r->repack) - 1))' failed.
A: 00:06:27 / 00:22:52 (28%) {0.0min 16.97x 0.0MB}
[subs2srs] Couldn't store file 'BeastarsS208_06m25s176ms.jpg': [Errno 2] No such file or directory: '/tmp/BeastarsS208_06m25s176ms.jpg'
[subs2srs] File stored: 'BeastarsS208_06m25s051ms-06m27s427ms.ogg'. 
(Paused) AV: 00:06:25 / 00:22:52 (28%) A-V:  0.000

To Reproduce Steps to reproduce the behavior:

  1. add expression with yomichan anki integration
  2. press binding a, c and m
  3. Anki browse window pop up with broken image icon on image_field

Expected behavior Anki browse window pop up with sentence_field, audio_field and image_field imported.

Screenshots image

tatsumoto-ren commented 3 years ago

Check if your build of mpv supports image encoding.

mpv 'test_video.mkv' --loop-file=no --frames=1 -o='test_image.jpg'

If it succeeds, it's a bug in mpvacious. If not, you have to install a build of mpv with the appropriate support.

danielhuangsw commented 3 years ago

Here is the output from terminal:

Disabling audio (not supported by target format).
 (+) Video --vid=1 (*) (h264 1920x1080 23.976fps)
     Audio --aid=1 --alang=jpn (*) (eac3 2ch 48000Hz)
     Subs  --sid=1 --slang=jpn (subrip)
[autoconvert] Converting yuv420p -> yuvj422p
mpv: ../video/zimg.c:241: repack_entrypoint: Assertion `!(i & (mp_repack_get_align_y(r->repack) - 1))' failed.
mpv: ../video/zimg.c:241: repack_entrypoint: Assertion `!(i & (mp_repack_get_align_y(r->repack) - 1))' failed.
Aborted

This test has failed, thus it's not a bug in mpvacious.

Thanks for the test case!

danielhuangsw commented 3 years ago

I solved the issue by reinstalling mpv from Ubuntu PPA listed in https://mpv.io/installation/

I believe the bug from https://github.com/mpv-player/mpv/issues/8433 is contributing to the issue. I've updated the the dependency libzimg2 from 2.9.1 to 3.0.1 which can be downloaded from https://launchpad.net/~savoury1/+archive/ubuntu/multimedia/+build/20145772 for Ubuntu 18.04.

Successful output is as follow:

(Paused) AV: 00:06:39 / 00:22:52 (29%) A-V:  0.000
[modules] Note #1614781383665 updated. 
(Paused) AV: 00:06:39 / 00:22:52 (29%) A-V:  0.000
A: 00:06:39 / 00:22:52 (29%) {0.0min 18.08x 0.0MB}
[modules] File stored: 'BeastarsS208_06m38s564ms-06m39s774ms.ogg'. 
[modules] File stored: 'BeastarsS208_06m39s065ms.jpg'. 
(Paused) AV: 00:06:39 / 00:22:52 (29%) A-V:  0.000
tatsumoto-ren commented 3 years ago

I'm happy to see the issue resolved. To prevent it in the future I'll add a note in the readme.