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

Better encoding defaults #9

Open
escaped opened this issue Sep 9, 2018 · 4 comments
Open

Better encoding defaults #9

escaped opened this issue Sep 9, 2018 · 4 comments

Comments

@escaped
Copy link
Owner

escaped commented Sep 9, 2018

We currently have some default parameters (https://github.com/escaped/django-video-encoding/blob/master/video_encoding/config.py) to encode videos for the web. As I am not a video compression expert, I suspect that these values can be tweaked and optimized. Maybe there is someone with more experience and willing to contribute better defaults.

@escaped
Copy link
Owner Author

escaped commented Dec 30, 2018

There are some guidelines on settings for VP9. This codec might be a good default as it has better compression than VP8 and is already supported by all major browser. As not all browser support VP9, we should keep mp4/h264 as a fallback.

VIDEO_ENCODING_FORMATS = {
    'FFmpeg': [
        # libvp9 - https://developers.google.com/media/vp9/settings/vod/
        # resolution@framerate target-bitrate min-bitrate max-bitrate quality
        #  640x480p@24,25,30   750            375         1088        33
        # 1280x720p@24,25,30   1024           512         1485        32
        # 1920x1080p@24,25,30  1800           900         2610        31
        #
        # https://trac.ffmpeg.org/wiki/Encode/VP9
        # "Use 4:2:0 chroma subsampling" for better support
        {
            'name': 'webm_vp9_480p',
            'extension': 'webm',
            'params': [
                '-c:v', 'libvpx-vp9',
                '-vf', 'scale=-1:480', '-r', '30',
                '-b:v', '750k', '-minrate', '375', '-maxrate', '1088',
                '-quality', 'good', '-speed', '0', '-crf', '33',
                '-pix_fmt', 'yuv420p',
                '-codec:a', 'libvorbis', '-b:a', '128k', '-f', 'webm',
            ],
        },
        {
            'name': 'webm_vp9_720p',
            'extension': 'webm',
            'params': [
                '-c:v', 'libvpx-vp9',
                '-vf', 'scale=-1:720', '-r', '30',
                '-b:v', '1024k', '-minrate', '512', '-maxrate', '1485',
                '-quality', 'good', '-speed', '0', '-crf', '32',
                '-pix_fmt', 'yuv420p',
                '-acodec', 'libvorbis', '-b:a', '128k', '-f', 'webm',
            ],
        },
        {
            'name': 'webm_vp9_1080p',
            'extension': 'webm',
            'params': [
                '-c:v', 'libvpx-vp9',
                '-vf', 'scale=-1:1080', '-r', '30',
                '-b:v', '1800k', '-minrate', '900', '-maxrate', '2610',
                '-quality', 'good', '-speed', '0', '-crf', '31',
                '-pix_fmt', 'yuv420p',
                '-acodec', 'libvorbis', '-b:a', '128k', '-f', 'webm',
            ],
        },
    ],
}

@ajeema
Copy link

ajeema commented Jul 27, 2021

Hello, I am a video compressionist and am able to help configure advanced encoding perameters. What I would like to also see is the ability to configure the encoding variables on the upload form. How can I do that?

@escaped
Copy link
Owner Author

escaped commented Oct 29, 2021

Hey @ajeema ,

the idea of the package is, to provide a simple way of video encoding for non-video-compression experts and the one video will automatically be encoded to all defined resolutions. That's why the whole configuration is hidden away in the Django settings. I am sure there is a way to provide a form to select different encoding methods, but this is not something I want to include in this package as most users will simply use the provided defaults.

Anyway, I would be more than happy to accept a PR, which update the current defaults with some modern ones :)

@derek-adair
Copy link

derek-adair commented Nov 21, 2021

I want to include in this package as most users will simply use the provided defaults.

This was very nice as a new user, however, I'm wanting to customize this and I'm unable to really grok how to do so as of now.

EDIT: Ok, so its in config.py. Probably worth providing this link in the README so it stands out more? shrug

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

No branches or pull requests

3 participants