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

Example for mix audio and video? #166

Open
niuhuan opened this issue Feb 10, 2022 · 0 comments
Open

Example for mix audio and video? #166

niuhuan opened this issue Feb 10, 2022 · 0 comments

Comments

@niuhuan
Copy link

niuhuan commented Feb 10, 2022

I want the same effect as this command line, but I don't know how to make it

ffmpeg -i 1.video -i 1.audio -vcodec copy -acodec copy output.mp4
    let video_file = "1.video".to_owned();
    let audio_file = "1.audio".to_owned();
    let mix_file = "1.mp4".to_owned();
    let mut video_input = ffmpeg::format::input(&video_file).unwrap();
    let mut audio_input = ffmpeg::format::input(&audio_file).unwrap();
    let mut mix_output = ffmpeg::format::output(&mix_file).unwrap();
    video_input
        .streams()
        .best(ffmpeg::media::Type::Video)
        .map(|stream| {
            // ????
        });
    let best_audio_stream_index = audio_input
        .streams()
        .best(ffmpeg::media::Type::Audio)
        .map(|stream| stream.index());
    

mix_output.set_metadata()
mix_output.........
@niuhuan niuhuan changed the title Example for mix video and video? Example for mix audio and video? Feb 17, 2022
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