FFmpeg unable to find a suitable output format when run from script

1

I'm trying to write bash script, which I can use to start encode of my video for web player, and also log to file when it started / finished.

It looks like this:

#!/bin/bash
>/var/www/stat/encode.txt
echo "on $(date +%s)" > /var/www/stat/encode.txt
ffmpeg -i 'suzumiya.mkv' -preset slow -crf 18 -c:v libx264 -c:a aac -strict -2 -movflags faststart -tune animation -profile:v baseline -vf "ass=suzumiya.ass" 'suzu.mp4'
echo "off $(date +%s)" > /var/www/stat/encode.txt

When I run it, it tells me:

'NULL @ 0x20ad4c0] Unable to find a suitable output format for 'suzu.mp4
: Invalid argument

When I just copypaste the ffmpeg code to console, it works well, no error. Where can be problem?

Full output:

ffmpeg version N-63938-g684a915 Copyright (c) 2000-2014 the FFmpeg developers
  built on Jun 13 2014 18:07:52 with gcc 4.7 (Debian 4.7.2-5)
  configuration: --enable-gpl --enable-gray --enable-runtime-cpudetect --enable-bzlib --enable-gnutls --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libcdio --enable-libdc1394 --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libv4l2 --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-openal --enable-zlib --enable-nonfree --enable-version3 --enable-x11grab
  libavutil      52. 89.100 / 52. 89.100
  libavcodec     55. 66.100 / 55. 66.100
  libavformat    55. 43.100 / 55. 43.100
  libavdevice    55. 13.101 / 55. 13.101
  libavfilter     4.  8.100 /  4.  8.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, matroska,webm, from 'suzumiya.mkv':
  Metadata:
    title           : The Melancholy of Haruhi Suzumiya: Special Ending
    encoder         : libebml v0.7.7 + libmatroska v0.8.0
    creation_time   : 2007-05-09 12:50:35
  Duration: 00:01:11.97, start: 0.000000, bitrate: 3580 kb/s
    Stream #0:0(jpn): Video: h264 (High), yuv420p, 704x480, SAR 229:189 DAR 5038:2835, 23.98 fps, 23.98 tbr, 1k tbn, 59.94 tbc (default)
    Metadata:
      title           : The Melancholy of Haruhi Suzumiya: Special Ending
    Stream #0:1(jpn): Audio: vorbis, 48000 Hz, stereo, fltp (default)
    Metadata:
      title           : 2ch Vorbis
    Stream #0:2(eng): Subtitle: ssa (default)
    Metadata:
      title           : Styled ASS
    Stream #0:3(eng): Subtitle: ssa
    Metadata:
      title           : Styled ASS (Simple)
    Stream #0:4(eng): Subtitle: subrip
    Metadata:
      title           : Plain SRT
    Stream #0:5: Attachment: ttf
    Metadata:
      filename        : GosmickSansBold.ttf
      mimetype        : application/x-truetype-font
    Stream #0:6: Attachment: ttf
    Metadata:
      filename        : epmgobld_ending.ttf
      mimetype        : application/x-truetype-font
'NULL @ 0x20ad4c0] Unable to find a suitable output format for 'suzu.mp4
: Invalid argument

Cernokneznik

Posted 2014-06-14T17:51:19.760

Reputation: 11

You shouldn't need to, but try adding -f mp4 before the output filename. – stib – 2014-06-23T08:32:20.053

Please note that you have to indent code by 4 spaces (use the code button in our editor and check the preview). For your issue: Are you absolutely sure the script is exactly as you posted here? Nothing else apart from the quotes? Try replacing single with double quotes. It shouldn't really matter but you might have some special character there. – slhck – 2014-06-14T18:48:22.300

No answers