ruby-av / paperclip-av-transcoder

Audio/Video Transcoder for Paperclip using FFMPEG/Avconv
MIT License
136 stars 82 forks source link

-ss and 'Unable to find a suitable output format for '00:00:00' #49

Open jacobshiff opened 8 years ago

jacobshiff commented 8 years ago

It seems that the -ss position for input defaults to 3 seconds. I would like to set it to 0, but when I set it to 0 I receive the following error: Unable to find a suitable output format for '00:00:00'.

class CustomGif < ActiveRecord::Base

  has_attached_file :gif, styles: {
    original: {
      format: "gif",
      convert_options: {
        input: {
          ss: '00:00:00' #I also tried just '0'
        },
        output: {
          t: "00:00:6.000"
        }
      }
    }
  }, :processors => [:transcoder]
  validates_attachment_content_type :gif, content_type: /\Avideo\/.*\Z/
end

When I enter 'custom_gif = CustomGif.new(gif: params['video'])' I receive the following output:

Command :: file -b --mime '/var/folders/7g/9142rygs6bngwl84c7bh4d6c0000gn/T/ac80cf3de4643bff7fec3a00dc9196d620160821-33753-7r8ssc.MOV'
[AV] Running command: if command -v avprobe 2>/dev/null; then echo "true"; else echo "false"; fi
[AV] Running command: if command -v ffmpeg 2>/dev/null; then echo "true"; else echo "false"; fi
[AV] Found ["ffmpeg"], using: Ffmpeg
[AV] Running command: if command -v avprobe 2>/dev/null; then echo "true"; else echo "false"; fi
[AV] Running command: if command -v ffmpeg 2>/dev/null; then echo "true"; else echo "false"; fi
[AV] Found ["ffmpeg"], using: Ffmpeg
[AV] Running command: ffmpeg -i "/var/folders/7g/9142rygs6bngwl84c7bh4d6c0000gn/T/ac80cf3de4643bff7fec3a00dc9196d620160821-33753-o48pji.MOV" 2>&1
[paperclip] [transcoder] Transocding supported file /var/folders/7g/9142rygs6bngwl84c7bh4d6c0000gn/T/ac80cf3de4643bff7fec3a00dc9196d620160821-33753-o48pji.MOV
[AV] Adding output parameter ["f", "image2"]
[AV] Adding output parameter ["vframes", "1"]
[AV] Adding input parameter [:ss, 3]
[AV] Adding input parameter [:ss, 0]
[AV] Adding output parameter [:t, "00:00:6.000"]
[AV] Running command: ffmpeg -ss 3 0 -i "/var/folders/7g/9142rygs6bngwl84c7bh4d6c0000gn/T/ac80cf3de4643bff7fec3a00dc9196d620160821-33753-o48pji.MOV" -f image2 -vframes 1 -t 00:00:6.000 -y "/var/folders/7g/9142rygs6bngwl84c7bh4d6c0000gn/T/ac80cf3de4643bff7fec3a00dc9196d620160821-33753-o48pji20160821-33753-n7xnk3.gif"
Av::CommandError: error while running command ffmpeg -ss 3 0 -i "/var/folders/7g/9142rygs6bngwl84c7bh4d6c0000gn/T/ac80cf3de4643bff7fec3a00dc9196d620160821-33753-o48pji.MOV" -f image2 -vframes 1 -t 00:00:6.000 -y "/var/folders/7g/9142rygs6bngwl84c7bh4d6c0000gn/T/ac80cf3de4643bff7fec3a00dc9196d620160821-33753-o48pji20160821-33753-n7xnk3.gif": Command 'ffmpeg -ss 3 0 -i "/var/folders/7g/9142rygs6bngwl84c7bh4d6c0000gn/T/ac80cf3de4643bff7fec3a00dc9196d620160821-33753-o48pji.MOV" -f image2 -vframes 1 -t 00:00:6.000 -y "/var/folders/7g/9142rygs6bngwl84c7bh4d6c0000gn/T/ac80cf3de4643bff7fec3a00dc9196d620160821-33753-o48pji20160821-33753-n7xnk3.gif"' returned 1. Expected 0
Here is the command output: STDOUT:

STDERR:

ffmpeg version 3.1.1 Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 7.3.0 (clang-703.0.31)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.1.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --disable-lzma --enable-vda
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 41.100 / 57. 41.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 47.100 /  6. 47.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/var/folders/7g/9142rygs6bngwl84c7bh4d6c0000gn/T/ac80cf3de4643bff7fec3a00dc9196d620160821-33753-o48pji.MOV':
  Metadata:
    major_brand     : qt  
    minor_version   : 0
    compatible_brands: qt  
    creation_time   : 2016-08-22 02:11:36
    com.apple.quicktime.make: Apple
    com.apple.quicktime.software: 9.3.3
    com.apple.quicktime.model: iPhone 6s
    com.apple.quicktime.creationdate: 2016-08-21T22:11:36-0400
  Duration: 00:00:02.42, start: 0.000000, bitrate: 866 kb/s
    Stream #0:0(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt709/bt709), 480x360, 763 kb/s, 24 fps, 24 tbr, 600 tbn, 1200 tbc (default)
    Metadata:
      rotate          : 90
      creation_time   : 2016-08-22 02:11:36
      handler_name    : Core Media Data Handler
      encoder         : H.264
    Side data:
      displaymatrix: rotation of -90.00 degrees
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 84 kb/s (default)
    Metadata:
      creation_time   : 2016-08-22 02:11:36
      handler_name    : Core Media Data Handler
[NULL @ 0x7fcaf280c800] Unable to find a suitable output format for '0'
0: Invalid argument