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

Help for filter_complex #121

Open
templarfelix opened this issue May 21, 2024 · 0 comments
Open

Help for filter_complex #121

templarfelix opened this issue May 21, 2024 · 0 comments

Comments

@templarfelix
Copy link

templarfelix commented May 21, 2024

Hello team,

What is the best approach for converting the next command to lib

I try

Some code, but anyone works fine.

            ffmpeg -hide_banner -loglevel error -y -i {{.INPUT_FILE}} \
            -filter_complex "[0:v]split=5[v240][v360][v480][v720][v1080]; \
                            [v240]scale=iw*min(426/iw\,240/ih):ih*min(426/iw\,240/ih),pad=ceil(iw/2)*2:ceil(ih/2)*2,format=yuv420p[v240out]; \
                            [v360]scale=iw*min(640/iw\,360/ih):ih*min(640/iw\,360/ih),pad=ceil(iw/2)*2:ceil(ih/2)*2,format=yuv420p[v360out]; \
                            [v480]scale=iw*min(854/iw\,480/ih):ih*min(854/iw\,480/ih),pad=ceil(iw/2)*2:ceil(ih/2)*2,format=yuv420p[v480out]; \
                            [v720]scale=iw*min(1280/iw\,720/ih):ih*min(1280/iw\,720/ih),pad=ceil(iw/2)*2:ceil(ih/2)*2,format=yuv420p[v720out]; \
                            [v1080]scale=iw*min(1920/iw\,1080/ih):ih*min(1920/iw\,1080/ih),pad=ceil(iw/2)*2:ceil(ih/2)*2,format=yuv420p[v1080out]" \
            -map "[v360out]" -map 0:a:0 -b:v 800k -preset medium \
            -map "[v240out]" -map 0:a:0 -b:v 400k -preset medium \
            -map "[v480out]" -map 0:a:0 -b:v 1400k -preset medium \
            -map "[v720out]" -map 0:a:0 -b:v 2800k -preset medium \
            -map "[v1080out]" -map 0:a:0 -b:v 5000k -preset medium \
            -c:v {{.ENCODE_VIDEO_STREAM}} -crf 22 -c:a aac -ar 48000 -var_stream_map "v:0,a:0,name:360p v:1,a:1,name:240p v:2,a:2,name:480p v:3,a:3,name:720p v:4,a:4,name:1080p" \
            -hls_list_size 0 -threads 0 -f hls \
            -hls_time 10 -hls_flags independent_segments \
            -master_pl_name {{.VIDEO_ID}}-master.m3u8 \
            /tmp/output/{{.VIDEO_ID}}-%v.m3u8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant