Skip to content

Documentation regarding the transition to WebM format (for videos) learningequality#338#554

Closed
Mamatha1718 wants to merge 4 commits intolearningequality:developfrom
Mamatha1718:documentation
Closed

Documentation regarding the transition to WebM format (for videos) learningequality#338#554
Mamatha1718 wants to merge 4 commits intolearningequality:developfrom
Mamatha1718:documentation

Conversation

@Mamatha1718
Copy link
Copy Markdown

@Mamatha1718 Mamatha1718 commented Dec 31, 2024

Summary

Description of the change(s) I made

I added detailed guidance for WebM compression to enhance the documentation and provide users with clear instructions. This includes:

  1. WebM Compression Guidelines:

Recommendations for using the VP8 video codec and vorbis audio codec for compatibility.
File size suggestions for different video lengths and resolutions.
An example ffmpeg command for compressing WebM files.
2. Using the ffmpeg Helper Scripts for WebM:

Explained how to adapt the existing MP4 compression scripts for WebM by modifying file extensions.
3. HandBrake for WebM:

Provided instructions on how to use HandBrake for compressing WebM files indirectly via MP4 conversion.
4. Experimenting with WebM Compression:

Included guidance on tweaking parameters like crf to optimize video quality and file size.

Guidance:

This PR enhances WebM video compression documentation by including:

=> Detailed steps for using VP8 and vorbis codecs, file size recommendations,
and an ffmpeg command example.
=> Adaptations for using existing MP4 helper scripts for WebM.
=> HandBrake usage instructions for indirect WebM compression.
=> Tips for fine-tuning crf values for optimal compression.

References

Closes #338

Comments

This PR aims to comprehensively address WebM compression requirements. Please review and let me know if additional updates or clarification needed.

@akolson
Copy link
Copy Markdown
Member

akolson commented Dec 31, 2024

Hi @Mamatha1718, Could you add some guidance about the pr to enable us to review the pr more effectively? I have edited the above template so you can provide more description. Thanks!

@Mamatha1718
Copy link
Copy Markdown
Author

Hi @akolson ,
Thank you for your feedback. I’ve added detailed guidance about WebM compression to improve the documentation.
Here's an overview of the additions=>
=>WebM Compression Guidelines:

Added steps for compressing WebM videos using ffmpeg, including recommended codecs (VP8 and vorbis) and compression best practices for different video lengths and resolutions.
Included an example ffmpeg command for compressing WebM files.
=>Using the ffmpeg Helper Scripts for WebM:

Explained how existing scripts for MP4 compression can be adapted for WebM by simply changing the file extension.
=>HandBrake for WebM:

Mentioned the possibility of using HandBrake for WebM by converting to MP4 first and re-encoding with ffmpeg.
=>Experimenting with WebM Compression:

Encouraged users to experiment with parameters like crf to achieve the right balance between quality and file size.
Let me know if there are any additional changes or clarifications needed. Thanks!

@akolson
Copy link
Copy Markdown
Member

akolson commented Dec 31, 2024

Hi @Mamatha1718 I tagged you where you need to add the guidance. Click to edit the description. There are also additional instructions about what you need to add in the (markdown) comments. Thanks

@Mamatha1718
Copy link
Copy Markdown
Author

Hi @akolson,
I noticed you tagged me to add guidance to the description, but I'm unable to find an option to edit the description in the PR. There doesn't seem to be a button or an editable field for me to update it. Could you please clarify whether I should update the commit message or if there's another way to add the guidance?
Thanks for your help!

@akolson
Copy link
Copy Markdown
Member

akolson commented Dec 31, 2024

Please see the image below for guidance.

image

@Mamatha1718
Copy link
Copy Markdown
Author

Hi @Mamatha1718 I tagged you where you need to add the guidance. Click to edit the description. There are also additional instructions about what you need to add in the (markdown) comments. Thanks
Hi @akolson , I added the guidance. will you please let me know any changes required.
Thank you!

@MisRob MisRob requested a review from jredrejo January 16, 2025 15:35
Copy link
Copy Markdown
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Mamatha1718 thanks for the pull request. I am a little confused as to how you managed to get this to work though. I ran this exact command locally:

ffmpeg -i tests/testcontent/downloaded/low_res_video.webm -b:a 32k -ac 1 -vf scale="'w=-2:h=trunc(min(ih,480)/2)*2'" -crf 32 -profile:v baseline -level 3.0 -preset slow -v error -strict -2 -stats -movflags faststart -y outputfile.webm

and got the following error:

[libvpx-vp9 @ 0x17b89b40] [Eval @ 0x7ffe8ed2d7a0] Undefined constant or missing '(' in 'baseline'
[libvpx-vp9 @ 0x17b89b40] Unable to parse option value "baseline"
[libvpx-vp9 @ 0x17b89b40] Error setting option profile to value baseline.
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

On closer inspection, it appears that this might just be the current mp4 command copy pasted but with a webm file extension as the input and the output, which will not work.

We asked you in the issue to please test the functions you were putting into documentation, and unless I have done something wrong (please tell me if I have) it doesn't appear like this has been tested.

@rtibbles rtibbles self-assigned this Jan 25, 2025
@Mamatha1718
Copy link
Copy Markdown
Author

Mamatha1718 commented Jan 25, 2025

Hi @rtibbles ,Thank you for pointing this out. You're absolutely correct—the error occurred because the -profile:v baseline and -level 3.0 options are specific to MP4 and are not compatible with WebM's VP8/VP9 codecs. My original command was based on the MP4 compression settings, and I mistakenly included those parameters without adapting them for WebM.
I think Here's corrected command for compressing WebM files
ffmpeg -i inputfile.webm \
-b:a 32k -ac 1 \
-vf scale="'w=-2:h=trunc(min(ih,480)/2)*2'" \
-crf 32 \
-preset slow -v error -strict -2 -stats -movflags faststart \
-y outputfile.webm

will you please let me know these changes are fix this error.
Thank you

@rtibbles
Copy link
Copy Markdown
Member

Have you tested this command yourself? It sounds like you have not, so I am not sure why I should have any reasonable expectation that this will be correct this time either.

Please test your changes and let me know when you have something that works. If you want to know how to install ffmpeg, please see the documentation in this repository.

@Mamatha1718
Copy link
Copy Markdown
Author

Mamatha1718 commented Jan 26, 2025

Hi @rtibbles @akolson ,

I've tested the command with my webmsamplevideo.webm sample file(download from internet), and it successfully ran without any errors. The output video was processed as expected, and the file was generated correctly. Here’s a screenshot of the successful run:

Screenshot 2025-01-26 101516

Let me know if anything else need changes, or if there's anything more i should check (or change).

Thank you.
Mamatha

@rtibbles
Copy link
Copy Markdown
Member

rtibbles commented Mar 1, 2025

The updated command does work, yes. I would recommend a slight tweak to align the webm command with what we are doing inside the compress_video utility. You can see the command constructed in the Python code here: https://github.com/learningequality/ricecooker/blob/develop/ricecooker/utils/videos.py#L219

@GautamBytes
Copy link
Copy Markdown
Contributor

Hey @rtibbles , While i know @Mamatha1718 worked on this issue and already has a raised pr but from the commit history it seems inactivity of 2 months , so if it is appropriate , can i take this further , maybe i can talk with her and coauthor the pull request?

@MisRob
Copy link
Copy Markdown
Member

MisRob commented Mar 19, 2025

Hi @Mamatha1718, are you still planning to complete this work? No problem to wait if yes, I am just checking in on status since we didn't hear back from you for a while.

@GautamBytes we'll wait for a bit more to see if we hear back. I will let you know then. Thank you.

@GautamBytes
Copy link
Copy Markdown
Contributor

Hey @MisRob , as @Mamatha1718 haven't responded yet , I would be happy to take this up if you want.

@GautamBytes
Copy link
Copy Markdown
Contributor

GautamBytes commented Apr 3, 2025

Hi @MisRob , I went through the earlier work done by Mamatha here and @rtibbles suggestion . I have done the suggested changes locally , if you want i can go ahead and raise a pr:)

@MisRob
Copy link
Copy Markdown
Member

MisRob commented Apr 3, 2025

Hi @GautamBytes, thank you, I missed this comment. Ah yes, since we didn't hear from @Mamatha1718 for couple of months, we'd be grateful if you could complete it. I will re-assign.

@MisRob
Copy link
Copy Markdown
Member

MisRob commented Apr 3, 2025

@GautamBytes would you comment on the issue please and reference my comment there? Me or another team member will assign you then.

@rtibbles
Copy link
Copy Markdown
Member

rtibbles commented Apr 3, 2025

Closing this PR as it is stale, and has not been updated in response to feedback. Issue will be reassigned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Documentation regarding the transition to WebM format (for videos)

5 participants