webm to mp4 conversion using ffmpeg
I was able to convert byffmpeg -i video.webm -strict experimental video.mp4
.
As your input file report a strange frame rate value 1k fps
coming from the tbs and tbr value (look here for their definition)
the encoder generate a different result, 16k tbn, 1k tbc (default)
So by calling :
ffmpeg -fflags +genpts -i 1.webm -r 24 1.mp4
You configure ffmpeg to generate new pts (a.k.a Presentation TimeStamp) for each frame and you set the target frame-rate to 24.
So your output mp4 file info (ffmpeg -i ....
) change from
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 4327 kb/s, 1000.09 fps, 1k tbr, 16k tbn, 2k tbc
to
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1670 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc
Re-mux WebM to MP4
If you want to stream copy (re-mux) and avoid re-encoding:
ffmpeg -i input.webm -c copy output.mp4
This will copy the VP9/VP8 video and Opus/Vorbis audio from WebM to MP4. This is like a "copy and paste". No re-encoding occurs, so no quality is lost and the process is very fast.
(Note that if you were copying only the video and not the audio, you would use -c:v copy
instead of -c copy
. Point being, the -c
part is the same meaning in both cases.)
If you get error: "opus in MP4 support is experimental"
If you get this error:
opus in MP4 support is experimental, add '-strict -2' if you want to use it.
Could not write header for output file #0 (incorrect codec parameters ?): Experimental feature
Then either:
- Use a newer
ffmpeg
as Opus in MP4 is no longer experimental in newerffmpeg
versions. - Or add
-strict experimental
(or the alias-strict -2
) if you are stuck with outdatedffmpeg
.