ruby on rails - Capture video and audio using javascript -
i trying capture video , audio web browser , upload server. thing don't want use flash in this.
so using html5 feature , library called recorderrtc make possible. using ruby on rails in backend. though feeling feature still under implementation facing challenges.
following javascript code have written : http://pastebin.com/kjwunffd , here rails code :
uuid = uuid.generate audio_file_name = "#{uuid}.wav" if params[:chrome] audio_file_name = "#{uuid}.ogg" if params[:firefox] video_file_name = "#{uuid}.webm" directory = "#{rails.root}/public/record" directory = directory + "/chrome" if params[:chrome] directory = directory + "/firefox" if params[:firefox] audio_path = file.join(directory, audio_file_name) video_path = file.join(directory, video_file_name) #puts params[:audioblob].tempfile.read file.open(audio_path, "wb") { |f| f.write(params[:audioblob].tempfile.read) } if params[:audioblob] file.open(video_path, "wb") { |f| f.write(params[:videoblob].tempfile.read) } if params[:videoblob] output = `ffmpeg -i #{video_path} -i #{audio_path} -acodec copy -vcodec copy #{directory}/#{uuid}.mkv` message[:video_url] = "/record/chrome/#{video_file_name}" if params[:chrome] message[:video_url] = "/record/firefox/#{video_file_name}" if params[:firefox] message[:audio_url] = "/record/chrome/#{audio_file_name}" if params[:chrome] message[:audio_url] = "/record/firefox/#{audio_file_name}" if params[:firefox] message[:audio_video_url] = "/record/chrome/#{uuid}.mkv" if params[:chrome] message[:audio_video_url] = "/record/firefox/#{uuid}.mkv" if params[:firefox]
my problem when try run code through firefox ffmpeg giving error of codec not found. not sure missing. can 1 ?
it looks ffmpeg not support ogg input supplied firefox clients. have run ffmpeg command terminal without errors?
i don't think related rails, javascript , on ffmpeg. check here: https://trac.ffmpeg.org/wiki/theoravorbisencodingguide
Comments
Post a Comment