Search code examples
bashshellffmpegcygwin

Error while concating mkv files using ffmpeg in cygwin based shell script


I have written cygwin based shell script to concate 2 .mkv files as below,

#!/bin/sh
ffmpeg -f concat -i concat.txt -codec copy out.mkv

concat.txt contains path to 2 mkv files to be concatenated

file '../temp/1'
file '../temp/2'

when I run script from cygwin terminal I get following error

Rishi@Rishikesh /cygdrive/i/video/Interface_code/Testing_function/bin
$ . script.sh
ffmpeg version 2.5.2 Copyright (c) 2000-2014 the FFmpeg developers
built on Dec 30 2014 17:13:24 with gcc 4.9.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-    avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --  enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
libavutil      54. 15.100 / 54. 15.100
libavcodec     56. 13.100 / 56. 13.100
libavformat    56. 15.102 / 56. 15.102
libavdevice    56.  3.100 / 56.  3.100
libavfilter     5.  2.103 /  5.  2.103
libswscale      3.  1.101 /  3.  1.101
libswresample   1.  1.100 /  1.  1.100
libpostproc    53.  3.100 / 53.  3.100
Guessed Channel Layout for  Input Stream #0.1 : stereo
Input #0, concat, from 'concat.txt':
Duration: N/A, start: 0.000000, bitrate: 1536 kb/s
Stream #0:0: Video: h264 (High), yuv420p, 720x576 [SAR 1:1 DAR 5:4], 25 fps,     25 tbr, 1k tbn, 50 tbc
Stream #0:1: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
'NULL @ 04780280] Unable to find a suitable output format for 'out.mkv
: Invalid argument

another thing to add, if I run this command from cygwin terminal directly(instead of calling it through script) it runs correctly and creates concatenated output .mkv file


Solution

  • Applying dos2unix command on shell script file solved my problem. Hope it helps someone.