[FFmpeg-devel] [PATCH] recognize .mts as MPEG Transport Stream (encoding)

jb jb at kdenlive.org
Thu Dec 8 15:16:48 CET 2011


Hi.

Currently, many consumer camcorder produce mpegts files with the .mts 
extension. FFmpeg does not recognize this extension when encoding.

For example if you want to extract the first 30 seconds of a clip:

ffmpeg -i 0001.mts -acodec copy -vcodec copy -t 00:00:30 result.mts

fails with:

[NULL @ 0x8fb2f80] Unable to find a suitable output format for 'result.mts'

We need to explicitly add the format with -f mpegts. The patch below fixes the 
problem.

Regards

jb


--

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index fe423fb..b75eff7 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -1099,7 +1099,7 @@ AVOutputFormat ff_mpegts_muxer = {
     .name              = "mpegts",
     .long_name         = NULL_IF_CONFIG_SMALL("MPEG-2 transport stream 
format"),
     .mime_type         = "video/x-mpegts",
-    .extensions        = "ts,m2t,m2ts",
+    .extensions        = "ts,m2t,m2ts,mts",
     .priv_data_size    = sizeof(MpegTSWrite),
     .audio_codec       = CODEC_ID_MP2,
     .video_codec       = CODEC_ID_MPEG2VIDEO,




More information about the ffmpeg-devel mailing list