Skip to content

Instantly share code, notes, and snippets.

@jcoyne
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcoyne/8965107 to your computer and use it in GitHub Desktop.
Save jcoyne/8965107 to your computer and use it in GitHub Desktop.
# lib/hydra/derivatives/psu_video.rb
# This class must live in the Hydra::Derivatives namespace
class Hydra::Derivatives::PsuVideo < Hydra::Derivatives::Video
def codecs(format)
case format
when 'mp4'
"-vcodec libx264 -acodec libflaac"
when 'webm'
"-acodec libvorbis"
else
raise ArgumentError, "Unknown format `#{format}'"
end
end
end
# Then in the make_derivatives block you say to use that processor:
makes_derivatives do |obj|
case obj.mime_type
...
when 'video/avi'
obj.transform_datastream :content,
{ :webm => {format: "webm", datastream: 'webm'},
:mp4 => {format: "mp4", datastream: 'mp4'} },
processor: :psu_video
...
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment