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

copy in ffmpeg c++ #65

Closed
Niek-Okido opened this issue Jun 30, 2020 · 4 comments
Closed

copy in ffmpeg c++ #65

Niek-Okido opened this issue Jun 30, 2020 · 4 comments

Comments

@Niek-Okido
Copy link

dear,

i am currently stuck now for almost 1 month and still not get the solution ,
in the commandline tool the following command is what i want
ffmpeg -i "video.mp4" -i "audio.mp4" -codec copy -shortest output.mp4

i want to add a new generated video with no sound in it (greated with opencv). to the original video
what i need to do in c++ i really stuck now on this for 4 weeks (learn a lot of new things).

i hope you can help me with this , it seems to be very easy but my headache is on the -codec copy -shortest how i can get this succeeded in ffmpeg?

thank in advance if you want to help me with this,

Kind regards Niek Tuytel,

@Niek-Okido
Copy link
Author

i hope you will open it if you want to help , thanks in advance

@leandromoreira
Copy link
Owner

Hey @Niek-Okido

Greeping the FFmpeg source code (git grep shortest) I noticed that shortest is "translated" by this function and there seem to exist a filter for shortest as well:

static void close_output_stream(OutputStream *ost)
{
    OutputFile *of = output_files[ost->file_index];

    ost->finished |= ENCODER_FINISHED;
    if (of->shortest) {
        int64_t end = av_rescale_q(ost->sync_opts - ost->first_pts, ost->enc_ctx->time_base, AV_TIME_BASE_Q);
        of->recording_time = FFMIN(of->recording_time, end);
    }
}

@leandromoreira
Copy link
Owner

but in reality you could check the duration of the shortest stream and stop to process packets/frames there.

@Niek-Okido
Copy link
Author

thank you very much, really needed this help :) thank you very much get it working now ❤️

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