Vine の6秒動画を連結する

操作もかんたんでおもしろすぐる。

Vine

Vine

これから流行るぞ! 6秒ループ動画アプリ『Vine』の使い方&解説 : ライフハッカー[日本版]

で、これ、録画した動画ファイルは端末内に保存されています。

20140119-233414

$ adb shell
shell@hammerhead:/ $ cd /sdcard/DCIM/Vine
shell@hammerhead:/sdcard/DCIM/Vine $ ls
2014_01_07_12_00_003.mp4
2014_01_13_17_52_052.mp4
2014_01_13_17_56_046.mp4
2014_01_14_21_20_005.mp4
2014_01_14_21_24_014.mp4
2014_01_14_21_26_022.mp4
2014_01_14_21_35_023.mp4
2014_01_15_06_30_042.mp4
2014_01_15_11_04_054.mp4
2014_01_17_15_28_059.mp4
2014_01_19_16_01_018.mp4
shell@hammerhead:/sdcard/DCIM/Vine $ pwd
/sdcard/DCIM/Vine

mp4ファイルで端末内に保存していたのですね。

なので、パソコン上にまとめて持ってくるには以下コマンドで。

$ adb pull /sdcard/DCIM/Vine .

連結して1つにしちゃいます。

スクリプトにして

うまくいくと、

1. 動画ファイルの取得
2. 結合 (要ffmpeg)
3. 再生 (要mplayer)

となるはずです。

実行したら以下。

$ sh merge_movies.sh 
pull: building file list...
pull: /sdcard/DCIM/Vine/2014_01_19_16_01_018.mp4 -> ./2014_01_19_16_01_018.mp4
pull: /sdcard/DCIM/Vine/2014_01_17_15_28_059.mp4 -> ./2014_01_17_15_28_059.mp4
pull: /sdcard/DCIM/Vine/2014_01_15_11_04_054.mp4 -> ./2014_01_15_11_04_054.mp4
pull: /sdcard/DCIM/Vine/2014_01_15_06_30_042.mp4 -> ./2014_01_15_06_30_042.mp4
pull: /sdcard/DCIM/Vine/2014_01_14_21_35_023.mp4 -> ./2014_01_14_21_35_023.mp4
pull: /sdcard/DCIM/Vine/2014_01_14_21_26_022.mp4 -> ./2014_01_14_21_26_022.mp4
pull: /sdcard/DCIM/Vine/2014_01_14_21_24_014.mp4 -> ./2014_01_14_21_24_014.mp4
pull: /sdcard/DCIM/Vine/2014_01_14_21_20_005.mp4 -> ./2014_01_14_21_20_005.mp4
pull: /sdcard/DCIM/Vine/2014_01_13_17_56_046.mp4 -> ./2014_01_13_17_56_046.mp4
pull: /sdcard/DCIM/Vine/2014_01_13_17_52_052.mp4 -> ./2014_01_13_17_52_052.mp4
pull: /sdcard/DCIM/Vine/2014_01_07_12_00_003.mp4 -> ./2014_01_07_12_00_003.mp4
11 files pulled. 0 files skipped.
3117 KB/s (7518060 bytes in 2.355s)
ffmpeg version 1.2.4 Copyright (c) 2000-2013 the FFmpeg developers
  built on Oct 13 2013 20:36:52 with Apple LLVM version 5.0 (clang-500.2.75) (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
[concat @ 0x7fd64b81c200] Estimating duration from bitrate, this may be inaccurate
Input #0, concat, from 'input.txt':
  Duration: 00:00:00.17, start: 0.000000, bitrate: 16 kb/s
    Stream #0:0: Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 480x480 [SAR 1:1 DAR 1:1], 1143 kb/s, 16.09 fps, 30 tbr, 15360 tbn, 30 tbc
    Stream #0:1: Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 64 kb/s
Output #0, mp4, to 'output.mp4':
  Metadata:
    encoder         : Lavf54.63.104
    Stream #0:0: Video: mpeg4 ( [0][0][0] / 0x0020), yuv420p, 480x480 [SAR 1:1 DAR 1:1], q=2-31, 1143 kb/s, 16.09 fps, 15360 tbn, 15360 tbc
    Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, mono, 64 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x7fd64b82a800] st:0 PTS: 93097 DTS: 93097 < 93687 invalid, clipping
frame= 1036 fps=0.0 q=-1.0 Lsize=    7329kB time=00:01:06.69 bitrate= 900.2kbits/s    
video:6766kB audio:522kB subtitle:0 global headers:0kB muxing overhead 0.569982%
MPlayer 1.1-4.2.1 (C) 2000-2012 MPlayer Team
Can't init Apple Remote.

Playing output.mp4.
libavformat version 54.6.100 (internal)
libavformat file format detected.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x10a882c80]multiple edit list entries, a/v desync might occur, patch welcome
[lavf] stream 0: video (mpeg4), -vid 0
[lavf] stream 1: audio (aac), -aid 0, -alang und
VIDEO:  [MP4V]  480x480  24bpp  30.000 fps  833.8 kbps (101.8 kbyte/s)
Clip info:
 major_brand: isom
 minor_version: 512
 compatible_brands: isomiso2mp41
 encoder: Lavf54.63.104
Load subtitles in ./
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 54.23.100 (internal)
Unsupported PixelFormat 61
Unsupported PixelFormat 53
Unsupported PixelFormat 81
Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
==========================================================================
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 1 ch, s16le, 64.1 kbit/9.09% (ratio: 8018->88200)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
AO: [coreaudio] 44100Hz 1ch s16le (2 bytes per sample)
Starting playback...
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
Movie-Aspect is 1.00:1 - prescaling to correct movie aspect.
[swscaler @ 0x10a896630]BICUBIC scaler, from yuv420p to yuyv422 using MMX2
VO: [corevideo] 480x480 => 480x480 Packed YUY2 
A:  66.6 V:  66.6 A-V:  0.001 ct: -0.069   0/  0  2%  1%  0.1% 27 0 


Exiting... (End of file)

MPlayer_と_Desktop_—_mplayer_—_83×44

機種によっては、ファイル位置(SDカードのパス)が違うと思われます。

たのしいです Vineは。


関連ワード:  Androidツール開発