ffmpeg -i "input.mts" -vcodec copy -acodec pcm_s16le "output.mov"

Rewrap an AVCHD (MTS/M2TS) video as MOV

This *does not change the video encoding*, so it's fast (almost purely I/O-bound) and results in a file of nearly the same size. However, OSX (and possibly other programs) will more easily play/seek the file when wrapped as MOV. For example, you can QuickLook the resulting file. This basically does the same as the commercial ClipWrap program, except using the free program ffmpeg.
Sample Output
ffmpeg version 1.2.4 Copyright (c) 2000-2013 the FFmpeg developers
  built on Oct 31 2013 14:43:14 with Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/1.2.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=cc --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
  libavutil      52. 18.100 / 52. 18.100
  libavcodec     54. 92.100 / 54. 92.100
  libavformat    54. 63.104 / 54. 63.104
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 42.103 /  3. 42.103
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, mpegts, from '00187.MTS':
  Duration: 00:00:29.04, start: 1.000011, bitrate: 26295 kb/s
  Program 1
    Stream #0:0[0x1011]: Video: h264 (High) (HDPR / 0x52504448), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 59.94 fps, 59.94 tbr, 90k tbn, 119.88 tbc
    Stream #0:1[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 256 kb/s
    Stream #0:2[0x1200]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
Output #0, mov, to '00187.mov':
  Metadata:
    encoder         : Lavf54.63.104
    Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 59.94 fps, 90k tbn, 90k tbc
    Stream #0:1: Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (ac3 -> pcm_s16le)
Press [q] to stop, [?] for help
frame= 1740 fps=0.0 q=-1.0 Lsize=   93128kB time=00:00:29.07 bitrate=26241.2kbits/s
video:87649kB audio:5448kB subtitle:0 global headers:0kB muxing overhead 0.033113%

0
By: lgarron
2014-01-24 13:00:07

These Might Interest You


  • 0
    cat video.avi.001 video.avi.002 video.avi.003 >> video.avi
    shroff · 2011-07-14 09:55:22 1
  • This assumes that there is a 10.2 sec delay between the video and the audio (delayed). To extract the original video into a audio and video composites look at the command on extracting audio and video from a movie


    4
    ffmpeg -i source_audio.mp3 -itsoffset 00:00:10.2 -i source_video.m2v target_video.flv
    dcabanis · 2009-05-23 23:47:41 0
  • Must have the video open and fully loaded.


    -2
    video=$(ls /tmp | grep -e Flash\w*); ffmpeg -i /tmp/$video -f mp3 -ab 192k ~/ytaudio.mp3
    aperson · 2009-11-19 09:25:10 3
  • Great for telnet stream. Substitute aa with caca for colour. To see in terminal: cat video.txt Show Sample Output


    0
    mplayer -vo aa:eight:driver=curses video.avi >video.txt
    mrehqe · 2011-10-31 10:06:10 0

  • 0
    mencoder input.m2ts -oac mp3lame -lameopts cbr:br=128 -ofps 24 -vf harddup -vf scale=1280:720 -ovc xvid -xvidencopts fixed_quant=3 -o output.xvid.lamp.avi
    hpyhacking · 2011-07-28 03:57:59 0
  • -map 0.0:0 map the video of video.mp4 to the video of mix.mp4 -map 1.0:1 map the audio of audio.mp3 to the audio of mix.mp4 make sure that video.mp4 and audio.mp3 have the same duration


    3
    ffmpeg -i video.mp4 -i audio.mp3 -vcodec copy -acodec copy -map 0.0:0 -map 1.0:1 mix.mp4
    kev · 2011-09-03 14:05:16 0

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: