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

Scale argument in av_video_convert #42

Open
stla opened this issue Mar 13, 2022 · 1 comment
Open

Scale argument in av_video_convert #42

stla opened this issue Mar 13, 2022 · 1 comment

Comments

@stla
Copy link

stla commented Mar 13, 2022

Hello,

I use av to convert some GIFs to MOV files, in order to upload them to Youtube. If the width or the height of the GIF is not divisible by 2, that doesn't work. Therefore it would be nice if we could scale the video by 2. A possibility is:

av_video_convert <- function (video, output = "output.mp4", verbose = TRUE, scale = NULL) 
{
    info <- av_media_info(video)
    if (nrow(info$video) == 0) 
        stop("No suitable input video stream found")
    framerate <- info$video$framerate[1]
    audio <- if (length(info$audio) && nrow(info$audio)) 
        video
    vf <- if(is.null(scale))
        "null"
    else
        sprintf("scale=iw*%s:ih*%s", scale, scale)
    av_encode_video(input = video, audio = audio, output = output, 
        framerate = framerate, vfilter = vf, verbose = verbose)
}

Would you agree to make this change? (or I can do a PR if you want).

@muschellij2
Copy link
Contributor

Related to #31 and #2

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

2 participants