Felix Felix - 5 months ago 101
Ruby Question

Rails Streamio FFMPEG taking a screenshot of the movie and upload with carrierwave

I have got a Form where I can upload a movie. Its uploaded with carrierwave.

In this process I want to Make a screenshot of the movie while uploading.

How can I do this with Streamio FFMPEG.

My code Looks like this at the moment.

#Laedt ein Video hoch
def uploadMovie
@channels = Channel.all
@vid = Movie.new(movies_params)

@channel = Channel.find(params[:channel_id])
@vid.channel = @channel

if @vid.save
flash[:notice] = t("flash.saved")
render :add
else
render :add
end
end


Do I have to do this in controller method or in the carrierwave uplaoder?

Update: I tried it this way:

if @vid.save
flash[:notice] = t("flash.saved")
movieFile = FFMPEG::Movie.new(@vid.video.to_s)
screenshot = movieFile.screenshot("uploads/screenshot", :seek_time => 10)
render :add
else


But then I got tis error:

s3.amazonaws.com/uploads/movie/video/6/2016-04-24_16.26.10.mp4' does not exist

Answer

Solution is carrierwave thumbnailer gem

gem 'carrierwave-video-thumbnailer'

https://github.com/evrone/carrierwave-video-thumbnailer

Comments