Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

Mamatha1718
Copy link

@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
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
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
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
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
Member

akolson commented Dec 31, 2024

Please see the image below for guidance.

image

@Mamatha1718
Copy link
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
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
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
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
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

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)
3 participants