Skip to content

Instantly share code, notes, and snippets.

@eet-nu
Created November 27, 2009 09:04
Show Gist options
  • Save eet-nu/243913 to your computer and use it in GitHub Desktop.
Save eet-nu/243913 to your computer and use it in GitHub Desktop.
context "transcoding a movie" do
codecs = [ { :context => 'XviD', :file => 'xvid.avi', :content_type => 'video/x-msvideo' },
{ :context => 'DivX5', :file => 'divx5.avi', :content_type => 'video/x-msvideo' },
{ :context => 'h.264', :file => 'h264.avi', :content_type => 'video/x-msvideo' },
{ :context => 'h.263', :file => 'h263.mov', :content_type => 'video/quicktime' },
{ :context => 'h.261', :file => 'h261.avi', :content_type => 'video/x-msvideo' },
{ :context => 'MPEG-1', :file => 'mpeg1.mpg', :content_type => 'video/mpeg' },
{ :context => 'MPEG-2', :file => 'mpeg2.mpeg', :content_type => 'video/mpeg' },
{ :context => 'MPEG-3', :file => 'mpeg3.avi', :content_type => 'video/x-msvideo' },
{ :context => 'WMV', :file => 'wmv.wmv', :content_type => 'video/x-msvideo' },
# { :context => 'MPEG-4', :file => 'mpeg4.mp4', :content_type => 'video/mpeg' },
{ :context => 'Quicktime QDRW', :file => 'quicktime_qdrw.mov', :content_type => 'video/quicktime' },
{ :context => 'Quicktime RLE', :file => 'quicktime_rle.mov', :content_type => 'video/quicktime' }, ]
codecs.each do |codec|
context codec[:context] do
before(:each) do
@video.update_attributes :asset => monster_video_fixture_file_upload("sample_videos/" + codec[:file], codec[:content_type])
@video.process!
end
it "should be done with processing" do
@video.processing.should be_false
end
it "should generate a flv" do
valid_file?("#{@video.asset.path(:flv)}").should be_true
end
it "should generate a preview" do
valid_file?("#{@video.asset.path(:preview)}").should be_true
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment