Announcement

Collapse
No announcement yet.

.MTS to .mkv

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SOLVED] .MTS to .mkv

    Hi all,

    My camera records videos in "AVCHD Lite" format, so I have a bunch of .MTS files I would like to edit.

    I've installed Avidemux (Qt), which seems to have a problem with playing the audio (difficult to describe but it sounds like it's out of sync/echoey/underwater) - I believe it is something to do with H.264 B frames.

    So I set out to convert the file into a different format.

    This thread from the archives allowed me to convert the .MTS files into .avi files which now play well in Avidemux, but using a Microsoft format is a bit of a thorn in my side.

    The command I'm using to convert to .avi is:

    Code:
    ffmpeg -y -i "$file" -f avi -vcodec mpeg4 -b 800k -acodec ac3 -ab 128k -s hd720 "$out_file"
    Is anyone able to help me putting together the right options to convert the .MTS files into .mkv format? I've tried skimming through the man pages but it's a bit daunting

    Thanks,

    Feathers
    samhobbs.co.uk

    #2
    you SHOULD be abel to do a simpel convert with ffmpeg , like
    Code:
    ffmpeg -i somefile.mts somefile2.mkv
    VINNY
    i7 4core HT 8MB L3 2.9GHz
    16GB RAM
    Nvidia GTX 860M 4GB RAM 1152 cuda cores

    Comment


      #3
      Thanks for replying!

      I just tried that, the output was:

      Code:
      feathers-mcgraw@62-West-Wallaby-Street:/data/Videos/Lake_District_2013$ ffmpeg -i Filter_part_1_overview.MTS Filter_part_1_overview.mkv
      ffmpeg version 0.8.6-6:0.8.6-1ubuntu2, Copyright (c) 2000-2013 the Libav developers
        built on Mar 30 2013 22:20:06 with gcc 4.7.2
      *** THIS PROGRAM IS DEPRECATED ***
      This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
      
      Seems stream 0 codec frame rate differs from container frame rate: 100.00 (100/1) -> 25.00 (25/1)
      Input #0, mpegts, from 'Filter_part_1_overview.MTS':
        Duration: 00:07:27.71, start: 0.888889, bitrate: 13779 kb/s
        Program 1 
          Stream #0.0[0x1011]: Video: h264 (High), yuv420p, 1280x720 [PAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 100 tbc
          Stream #0.1[0x1100]: Audio: ac3, 48000 Hz, stereo, s16, 192 kb/s
          Stream #0.2[0x1200]: Subtitle: pgssub
      [buffer @ 0x21aee80] w:1280 h:720 pixfmt:yuv420p
      Output #0, matroska, to 'Filter_part_1_overview.mkv':
        Metadata:
          encoder         : Lavf53.21.1
          Stream #0.0: Video: mpeg4, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 1k tbn, 25 tbc
          Stream #0.1: Audio: libvorbis, 48000 Hz, stereo, s16
          Stream #0.2: Subtitle: ass, 200 kb/s                                                                                                                                                        
      Stream mapping:                                                                                                                                                                                 
        Stream #0.0 -> #0.0                                                                                                                                                                           
        Stream #0.1 -> #0.1                                                                                                                                                                           
        Stream #0.2 -> #0.2
      Press ctrl-c to stop encoding
      [ass @ 0x21adf40] Only SUBTITLE_ASS type supported.
      Subtitle encoding failed
      ...and a 4.5KiB file was produced (original MTS was 735.4MiB)



      Feathers
      samhobbs.co.uk

      Comment


        #4
        Humm worth a shot .....it usualy works for me that way with other file types , but I have no .mts files to play with .

        VINNY
        i7 4core HT 8MB L3 2.9GHz
        16GB RAM
        Nvidia GTX 860M 4GB RAM 1152 cuda cores

        Comment


          #5
          Thanks, I don't know much about multimedia formats...

          Do you think it's possible to do a two step thing - decompress the audio and video, and then encode it again?

          Feathers
          samhobbs.co.uk

          Comment


            #6
            I install every decoder in the repository, lol, eventually one of them will work, sorry for the stupid suggestion, but that's what works for me.

            Edit: If you don't want to install a lot of decoders, read the descriptions, I know at least one of them does the job.

            Comment


              #7
              Humm I acquired a test .mts and it converted fine @hear
              Code:
              vinny@vinny-HP-G62:~/Downloads$ ffmpeg -i 00007.MTS test1.mkv
              WARNING: gnome-keyring:: couldn't connect to: /run/user/vinny/keyring-9mW2Ld/pkcs11: No such file or directory
              ffmpeg version 0.8.6-6:0.8.6-0ubuntu0.12.10.1, Copyright (c) 2000-2013 the Libav developers
                built on Apr  2 2013 17:07:34 with gcc 4.7.2
              *** THIS PROGRAM IS DEPRECATED ***
              This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
              Input #0, mpegts, from '00007.MTS':
                Duration: 00:00:03.62, start: 0.369856, bitrate: 15383 kb/s
                Program 1 
                  Stream #0.0[0x1011]: Video: h264 (High), yuv420p, 1280x720 [PAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k tbn, 100 tbc
                  Stream #0.1[0x1100]: Audio: ac3, 48000 Hz, stereo, s16, 192 kb/s
              [buffer @ 0x9fb5c60] w:1280 h:720 pixfmt:yuv420p
              [libx264 @ 0x9fb4ac0] using SAR=1/1
              [libx264 @ 0x9fb4ac0] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2
              [libx264 @ 0x9fb4ac0] profile Main, level 3.2
              [libx264 @ 0x9fb4ac0] 264 - core 123 r2189 35cf912 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=0 b_adapt=1 b_bias=0 direct=1 weightb=0 open_gop=1 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.25 aq=1:1.00
              Output #0, matroska, to 'test1.mkv':
                Metadata:
                  encoder         : Lavf53.21.1
                  Stream #0.0: Video: libx264, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], q=-1--1, 1k tbn, 50 tbc
                  Stream #0.1: Audio: libvorbis, 48000 Hz, stereo, s16
              Stream mapping:
                Stream #0.0 -> #0.0
                Stream #0.1 -> #0.1
              Press ctrl-c to stop encoding
              frame=  182 fps= 11 q=31.0 Lsize=    1110kB time=3.62 bitrate=2512.8kbits/s    
              video:1064kB audio:40kB global headers:4kB muxing overhead 0.280719%
              frame I:1     Avg QP:25.50  size: 69543
              [libx264 @ 0x9fb4ac0] frame P:65    Avg QP:25.28  size: 12148
              [libx264 @ 0x9fb4ac0] frame B:116   Avg QP:31.29  size:  1979
              [libx264 @ 0x9fb4ac0] consecutive B-frames:  1.1% 15.4% 79.1%  4.4%
              [libx264 @ 0x9fb4ac0] mb I  I16..4: 44.2%  0.0% 55.8%
              [libx264 @ 0x9fb4ac0] mb P  I16..4:  2.1%  0.0%  1.1%  P16..4: 45.7%  6.8%  5.0%  0.0%  0.0%    skip:39.2%
              [libx264 @ 0x9fb4ac0] mb B  I16..4:  0.1%  0.0%  0.1%  B16..8: 31.3%  1.6%  0.4%  direct: 0.3%  skip:66.2%  L0:41.7% L1:53.1% BI: 5.2%
              [libx264 @ 0x9fb4ac0] coded y,uvDC,uvAC intra: 38.2% 43.6% 4.2% inter: 6.5% 6.6% 0.0%
              [libx264 @ 0x9fb4ac0] i16 v,h,dc,p: 39% 30%  9% 21%
              [libx264 @ 0x9fb4ac0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 15% 18%  5%  8%  9%  8%  5%  7%
              [libx264 @ 0x9fb4ac0] i8c dc,h,v,p: 64% 18% 16%  2%
              [libx264 @ 0x9fb4ac0] Weighted P-Frames: Y:0.0% UV:0.0%
              [libx264 @ 0x9fb4ac0] ref P L0: 71.7%  6.1% 15.8%  6.3%
              [libx264 @ 0x9fb4ac0] ref B L0: 91.0%  9.0%
              [libx264 @ 0x9fb4ac0] kb/s:2392.62
              vinny@vinny-HP-G62:~/Downloads$
              beautiful results and a reduction in file size from 6.6Mib in the original to 1.1 in the .mkv but looks just as high deff as the original

              It looks like yours is quitting on the subtitle conversion ,, so if you dont care about the subtitle try suppressing the subtitle from being added with the -sn option like
              Code:
              ffmpeg -i somefile.mts -sn somefile.mkv
              VINNY

              EDDIT: allso see that you have "libx264-123" and "libavcodec-extra-53" installed
              Last edited by vinnywright; Sep 01, 2013, 09:52 PM.
              i7 4core HT 8MB L3 2.9GHz
              16GB RAM
              Nvidia GTX 860M 4GB RAM 1152 cuda cores

              Comment


                #8
                Try mkvmerge. It has cli and gui options. Not familiar with the syntax for cli off hand but it's an excellent program with frequent updates.
                OS: Kubuntu 12.10/Windows 8
                CPU: Intel Core i7 2600K
                Motherboard: Gigabyte GA-Z77X-UD5H
                Memory: 2x4GB Corsair Dominator
                Graphics Card: MSI R7770
                Monitor: Dell 2208WFP
                Mouse: Mionix NAOS 5000
                PSU: Corsair 520HX
                Case: Thermaltake Mozart TX
                Cooling: Thermalright TRUE Black Ultra-120 eXtreme CPU Heatsink Rev C
                Hard Drives: 1x180 GB Intel 330 SSD - 1xWD 1 TB Caviar Black - 1xWD 2 TB Caviar Green - 2xWD 3 TB Caviar Green

                Comment


                  #9
                  Bad source ?

                  You have warning/error:
                  Seems stream 0 codec frame rate differs from container frame rate: 100.00 (100/1) -> 25.00 (25/1)
                  If you search with the error/warning message - a pick:

                  - http://ffmpeg-users.933282.n4.nabble...-td938596.html
                  The video container specifies a framerate, as does the video stream
                  itself. In some cases, usually caused by badly written encoding
                  programs, the two can disagree. When this happens, ffmpeg is
                  obviously forced to believe one and not the other.

                  If ffmpeg picks the wrong one, you can, ask you mentioned, force the
                  other framerate if you believe it to be correct...

                  FFMPEG / MKV exaples : http://trac.ffmpeg.org/wiki/x264EncodingGuide - those examples seem to work with the real ffmpeg (2.0).

                  Note ! The Ubuntu is using the LIBAV - earlier: http://www.kubuntuforums.net/showthr...v-Winff-ffmpeg
                  A good place to start: Topic: Top 20 Kubuntu FAQs & Answers
                  Searching FAQ's: Google Search 'FAQ from Kubuntuforums'

                  Comment


                    #10
                    Originally posted by vinnywright View Post
                    It looks like yours is quitting on the subtitle conversion ,, so if you dont care about the subtitle try suppressing the subtitle from being added with the -sn option like
                    Code:
                    ffmpeg -i somefile.mts -sn somefile.mkv
                    VINNY
                    Thanks for that, just tried it and it worked - curious because there shouldn't have been any subtitles in the file at all (perhaps it was GPS data?).

                    You guys (and girls?) are awesome
                    samhobbs.co.uk

                    Comment


                      #11
                      Originally posted by Feathers McGraw View Post
                      Thanks for that, just tried it and it worked - curious because there shouldn't have been any subtitles in the file at all (perhaps it was GPS data?).

                      You guys (and girls?) are awesome
                      Perhaps ,,,,,, I was going on the ffmpeg output you posted in #3 where ffmpeg was showing 3 streams a 0.0 , 0.1 & 0.2 ; 0.2 was seen as a subtitle stream and the ffmpeg output stops with a "subtitle encoding failed"

                      you can find more examples @hear http://trac.ffmpeg.org/wiki/x264EncodingGuide (check to see you have those packages I refrenced in post #7)

                      and look at "man ffmpeg" in a terminal.

                      VINNY
                      i7 4core HT 8MB L3 2.9GHz
                      16GB RAM
                      Nvidia GTX 860M 4GB RAM 1152 cuda cores

                      Comment


                        #12
                        Try:

                        avconv -i somefile.mts somefile.avi

                        Please Read Me

                        Comment


                          #13
                          Thanks, avconv also works, I found it shortly after my original post. Luckily most of the commands are the same
                          samhobbs.co.uk

                          Comment

                          Working...
                          X