Skip to content

Reencoding while preserving original FPS #37

@vpenades

Description

@vpenades

Something I've tried several times with FFmpeg.AutoGen, and failed to do, is to be able to process a source file, while preserving as much from the original file as possible.

What I want to do is something like this:

ProcessFrames("source.mp4", "destination.mp4",  _singleFrameProcessor);

void _singleFrameProcessor(int width, int height, int stride, string pixelFormat, Byte[] pixels)
{
    // draw some text over the image, apply denoise filter, whatever.
}

And I would like to do so while preserving the original FPS and audio stream.

The example you have has a fixed 25 fps and it is not specified how to get the fps from the original video.

Also, I am not sure if setting the target FPS is the right approach, and what would be required is to set AVFrame.pts, AVFrame.pkt_dts and AVFrame.time_base to match the original frame time from the source file... but I tried to do so and the video was a complete mess.

So, any ideas on how to address this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions