Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
join audio file in specific time of the video ffmpeg
25 novembre 2012, par George L.i am trying to use the code bellow to merge an audio file at specific time (6th second of my input video) and create a new video autput file but i cant make it work.
<?php exec("/usr/local/bin/ffmpeg -sameq -i /home/xxx/public_html/xxx/video/full.mp4 -itsoffet 6 -i /home/xxx/public_html/xxx/sounds/names/george.mp3 /home/xxx/public_html/xxx/upload/sample.mpg"); ?>
Thank you a lot!
-
Exit Status with ffmpeg Command in Rails
25 novembre 2012, par DragonFire353I am trying to get uploaded videos to be converted in the background, running windows. I am using:
gem 'paperclip' gem 'aasm' gem 'delayed_job_active_record' gem 'ffmpeg'
I was using purely paperclip before and making the user wait and it worked great, now I am having problems with the return of the error status for the command, I have tried editing to possible fix the command wondering if it was failing in the first place but I keep getting:
undefined method `exitstatus' for nil:NilClass
no matter what. I've tried looking this up and it's supposedly valid syntax that should work... Also I've commented out the actual spawn do part because I get another error if I leave that in:
wrong number of arguments
Does anyone know how to properly get this working? I've went through a few tutorials that have bits and pieces of what I need but I can't get them working together. Here's what I have so far, lemme know if you need more:
Model:
class Video < ActiveRecord::Base include AASM belongs_to :user has_many :comments, dependent: :destroy attr_accessible :video, :user_id, :video_file_name, :title, :public, :description, :views has_attached_file :video, url: "/users/:user_id/videos/:id/:basename_:style.:extension" #, :styles => { # :video => { geometry: "800x480>", format: 'webm' }, # :thumb => { geometry: "200x200>", format: 'png', time: 3 }, # }, processors: [:ffmpeg], url: "/users/:user_id/videos/:id/:basename_:style.:extension" #process_in_background :video #causes death validates :video, presence: true validates :description, presence: true, length: { minimum: 5, maximum: 100} validates :title, presence: true, length: { minimum: 1, maximum: 15 } validates_attachment_size :video, less_than: 1.gigabytes validates_attachment :video, presence: true default_scope order: 'created_at DESC' Paperclip.interpolates :user_id do |attachment, style|attachment.instance.user_id end #acts as state machine plugin aasm state: :pending do state :pending, initial: true state :converting state :converted #, enter: :set_new_filename state :error event :convert do transitions from: :pending, to: :converting end event :converted do transitions from: :converting, to: :converted end event :failure do transitions from: :converting, to: :error end end # This method is called from the controller and takes care of the converting def convert self.convert! #spawn a new thread to handle conversion #spawn do success = delay.system(convert_command) logger.debug 'Converting File: ' + success.to_s if success && $?.exitstatus.to_i == 0 self.converted! else self.failure! end #end end def self.search(search) if search find(:all, conditions: ["public = 't' AND title LIKE ?", "%#{search}%"], order: "created_at DESC") else find(:all, conditions: ["public = 't'"], order: "created_at DESC") end end def self.admin_search(search) if search find(:all, conditions: ['title LIKE ?', "%#{search}%"], order: "created_at DESC") else find(:all, order: "created_at DESC") end end private def convert_command #construct new file extension webm = "." + id.to_s + ".webm" #build the command to execute ffmpeg command = <<-end_command ffmpeg -i #{ RAILS_ROOT + '/public/users/:user_id/videos/:id/:basename_:style.:extension' } -ar 22050 -ab 32 -s 1280x720 -vcodec webm -r 25 -qscale 8 -f webm -y #{ RAILS_ROOT + '/public/users/:user_id/videos/:id/:basename_.webm' } end_command logger.debug "Converting video...command: " + command command end handle_asynchronously :convert_command # This updates the stored filename with the new flash video file def set_new_filename #update_attribute(:filename, "#{filename}.#{id}.webm") update_attribute(:content_type, "video/x-webm") end end
Controller:
class VideosController < ApplicationController before_filter :signed_in_user, only: [:upload, :update, :destroy] before_filter :admin_user, only: :admin_index def upload @video = Video.new # generate a unique id for the upload @uuid = (0..29).to_a.map {|x| rand(10)} end def create @video = Video.new(params[:video]) @video.user_id = current_user.id if @video.save @video.convert flash[:success] = "Uploaded Succefully!" redirect_to @video.user else render 'upload' end end def show @video = Video.find(params[:id]) @comments = @video.comments.paginate(page: params[:page], per_page: 6) if !@video.public if !signed_in? || current_user.id != @video.user_id && !current_user.admin && !current_user.approved?(@video.user) flash[:notice] = "Video is private" redirect_to root_path end end end def update @video = Video.find(params[:id]) if @video.update_attributes(params[:video]) flash[:success] = "Video preferences saved" else flash[:fail] = "Failed to update video preferences" end redirect_to :back end def destroy @video = Video.find(params[:id]) @video.destroy flash[:deleted] = "Deleted Succefully!" redirect_to :back end def index @videos = Video.paginate(page: params[:page], per_page: 6).search(params[:search]) end def admin_index @videos = Video.paginate(page: params[:page], per_page: 6).admin_search(params[:search]) end def ajax_video_comments @video = Video.find(params[:id]) @comments = @video.comments.paginate(page: params[:page], per_page: 6) respond_to do |format| format.js { render partial: 'shared/comments', content_type: 'text/html' } end end def ajax_video_watched @video = Video.find(params[:id]) @video.views += 1 @video.save end private def signed_in_user redirect_to root_path, notice: "Please Login." unless signed_in? end def admin_user redirect_to(root_path) unless current_user.admin? end end
-
Video Slideshow from png files + mp3 audio
25 novembre 2012, par James EvansI have a bunch of .png frames and a .mp3 audio file which I would like to convert into a video. Unfortunately, the frames do not correspond to a constant frame rate. For instance, one frame may need to be displayed for 1 second, whereas another may need to be displayed for 3 seconds.
Is there any open-source software (something like ffmpeg) which would help me accomplish this? Any feedback would be greatly appreciated.
Many thanks!
-
FFMPEG wmv conversion to flv
25 novembre 2012, par Brandon Grossuttianyone using ffmpeg
I have a fairly simple wmv exported by a user from movie maker with standard output and want to convert to .flv using
C:>ffmpeg -i "E:\Jab Core 4 Recounters.wmv" -vcodec flv "C:\Net Projects\SVN\IntegratedAlgorithmics\src\MediaAdmin\MediaAdmin\bin\Debug\Movies\Jab Core 4 Recounters.flv" -ar 44100
the output / error i receive is
FFmpeg version 0.5, Copyright (c) 2000-2009 Fabrice Bellard, et al. configuration: --enable-gpl --enable-postproc --enable-swscale --enable-avfilt er --enable-avfilter-lavf --enable-pthreads --enable-avisynth --enable-libfaac - -enable-libfaad --enable-libmp3lame --enable-libspeex --enable-libtheora --enabl e-libvorbis --enable-libxvid --enable-libx264 --enable-memalign-hack libavutil 49.15. 0 / 49.15. 0 libavcodec 52.20. 0 / 52.20. 0 libavformat 52.31. 0 / 52.31. 0 libavdevice 52. 1. 0 / 52. 1. 0 libavfilter 0. 4. 0 / 0. 4. 0 libswscale 0. 7. 1 / 0. 7. 1 libpostproc 51. 2. 0 / 51. 2. 0 built on Mar 16 2009 16:09:18, gcc: 4.2.4 [Sherpya] [wmv3 @ 0x1c0d490]Extra data: 8 bits left, value: 0 Seems stream 1 codec frame rate differs from container frame rate: 1000.00 (1000 /1) -> 30.00 (30/1) Input #0, asf, from 'E:\Jab Core 4 Recounters.wmv': Duration: 00:01:55.99, start: 5.000000, bitrate: 813 kb/s Stream #0.0: Audio: wmav2, 48000 Hz, stereo, s16, 192 kb/s Stream #0.1: Video: wmv3, yuv420p, 640x480, 586 kb/s, 30 tbr, 1k tbn, 1k tbc Output #0, flv, to 'C:\Net Projects\SVN\IntegratedAlgorithmics\src\MediaAdmin\Me diaAdmin\bin\Debug\Movies\Jab Core 4 Recounters.flv': Stream #0.0: Video: flv, yuv420p, 640x480, q=2-31, 200 kb/s, 90k tbn, 30 tbc Stream #0.1: Audio: libmp3lame, 48000 Hz, stereo, s16, 64 kb/s Stream mapping: Stream #0.1 -> #0.0 Stream #0.0 -> #0.1 [wmv3 @ 0x1c0d490]Extra data: 8 bits left, value: 0 [libmp3lame @ 0x1c0d8d0]flv does not support that sample rate, choose from (4410 0, 22050, 11025). Could not write header for output file #0 (incorrect codec parameters ?)
i added th -ar switch when i got the error the first time
the codec info i have on the file is as follows
General Complete name : E:\Jab Core 4 Recounters.wmv Format : Windows Media File size : 11.3 MiB Duration : 2mn 0s Overall bit rate mode : Variable Overall bit rate : 780 Kbps Maximum Overall bit rate : 949 Kbps Encoded date : UTC 2009-03-07 07:02:41.121 Writing application : 6.0.6000.16386 / Windows Movie Maker Application : Windows Movie Maker 6.0.6000.16386 Video ID : 2 Format : VC-1 Format profile : MP@ML Codec ID : WMV3 Codec ID/Info : Windows Media Video 9 Codec ID/Hint : WMV3 Duration : 2mn 0s Bit rate mode : Variable Bit rate : 587 Kbps Width : 640 pixels Height : 480 pixels Display aspect ratio : 4/3 Frame rate : 30.000 fps Resolution : 24 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.064 Stream size : 8.46 MiB (75%) Language : en-us Audio ID : 1 Format : WMA2 Format profile : L3 Codec ID : 161 Codec ID/Info : Windows Media Audio 2 Description of the codec : Windows Media Audio 9.2 - VBR Quality 90, 48 kHz, stereo 1-pass VBR Duration : 2mn 0s Bit rate mode : Variable Bit rate : 186 Kbps Channel(s) : 2 channels Sampling rate : 48.0 KHz Resolution : 16 bits Stream size : 2.68 MiB (24%) Language : en-us
i see alot of people with this issue with so solution or cause
any ideas would be helpful thanks in advance
-
How to convert iphone's caf to ogg on ubuntu
24 novembre 2012, par Amure Pinho - Syncmobilei really need your support to solve that problem:
We developed an iOS application that sends a sound file to our server and then, we share this audio.
The problem is we didnt find any solution to convert the audio inside the iOS.
We tought: Ok, thats a problem, but we can still convert the audio in the server right?
We are trying to make this using afconvert, ffmpeg but with no sucess.
Do you have any basic guide or hint so we can write this in our server application and convert all the .CAF files to another format like OGG or MP3?
Thanks a lot!