[FFmpeg-user] MTS to MP4 lossless conversion issues

Jon bae jonbae77 at gmail.com
Thu Aug 3 09:48:01 EEST 2017


2017-08-03 7:45 GMT+02:00 akash kulkarni <kul.akash123 at gmail.com>:

> i have some same kinda of problem,where i am converting MTS file to MP4 .
>
> problem is about audio is not playing in widows media player while it
> playing well in VLC
> so how could i convert mts to mp4 to play that mp4 file well in Windows
> media player
> please can you tell me ffmpeg command format to do so
>
> On Wed, Jul 12, 2017 at 8:46 PM, Nick Gilmour <nickeforos at gmail.com>
> wrote:
>
> > Thanks for the reponses!
> >
> >
> >
> > *What is the output of$ ffmpeg -i 00000.ffmpeg1.mp4??*
> >
> > ffmpeg version 3.3.2-1~16.04.york1 Copyright (c) 2000-2017 the FFmpeg
> > developers
> >   built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
> >   configuration: --prefix=/usr --extra-version='1~16.04.york1'
> > --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
> > --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping
> > --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa
> > --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca
> > --enable-libcdio --enable-libflite --enable-libfontconfig
> > --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm
> > --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt
> > --enable-libopus --enable-libpulse --enable-librubberband
> --enable-libshine
> > --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh
> > --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx
> > --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid
> > --enable-libzmq --enable-libzvbi --enable-omx --enable-openal
> > --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883
> > --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264
> > --enable-shared
> >   WARNING: library configuration mismatch
> >   avcodec     configuration: --prefix=/usr --extra-version='1~16.04.
> york1'
> > --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
> > --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping
> > --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa
> > --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca
> > --enable-libcdio --enable-libflite --enable-libfontconfig
> > --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm
> > --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt
> > --enable-libopus --enable-libpulse --enable-librubberband
> --enable-libshine
> > --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh
> > --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx
> > --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid
> > --enable-libzmq --enable-libzvbi --enable-omx --enable-openal
> > --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883
> > --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264
> > --enable-shared --enable-version3 --disable-doc --disable-programs
> > --enable-libopencore_amrnb --enable-libopencore_amrwb
> --enable-libtesseract
> > --enable-libvo_amrwbenc --enable-netcdf
> >   libavutil      55. 58.100 / 55. 58.100
> >   libavcodec     57. 89.100 / 57. 89.100
> >   libavformat    57. 71.100 / 57. 71.100
> >   libavdevice    57.  6.100 / 57.  6.100
> >   libavfilter     6. 82.100 /  6. 82.100
> >   libavresample   3.  5.  0 /  3.  5.  0
> >   libswscale      4.  6.100 /  4.  6.100
> >   libswresample   2.  7.100 /  2.  7.100
> >   libpostproc    54.  5.100 / 54.  5.100
> > Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '00000.mp4':
> >   Metadata:
> >     major_brand     : isom
> >     minor_version   : 512
> >     compatible_brands: isomiso2avc1mp41
> >     encoder         : Lavf57.71.100
> >   Duration: 00:00:15.10, start: 0.000000, bitrate: 12936 kb/s
> >     Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661),
> yuv420p(tv),
> > 1280x720 [SAR 1:1 DAR 16:9], 12760 kb/s, 25 fps, 25 tbr, 90k tbn, 100 tbc
> > (default)
> >     Metadata:
> >       handler_name    : VideoHandler
> >     Stream #0:1(und): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, stereo,
> > fltp, 192 kb/s (default)
> >     Metadata:
> >       handler_name    : SoundHandler
> >     Side data:
> >       audio service type: main
> > At least one output file must be specified
> >
> > I have rerun the command and now I'm getting a WARNING: library
> > configuration mismatch. I thinks it's because the Software Center forced
> me
> > to remove a package...
> >
> >
> > *Subtitles? Interesting, what do they contain? :)*
> >
> > Actually there are no subtitles. This is weird...
> >
> > To me this AVCHD format is uncomfortable. How am I supposed to separate
> the
> > files? I want to have everything in a single file. Anyway, I have decided
> > to convert the MTS files to mp4 and keep the AVCHD structure as a
> backup. I
> > see no quality loss with the generated mp4.
> >
> >
> > On Tue, Jul 11, 2017 at 1:34 PM, Moritz Barsnick <barsnick at gmx.net>
> wrote:
> >
> > > On Mon, Jul 10, 2017 at 15:03:49 +0200, Nick Gilmour wrote:
> > > > *track 1: codec frame size is not set*
> > > > 1. I googled also about this but I still don't know what does that
> mean
> > > and
> > > > how I should deal with it. Is it an error or should I change
> something?
> > >
> > > It about the audio track and I think it shouldn't matter. (I don't know
> > > absolutely for sure though.)
> > >
> > > > 2. I also see with VLC > Tools > Codec Information that the output
> file
> > > has
> > > > 25 frames per sec, whereas the input file has 50 frames per sec. This
> > > > although the output of the previous command shows 50 fps for the
> output
> > > > file. So what is going on? Is VLC wrong? How can I get the 50 fps in
> > the
> > > > output file? Do 25 fps less mean reduced quality?
> > >
> > > If you copy the stream ("-c[:x] copy"), no quality is reduced.
> > >
> > > VLC may be wrong. See this (from the input):
> > > >     Stream #0:0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448),
> > > yuv420p(tv, progressive), 1280x720 [SAR 1:1 DAR 16:9], 50 fps, 25 tbr,
> > 90k
> > > tbn, 100 tbc
> > >
> > > "50 fps" is the frame rate given by the demuxer, "25 tbr" is the frame
> > > rate guessed (by ffmpeg) from actual packets' timestamps. If you dump
> > > all frames' info with ffprobe, we could double-check this conclusion.
> > >
> > > I don't understand why VLC sees differences in the two files though. It
> > > would be interesting to see what the container vs. stream metadata
> > > says. It could be ffmpeg is adding info to the MP4 which the MTS just
> > > didn't have (because it e.g. only has per-stream metadata). Or
> > > something like that.
> > >
> > > What is the output of
> > > $ ffmpeg -i 00000.ffmpeg1.mp4
> > > ??
> > >
> > > Can you provide such an MTS sample? (As short as possibly, but able to
> > > reproduce the issue.)
> > >
> > > > 3. The AVCHD format comes also with other files except MTS e.g. CPI.
> > Are
> > > > these important for the conversion or for use with video editing
> tools
> > > > like Kdenlive?
> > >
> > > The CPI file apparently holds extra metadata, but ffmpeg can't make use
> > > of it. Final Cut Pro and iMovie apparently can. (I keep writing
> > > "apparently", because I googled. Did you?
> > > http://www.pavtube.com/avchd-cpi-file-format.html)
> > >
> > > >     Stream #0:2[0x1200]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0]
> /
> > > 0x0090), 1280x720
> > >
> > > Subtitles? Interesting, what do they contain? :)
> > >
> > > > Regards
> > > > Nick
> > >
> > > Cheers,
> > > Moritz
> > >
> > >
> > > > $ ffmpeg -i 00000.MTS -vcodec copy -acodec copy -sn 00000.ffmpeg1.mp4
> > > > ffmpeg version 3.3.2-1~16.04.york1 Copyright (c) 2000-2017 the FFmpeg
> > > developers
> > > >   built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
> > > >   configuration: --prefix=/usr --extra-version='1~16.04.york1'
> > > --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
> > > --incdir=/usr/include/x86_64-linux-gnu --enable-gpl
> --disable-stripping
> > > --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa
> > > --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca
> > > --enable-libcdio --enable-libflite --enable-libfontconfig
> > > --enable-libfreetype --enable-libfribidi --enable-libgme
> --enable-libgsm
> > > --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt
> > > --enable-libopus --enable-libpulse --enable-librubberband
> > --enable-libshine
> > > --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh
> > > --enable-libtheora --enable-libtwolame --enable-libvorbis
> --enable-libvpx
> > > --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid
> > > --enable-libzmq --enable-libzvbi --enable-omx --enable-openal
> > > --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883
> > > --enable-chromaprint --enable-frei0r --enable-libopencv
> --enable-libx264
> > > --enable-shared
> > > >   libavutil      55. 58.100 / 55. 58.100
> > > >   libavcodec     57. 89.100 / 57. 89.100
> > > >   libavformat    57. 71.100 / 57. 71.100
> > > >   libavdevice    57.  6.100 / 57.  6.100
> > > >   libavfilter     6. 82.100 /  6. 82.100
> > > >   libavresample   3.  5.  0 /  3.  5.  0
> > > >   libswscale      4.  6.100 /  4.  6.100
> > > >   libswresample   2.  7.100 /  2.  7.100
> > > >   libpostproc    54.  5.100 / 54.  5.100
> > > > Input #0, mpegts, from '00000.MTS':
> > > >   Duration: 00:00:15.10, start: 0.888889, bitrate: 13700 kb/s
> > > >   Program 1
> > > >     Stream #0:0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448),
> > > yuv420p(tv, progressive), 1280x720 [SAR 1:1 DAR 16:9], 50 fps, 25 tbr,
> > 90k
> > > tbn, 100 tbc
> > > >     Stream #0:1[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz,
> > > stereo, fltp, 192 kb/s
> > > >     Stream #0:2[0x1200]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0]
> /
> > > 0x0090), 1280x720
> > > > [mp4 @ 0x55a37b91a4a0] track 1: codec frame size is not set
> > > > Output #0, mp4, to '00000.ffmpeg1.mp4':
> > > >   Metadata:
> > > >     encoder         : Lavf57.71.100
> > > >     Stream #0:0: Video: h264 (High) ([33][0][0][0] / 0x0021),
> > > yuv420p(tv, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 50 fps,
> 25
> > > tbr, 90k tbn, 90k tbc
> > > >     Stream #0:1: Audio: ac3 ([165][0][0][0] / 0x00A5), 48000 Hz,
> > stereo,
> > > fltp, 192 kb/s
> > > > Stream mapping:
> > > >   Stream #0:0 -> #0:0 (copy)
> > > >   Stream #0:1 -> #0:1 (copy)
> > > > Press [q] to stop, [?] for help
> > > > frame=  377 fps=0.0 q=-1.0 Lsize=   23852kB time=00:00:15.07
> > > bitrate=12964.2kbits/s speed= 247x
> > > > video:23490kB audio:354kB subtitle:0kB other streams:0kB global
> > > headers:0kB muxing overhead: 0.033670%
> > >
>
> Hi,
I think your audio codec is not right, for mp4. Your could use a different
container, like mov or mkv, or you have to convert the audio line:

ffmpeg -i input -c:v copy -c:a aac -b:a 256k output.mp4


Jonathan


More information about the ffmpeg-user mailing list