Tuesday, June 23, 2015

Menggabungkan Banyak File Video Hanya Dengan 2 Command

Saya banyak video dokumentasi prithilan sebesar sekitar 2 MB. File-file ini mau saya gabung jadi satu file video. Penggabungan dengan ffmpeg mudah sekali dilakukan, hanya butuh 2 command yaitu :


ls *.avi | while read each; do echo "file '$each'" >> mylist.txt; done

dan

ffmpeg -f concat -i mylist.txt -c copy video_draft.avi


Contoh :


mul@mul-ubuntu-14:/media/mul/windows/backup/Dokumentasi/puncak-video$ ls *.avi | while read each; do echo "file '$each'" >> mylist.txt; done
mul@mul-ubuntu-14:/media/mul/windows/backup/Dokumentasi/puncak-video$ ll
total 47153
drwx------ 1 mul mul    4096 Jun 24 10:13 ./
drwx------ 1 mul mul    4096 Jun 24 10:05 ../
-rw------- 1 mul mul 3868392 Nov  9  2011 cimg5907.avi
-rw------- 1 mul mul 3273448 Nov  9  2011 cimg5908.avi
-rw------- 1 mul mul 1718824 Nov  9  2011 cimg5909.avi
-rw------- 1 mul mul 1825416 Nov  9  2011 cimg5910.avi
-rw------- 1 mul mul 2469448 Nov  9  2011 cimg5911.avi
-rw------- 1 mul mul 1796840 Nov  9  2011 cimg5912.avi
-rw------- 1 mul mul 2198728 Nov  9  2011 cimg5913.avi
-rw------- 1 mul mul 2112552 Nov  9  2011 cimg5914.avi
-rw------- 1 mul mul 2990408 Nov  9  2011 cimg5916.avi
-rw------- 1 mul mul 2576232 Nov  9  2011 cimg5917.avi
-rw------- 1 mul mul 2756680 Nov  9  2011 cimg5918.avi
-rw------- 1 mul mul 2485864 Nov  9  2011 cimg5919.avi
-rw------- 1 mul mul 2321768 Nov  9  2011 cimg5920.avi
-rw------- 1 mul mul 3027432 Nov  9  2011 cimg5922.avi
-rw------- 1 mul mul 3318568 Nov  9  2011 cimg5923.avi
-rw------- 1 mul mul 2600776 Nov  9  2011 cimg5924.avi
-rw------- 1 mul mul 1337320 Nov  9  2011 cimg5925.avi
-rw------- 1 mul mul  767080 Nov  9  2011 cimg5927.avi
-rw------- 1 mul mul  746568 Nov  9  2011 cimg5929.avi
-rw------- 1 mul mul 1353672 Nov  9  2011 cimg5930.avi
-rw------- 1 mul mul 1308552 Nov  9  2011 cimg5932.avi
-rw------- 1 mul mul 1378280 Nov  9  2011 cimg5933.avi
-rw------- 1 mul mul     440 Jun 24 10:13 mylist.txt
mul@mul-ubuntu-14:/media/mul/windows/backup/Dokumentasi/puncak-video$ ffmpeg -f concat -i mylist.txt -c copy video_draft.avi
ffmpeg version 2.6.3 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
  configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvo-aacenc --enable-libvidstab
  libavutil      54. 20.100 / 54. 20.100
  libavcodec     56. 26.100 / 56. 26.100
  libavformat    56. 25.101 / 56. 25.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.102 /  5. 11.102
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
[avi @ 0x1e14c60] non-interleaved AVI
Guessed Channel Layout for  Input Stream #0.1 : mono
Input #0, concat, from 'mylist.txt':
  Duration: N/A, start: 0.000000, bitrate: 2374 kb/s
    Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj420p(pc, bt470bg/unknown/unknown), 320x240, 2330 kb/s, 14.01 fps, 14.01 tbr, 14.01 tbn, 14.01 tbc
    Stream #0:1: Audio: adpcm_ima_wav ([17][0][0][0] / 0x0011), 11025 Hz, 1 channels, s16p, 44 kb/s
Output #0, avi, to 'video_draft.avi':
  Metadata:
    ISFT            : Lavf56.25.101
    Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj420p, 320x240, q=2-31, 2330 kb/s, 14.01 fps, 14.01 tbr, 14.01 tbn, 14.01 tbc
    Stream #0:1: Audio: adpcm_ima_wav ([17][0][0][0] / 0x0011), 11025 Hz, mono, 44 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[avi @ 0x1e14c60] non-interleaved AVI
    Last message repeated 3 times
[avi @ 0x1e14c60] non-interleaved AVI359kB time=00:00:38.80 bitrate=2398.1kbits/s  
    Last message repeated 1 times
[avi @ 0x1e15600] non-interleaved AVI
    Last message repeated 2 times
[avi @ 0x1e15600] non-interleaved AVI2666kB time=00:01:17.33 bitrate=2401.1kbits/s  
    Last message repeated 2 times
[avi @ 0x1e15be0] non-interleaved AVI
    Last message repeated 1 times
[avi @ 0x1e15be0] non-interleaved AVI4534kB time=00:01:58.21 bitrate=2393.2kbits/s  
    Last message repeated 6 times
frame= 2247 fps=1084 q=-1.0 Lsize=   47072kB time=00:02:40.39 bitrate=2404.1kbits/s  
video:46055kB audio:871kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.309152%
mul@mul-ubuntu-14:/media/mul/windows/backup/Dokumentasi/puncak-video$ ll
total 94225
drwx------ 1 mul mul     4096 Jun 24 10:14 ./
drwx------ 1 mul mul     4096 Jun 24 10:05 ../
-rw------- 1 mul mul  3868392 Nov  9  2011 cimg5907.avi
-rw------- 1 mul mul  3273448 Nov  9  2011 cimg5908.avi
-rw------- 1 mul mul  1718824 Nov  9  2011 cimg5909.avi
-rw------- 1 mul mul  1825416 Nov  9  2011 cimg5910.avi
-rw------- 1 mul mul  2469448 Nov  9  2011 cimg5911.avi
-rw------- 1 mul mul  1796840 Nov  9  2011 cimg5912.avi
-rw------- 1 mul mul  2198728 Nov  9  2011 cimg5913.avi
-rw------- 1 mul mul  2112552 Nov  9  2011 cimg5914.avi
-rw------- 1 mul mul  2990408 Nov  9  2011 cimg5916.avi
-rw------- 1 mul mul  2576232 Nov  9  2011 cimg5917.avi
-rw------- 1 mul mul  2756680 Nov  9  2011 cimg5918.avi
-rw------- 1 mul mul  2485864 Nov  9  2011 cimg5919.avi
-rw------- 1 mul mul  2321768 Nov  9  2011 cimg5920.avi
-rw------- 1 mul mul  3027432 Nov  9  2011 cimg5922.avi
-rw------- 1 mul mul  3318568 Nov  9  2011 cimg5923.avi
-rw------- 1 mul mul  2600776 Nov  9  2011 cimg5924.avi
-rw------- 1 mul mul  1337320 Nov  9  2011 cimg5925.avi
-rw------- 1 mul mul   767080 Nov  9  2011 cimg5927.avi
-rw------- 1 mul mul   746568 Nov  9  2011 cimg5929.avi
-rw------- 1 mul mul  1353672 Nov  9  2011 cimg5930.avi
-rw------- 1 mul mul  1308552 Nov  9  2011 cimg5932.avi
-rw------- 1 mul mul  1378280 Nov  9  2011 cimg5933.avi
-rw------- 1 mul mul      440 Jun 24 10:13 mylist.txt
-rw------- 1 mul mul 48201234 Jun 24 10:14 video_draft.avi

update:

Untuk konversi ke mp4 :

ffmpeg -i video_draft.avi -acodec libfaac -b:a 128k -vcodec mpeg4 -b:v 1200k -flags +aic+mv4 output.mp4

atau :

ffmpeg -i video_draft.avi -acodec libfdk_aac -b:a 128k -vcodec mpeg4 -b:v 1200k -flags +aic+mv4 output.mp4

No comments:

Post a Comment