videoffmpegh.264libx264libvpx

FFMPEG: Convert WebM VP8/VP9 multi-resolution video to MP4 (H.264)


I have been trying to convert a multi-resolution WebM video ( VP9/VP8/H.264 ) (1280 x 1080 till the half, thereafter 1080 x 1280) to MP4 container with H.264 encoding for video.

When transcoded with FFMPEG is locking into the frame size it's encountering at the start of the video (1280 x 1080 in this case) when transcoded with libvpx (for VP8 and VP9) and libx264 (for H264).

The only instance i could get it right was when the Input WebM was having H.264 video and opus Audio, and ffmpeg was instructed to just copy the video stream and trans-code the Audio to aac only.

Is there way in make ffmpeg support multi-resolution video transcoding?

How to generate a sample video: On a Chrome or Firefox (on a device that supports auto rotation and has different resolution on portrait and landscape) that supports mediaRecorder API goto this link: https://webrtc.github.io/samples/src/content/getusermedia/record/ , start recording a video , while recording the video, change orientation, stop recording and download the video. file)

Discussion Reference: https://groups.google.com/a/webmproject.org/forum/#!topic/webm-discuss/IgumDyMAHY0


Solution

  • FFmpeg, as of time of writing, does not support resolution-changes mid-stream while encoding. There is a patchset to introduce this ability. motivated for raw video and VP8/9 encoders, but it stands abandoned.