Mp4 video on Anki iOS does not track with its audio

Hi,

I am using the latest versions of Anki on iOS and Mac.

My issue is similar to this thread:

For some mp4 videos (which a few months ago seemed to work fine) the video lags behind the sound. If you can, please have a look at my card with ID 1702712958521. These videos play fine on iOS generally.

Thank you,
Nick

1 Like

I tried the card/video you mentioned, but it seems to play correctly for me - I jumped to a few points in the video, and the audio matched up with the computer version. I then tried letting it play from start to finish, and the audio still appeared to be correct.

Does restarting your device help? If you’re using wireless headphones, does using the phone speaker make a difference?

1 Like

Thank you for your help.
I think you’re right, the issue may be with my phone (iPhone SE 2020, purchased at the end of 2020). I tested the card with my wife’s phone (iPhone 12 Pro) and there was no problem.
(Restarting my device did not help. Using the phone speaker did not help.)
Recently my phone has been overheating while playing some mp4 videos with Anki. Maybe these issues are all connected.
This forum post suggests reformating some of my videos may help.
I also found this video (iPhone SE 2020 Video Codec & File Problems With H.264 H.265 MOV & HEVC Corruption & Playback Issues) which suggests there may be some issues with recording videos on some iPhones.
I suppose the easiest way to avoid these problems is to get a new phone? Do you have any other suggestions?
Thanks again for all your work.

UPDATE:
Running this on the video file seems to fix the problem (I’m not sure though exactly what it does):
ffmpeg -i input.mp4 -vcodec libx264 -pix_fmt yuv420p -profile:v baseline -level 3 output.mp4

It looks like it re-encodes the video with a different codec.
https://ffmpeg.org/ffmpeg.html

Re-encoding the videos seems like a better option than replacing a phone that is otherwise working well. As for why it fixes the problem, my guess is that it’s switching to a video format that is less resource intensive to decode.

1 Like

Hi again, the problem is back. It seems re-encoding does not fix my issue.
I re-encoded my .mp4 videos with a bash script which uses this command:

ffmpeg -i "$input_file" -vcodec libx264 -acodec aac -vf "scale=-2:320" -b:v 800k -b:a 128k -r 15 "$output_file"

As before, the videos play fine from the Files app on my iPhone, but they generally don’t play in Anki. A few play OK, the rest don’t. I can’t work out why some videos work and others don’t. It doesn’t seem to relate to file size.
The videos play fine in Safari on my iPhone when I access them through Google Drive or Dropbox. Do you know what it might be about the Anki browser in the iPhone that is more resource intensive?

So it’s consistently an issue with particular files? Can you tell me the name of the smallest file that demonstrates the problem? I’ll try again to reproduce the issue here, as that will hopefully offer some insight into why this is happening.

I’ve realised that the ffmpeg command seems to have made the video file sizes larger, so I’ve switched back to my original videos.

These videos play OK on Anki preview on my iPhone:
“04 Picture Lesson Four (Greek).mp4” (32.3 MB)
“06 Picture Lesson Six (Greek).mp4” (32.4 MB)
“03 Picture Lesson Three (Greek).mp4” (32.7 MB)
“07 Picture Lesson Seven (Greek).mp4” (34.5 MB)
“10 Picture Lesson Ten (Greek).mp4” (35.6 MB)
“Kiamat Sudah Dekat part 5a.mp4” (12.3 MB)
“Kiamat Sudah Dekat part 5b.mp4” (53.9 MB; but video does not track with audio)
“08 Picture Lesson Eight (Hebrew).mp4” (16.8 MB)
“Bab 3 Keunikan Tradisi Masyarakat Tiongkok Dalam Perayaan Tahun Baru Imlek - NET 10.mp4” (43 MB)
“08q Quiz Lessons 7&8 (Hebrew).mp4” (3.8 MB)
“Alphabet List 1 (Hebrew).mp4” (13.5 MB)

These videos do not play properly on Anki preview on my iPhone:
“04 Picture Lesson Four (Hebrew).mp4” (40.4 MB; freezes while starting)
“01 Picture Lesson Four (Hebrew).mp4” (36.3 MB; freezes while starting)
“02 Picture Lesson Two (Hebrew).mp4” (33.5 MB; freezes while starting)
“Kiamat Sudah Dekat part 1a.mp4” (26.1 MB; freezes while starting)
“Kiamat Sudah Dekat part 1b.mp4” (23.7 MB; freezes while starting)
“Kiamat Sudah Dekat part 2a.mp4” (19.5 MB; freezes while starting; once: video starts but then audio cuts out)
“Kiamat Sudah Dekat part 2b.mp4” (25.2 MB; freezes while starting)
“Kiamat Sudah Dekat part 3.mp4” (25.8 MB; freezes while starting)
“Kiamat Sudah Dekat part 4.mp4” (21.2 MB; freezes while starting)
“Kiamat Sudah Dekat part 6.mp4” (27.6 MB; freezes while starting)
“Kiamat Sudah Dekat part 7.mp4” (34.7 MB; freezes while starting)
“Kiamat Sudah Dekat part 8.mp4” (35.5 MB; freezes while starting)
“bipa 5 bab 2.3 laela sari.mp4” (77.1 MB; freezes while starting)
“10q Quiz Lessons 9&10 (Hebrew).mp4” (19.8 MB; video starts but then audio cuts out)
“Mitos part 7.mp4” (19.6 MB; video starts but then audio cuts out)
“Mitos part 4.mp4” (16.7 MB; video starts but then audio cuts out)
“Mitos part 2.mp4” (15.5 MB; video starts but then audio cuts out)

I can’t see an obvious pattern.

It’s possible that some changes made in the beta version of AnkiMobile have already resolved this. The stable release should be rolling out to users over the next week or so, but if you drop me a private message (here or on anki.tenderapp.com), I can send you a beta invite so you can try it immediately.

I’ve been having this same issue since I switched to a new iphone 15 around 2 months ago. My iPhone XS max video and audio tracked just fine, but all the same videos track behind the audio on the iphone 15. The video is choppy and slow as well.

@dae in your last post you mention a beta that may resolve this. Will that be released soon? Or is it possible to somehow install the beta?

24.07 was released as stable a few days ago, so you should be able to grab it from its app store page if it hasn’t automatically downloaded yet. Does it resolve the problems for you?

It seems to be working fine for me now. Thank you so much. I will let you know if I notice any issues.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.