learningequality / sushi-chef-khan-academy

Content integration script for the Khan Academy Kolibri channels.
https://www.khanacademy.org/
MIT License
2 stars 10 forks source link

Certain videos from KA cdn have low audio quality #7

Closed ivanistheone closed 4 years ago

ivanistheone commented 5 years ago

Certain KA videos have "muffled" sound. The problem is the the original source file we get from the KA API, e.g. https://cdn.kastatic.org/KA-youtube-converted/Rd4a1X3B61w.mp4-low/Rd4a1X3B61w-low.mp4

This file has Audio: aac (LC) (mp4a ), 8000 Hz, mono, fltp, 35 kb/s settings for some reason.

Context:

  1. http://community.learningequality.org/t/audio-quality-concerns-using-kolibri/934
  2. KA bulgarian sample video with bad quality

Possible solutions would be to use a higher-quality format option form the API or get form youtube.

ralphiee22 commented 5 years ago

so then the video will still have a muffled sound even if we download them from a higher resolution version? https://cdn.kastatic.org/KA-youtube-converted/Rd4a1X3B61w.mp4/Rd4a1X3B61w.mp4

ivanistheone commented 5 years ago

@ralphiee22 High res video seems to have good audio 44.1khz:

    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 795 kb/s, 30 fps, 30 tbr, 30 tbn, 60 tbc (default)
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 46 kb/s (default)

Obtained via:

  1. wget "https://cdn.kastatic.org/KA-youtube-converted/Rd4a1X3B61w.mp4/Rd4a1X3B61w.mp4"
  2. ffprobe Rd4a1X3B61w.mp4
ralphiee22 commented 5 years ago

Does running the pressurecooker compression degrade the audio quality, or only the video resolution, or both?

ivanistheone commented 5 years ago

Pressurecooker --compress does a 32kb/sec rate limit for audio too, but that does not lead to noticeable quality degradation. [I previously thought the 32k limit was the cause, but after some tests realized that's not it]

indirectlylit commented 5 years ago

another report of low quality audio: https://github.com/learningequality/kolibri/issues/5466

ArthurMafra commented 5 years ago

I do also have very poor video and audio quality on kolibri that makes it impossible to use. Ka Lite does not suffer from it and downlaod with pretty good quality. Is it possible to disable encoding?

ivanistheone commented 4 years ago

We have found the root cause and developed a fix the video quality issues.

Cause: The bad video quality problems were caused by upstream source problems (for efficiency we were downloading pre-compressed videos from KA servers, some of which had very low video and audio quality).

Fix: Stop using these pre-compressed video files, and instead download the 480-resolution videos directly from youtube. An additional lightweight post-processing step is applied to the videos to compress audio track to 32kbps, mono.

Example old video: https://kolibri-catalog-en.learningequality.org/en/learn/#/topics/c/ae717c0d89b25770ba031f68075eba5c

Example new video: https://kolibri-catalog-en.learningequality.org/en/learn/#/topics/c/c14e2df589ce522bb038370ebc389fbc

This improvement in video quality causes around 50% increase in file size (e.g. the above examples, the video file changes from 3MB to 4.7MB), which means the Khan Academy English channel will increase in size from 47GB to around 70GB.

Over the next months we'll be rolling out the fixed video updates to all KA channels in the following order:

The main Khan Academy (English) channel will be updated last (to avoid surprising users with a forced download 70GB of videos). Until then users interested in accessing the high resolution videos can download the new channel Khan Academy (English - US curriculum) (channel_id = c9d7f950ab6b5a1199e3d6c10d7f0103).

indirectlylit commented 4 years ago

FYI - https://github.com/learningequality/kolibri/issues/3834 is one of our highest-traffic pages:

image

I assume that's due to H.264?

ivanistheone commented 4 years ago

This issue is now resolved.

For accessing KA English channel with better quality videos, import one of the following channels:

The old channel KA channel will not be updated so as not to force users to download a very large update (every single video would have to be re-imported).