Bulk compress videos already uploaded to Studio?

I am asking this here should someone in the future run into a similar issue:

I have teachers who have already uploaded HD videos into Studio. Is it possible to have those bulk compressed to the recommended Gmail Large 3 Minutes 720p30 setting on the Studio side?

I looked around and there is mention of a “ricecooker” program that can be run, but that looks like something done on the LE end and not the local end.

As a point of note: I installed Kolibri on Windows as a test, and installed Handbrake with the CLI. I attempted to bulk convert the files found in the “Content” folders after importing them from Studio, but the info I had found for bulk compression via folder recursion failed despite multiple edits to the command line for Windows. I can, however, compress one video at a time, delete the exiting video, then move the compressed one into the same folder on the Kolibri server. Since the filename is the same, the database finds it and is none the wiser, so far as I can tell. That’s just a laborious and time-wasting effort, I feel.

Thanks, as always, for any help and guidance.

Hi @swaectech

We don’t currently have a way to compress videos already uploaded to Studio. The reason for this is video compression takes a very long time and not suitable for online servers—even on a powerful desktop computer, video compression can take hours.

The best way to get small videos files is to compress them locally using handbrake or one of the automated scripts that call ffmpeg, and upload the compressed version to Studio.

a “ricecooker” program that can be run, …

Yes ricecooker can help you with this. Assuming you have all the local files on your computer and you know a little bit of Python, then you can bulk-upload the videos by specifying the info for each video like this. Once you have prepared the python script, if you run it by specifying --compress argument on the command line, each of the videos will be processes with ffmpeg before uploading to Studio.

If this is something you might want to try, you should read the Getting Started tutorial for step-by-step info about how this works.

Note uploading content via ricecooker can only be used to create new channel and not to “update” existing channels, but you can later use the “Import from Channel” to organize the videos in Studio any way you want.

compress one video at a time, delete the exiting video, then move the compressed one into the same folder on the Kolibri server.

Nice hack! Yes once the files are already on Kolibri (in the content/storage/ directory) you can replace them with compressed version (so long as you keep the same filename) and Kolibri will play the new ones. I wouldn’t recommend this approach though, since the changes you make are only for this device and you will not be able to export or share the files to another computer. This is because Kolibri does an integrity check to ensure the file contents match the filename, so if you’ve changed the file Kolibri will think the file is incomplete or corrupted).

Ivan

Ivan, thank for the info/update. I definitely understand not converting on Studio after-the-fact now. Thanks for the explanation.

As for converting afterward on the local Kolibri, I just want to make sure I understand:

If I compress the files on the “master” Kolibri server, then attach a student Pi with Kolibri, import the “Master” channel onto the student device, the “master” Kolibri will report an error since the local file doesn’t match the Studio file and/or report an error because the newly compressed version doesn’t match the checksum in the “master” server, coorect?

If the above is true in either case, then handling content already in Studio would entail compressing all of the existing videos locally and reuploading them to the appropriate channels under the associated accounts in Studio, correct?

Hi David,

If I compress the files on the “master” Kolibri server, then attach a student Pi with Kolibri, import the “Master” channel onto the student device, the “master” Kolibri will report an error since the local file doesn’t match the Studio file and/or report an error because the newly compressed version doesn’t match the checksum in the “master” server, coorect?

Yes, that is correct, though I believe it would be the student’s Pi machine doing the check and reporting the error instead of the server. (i.e. the student’s Pi machine will think there was an error when downloading the content from the server.)

If the above is true in either case, then handling content already in Studio would entail compressing all of the existing videos locally and reuploading them to the appropriate channels under the associated accounts in Studio, correct?

Yes, that’s correct! Also, once you’ve done that and published the changes, if you have the channel imported already on some devices, make sure to update it on those devices to get the updated videos.