function not working in production mode
Posted
by maps
on Stack Overflow
See other posts from Stack Overflow
or by maps
Published on 2010-03-19T02:11:45Z
Indexed on
2010/03/19
2:21 UTC
Read the original article
Hit count: 276
ruby-on-rails
I am using the rvideo gem to transcode files to a .flv format.
class Video < ActiveRecord::Base
include AASM
aasm_column :status
aasm_initial_state :initial
aasm_state :initial
aasm_state :converting, :exit => :transcode
aasm_state :transfering , :exit => :send_s3
aasm_state :completed
aasm_state :failed
aasm_event :convert do
transitions :from => [:initial], :to => :converting
end
aasm_event :transfer do
transitions :from => [:converting], :to => :transfering
end
aasm_event :complete do
transitions :from => [:transfering], :to => :completed
end
aasm_event :error do
transitions :from => [:initial, :converting, :transfering, :completed]
end
has_attached_file :asset,
:path => "uploads/:attachment/:id.:basename.:extension"
def flash_path
return self.asset.path + '.flv'
end
def flash_name
return File::basename(self.asset.path)# + '.flv'
end
def flash_url
return "#{AWS_HOST}/#{AWS_BUCKET}/#{self.flash_name}"
end
# transcode file
def transcode
begin
RVideo::Transcoder.logger = logger
file = RVideo::Inspector.new(:file => self.asset.path)
command = "ffmpeg -i $input_file$ -y -s $resolution$ -ar 44100 -b 64k -r 15 -sameq $output_file$"
options = {
:input_file => "#{RAILS_ROOT}/#{self.asset.path}",
:output_file => "#{RAILS_ROOT}/#{self.flash_path}",
:resolution => "320x200"
}
transcoder = RVideo::Transcoder.new
transcoder.execute(command, options)
rescue RVideo::TranscoderError => e
logger.error "Encountered error transcoding #{self.asset.path}"
logger.error e.message
end
end
The input file is added to the asset directory, but I never get an outputted file. On the view page aasm hangs on "converting".
© Stack Overflow or respective owner