ruby-av / paperclip-av-transcoder

Audio/Video Transcoder for Paperclip using FFMPEG/Avconv
MIT License
135 stars 83 forks source link

ffmpeg failure: Could not get frame filename number 2 from pattern #2

Closed garyfoster closed 9 years ago

garyfoster commented 9 years ago

I'm receiving this error when attempting to process a video. It appears that the command is missing the "vframes 1" option? When I run the ffmpeg command manually, it does work fine when I add "vframes 1". I'm using the master branch straight from github.

[image2 @ 0x7feda1824a00] Could not get frame filename number 2 from pattern '/var/folders/ys/wn_46zvs6jbgjvgnn45snf9m0000gn/T/dc5c7986daef50c1e02ab09b442ee34f20141018-34360-1kbemf620141018-34360-1615t53.jpg' (either set updatefirst or use a pattern like %03d within the filename pattern)
av_interleaved_write_frame(): Invalid argument
frame=    2 fps=0.0 q=3.6 Lsize=N/A time=00:00:00.06 bitrate=N/A
video:204kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!
Av::CommandError: error while running command ffmpeg -i "/var/folders/ys/wn_46zvs6jbgjvgnn45snf9m0000gn/T/dc5c7986daef50c1e02ab09b442ee34f20141018-34360-1kbemf6.MOV" -y "/var/folders/ys/wn_46zvs6jbgjvgnn45snf9m0000gn/T/dc5c7986daef50c1e02ab09b442ee34f20141018-34360-1kbemf620141018-34360-1615t53.jpg": Command 'ffmpeg -i "/var/folders/ys/wn_46zvs6jbgjvgnn45snf9m0000gn/T/dc5c7986daef50c1e02ab09b442ee34f20141018-34360-1kbemf6.MOV" -y "/var/folders/ys/wn_46zvs6jbgjvgnn45snf9m0000gn/T/dc5c7986daef50c1e02ab09b442ee34f20141018-34360-1kbemf620141018-34360-1615t53.jpg"' returned 1. Expected 0
owahab commented 9 years ago

Can you post the related model's has_attached_file line?

garyfoster commented 9 years ago

I used the same one from your README, just changing the attribute name:

has_attached_file :video, :styles => {
    :medium => { :geometry => "640x480", :format => 'flv' },
    :thumb => { :geometry => "100x100#", :format => 'jpg', :time => 10 }
  }, :processors => [:transcoder]
chienhungchen commented 9 years ago

@garyfoster I ran into the same issue. I was able to get the video to process by looking at the paperclip-ffmpeg gem that @owahab also put together I believe. Try adding this line to your development.rb

Paperclip.options[:command_path] = "/usr/local/bin/"

Also, heads up I found that installing ffmpeg from http://ffmpeg.org/download.html#build-mac didn't work for me on OSX. I had to use Homebrew.

I am however running into a image conversion issue. @owahab i'll be opening a separate issue for it.

garyfoster commented 9 years ago

Thanks for the input but the ffmpeg command line is indeed running fine, it is not having trouble locating the binary. I also installed via homebrew. The issue is that there is a missing argument not sent to the ffmpeg command to indicate that only 1 vframe is desired. Perhaps the version of ffmpeg I'm using has different behavior, I'm using version 2.4.2. @owahab please reply with the version you tested with if you want me to pursue this angle.

owahab commented 9 years ago

@garyfoster I can confirm the issue. The gem currently doesn't generate screenshots properly.

Can you please use paperclip-ffmpeg until I get this fixed in av gem, or if you have time and willing to help, can you fork and patch av to add the appropriate logic to handle screenshots?

garyfoster commented 9 years ago

@owahab I had tried the other gem already and in that instance, it did run without exception but the resulting jpg was an empty file.

I did take a look at the av gem and perhaps we can patch it. I have a team member assigned to this but our schedule is pretty hectic, not sure if we will fix before you can. Thanks for you response and your effort here.

NathanielWroblewski commented 9 years ago

Any updates on this?

owahab commented 9 years ago

@NathanielWroblewski nope, pull requests are very welcome.

owahab commented 9 years ago

Please check with latest HEAD

aestrro commented 9 years ago

@owahab are you saying that the thumbnail issue has been addressed?

aestrro commented 9 years ago

@owahab it actually does work for me, I tested with mp4 on OSX.

owahab commented 9 years ago

Good. Closing this.

wsdg1992 commented 2 years ago

are you ok?