Last active
August 29, 2015 13:56
-
-
Save jcoyne/8965107 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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