Newest 'ffmpeg' Questions - Stack Overflow

http://stackoverflow.com/questions/tagged/ffmpeg

Les articles publiés sur le site

  • A very simple lightweight video editor

    11 novembre 2011, par algorithmicCoder

    I want to make an editor that does the following:

    1) takes an mp3 audio file

    2) Takes a picture --a jpg file

    3) Outputs a simple video format e.g. .mov which consists of the jpg file with the mp3 file in the background

    4) Does NOTHING else

    I want to use this as a project to learn just the basics of all this stuff however I do not want to code basic things by hand. Where do I start and what key steps do I take to accomplish this?

    I am decent with PHP and Java and do not mind learning Python for this. I actually would ideally want to write this in Python to gain experience.

    Thanks!

  • Video converted to FLV using FFMPEG gets 0 size

    11 novembre 2011, par Sudhir

    I'm trying to convert avi file to flv format using FFMPEG on server, but its giving me problems. On conversion, the file is converted to flv format but no data (0 kb size file). Tried debugging the code but could not. The FFMPEG is installed in CentOS, in path /usr/bin/ffmpeg, and i'm using following command for conversion:

    $srcFile = "/home/mydomain/public_html/demo/test/sample.avi";
    $destFile = "/home/mydomain/public_html/demo/test/sample_again.flv";
    
    $ffmpegPath = "/usr/bin/ffmpeg";
    $flvtool2Path = "/usr/local/bin/flvtool2";
    
    $command = $ffmpegPath . " -y -i " . $srcFile .  " -ar 32000 -ab 32000 -f flv -s 320x240 ".
    $destFile . " | " . $flvtool2Path . " -U stdin " . $destFile;
    
    exec($command, $output);
    print_r($output);
    

    I tried doing:

    exec("which ffmpeg");
    

    And it gave me the path /usr/bin/ffmpeg, but get following error when i execute the code:

    Array ( 
    [0] => ERROR: undefined method `timestamp' for nil:NilClass 
    [1] => ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flv/stream.rb:285:in `lasttimestamp' 
    [2] => ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flv/stream.rb:274:in `duration' 
    [3] => ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:181:in `add_meta_data_tag' 
    [4] => ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:137:in `update' 
    [5] => ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:47:in `send' 
    [6] => ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:47:in `execute!' 
    [7] => ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:46:in `each' 
    [8] => ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:46:in `execute!' 
    [9] => ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:206:in `process_files' 
    [10] => ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:44:in `execute!' 
    [11] => ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2.rb:168:in `execute!' 
    [12] => ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2.rb:228 
    [13] => ERROR: /usr/local/bin/flvtool2:2:in `require' 
    [14] => ERROR: /usr/local/bin/flvtool2:2 
    ) 
    

    What could be the problem. Is this the problem of Flvtool2, if yes then what is it. Please suggest something

  • FFMPEG - Scale video filter not providing expected results

    11 novembre 2011, par dpassera

    Apologies if this question has been asked. I couldn't find it, but if it has, please let me know and I'll close this out.

    I'm attempting a simple scale of a video whose original dimensions are 480x360 and whose target dimensions are 400x300. The video starts as an FLV and eventually needs to end up as an MPEG. I'm using the following command line to do this:

    ffmpeg -i user.flv -vf "scale=400:300" user_scaled.mpg
    

    When I play the scaled video in MPEG Streamclip, the scale is correct and the video info shows that the dimensions are 400x300. However, when I play the scaled video in Quicktime, the video is scaled to 478x359. More importantly, FFMPEG, itself, treats the video as being 478x359, so any future commands (trimming, conversion, overlaying, etc) executed on it result in a video of 478x359.

    The initial workflow required an FLV to MPEG conversion, but I've tried this with several different in and out formats (FLV -> FLV, FLV -> MPEG, MPEG -> MPEG, etc) all with the same results. As long as I can end up with an MPEG, though, I can deal with however many steps and conversions it would take to get this scaling working.

    I'll paste the command-line output below, and a sample input video is also linked below, if you'd like it. Thank you very much for any help.

    http://www.monkeydriver.com/dpassera/stack_flv.zip

    Command-line output:

    ffmpeg -i user.flv -vf "scale=400:300" user_scaled.mpg
    
    ffmpeg version 0.7-rc1, Copyright (c) 2000-2011 the FFmpeg developers
      built on May 21 2011 22:13:19 with gcc 4.1.2 20080704 (Red Hat 4.1.2-50)
      configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 
     --mandir=/usr/share/man --incdir=/usr/include --disable-avisynth
     --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
     -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC'
     --enable-avfilter --enable-libdirac --enable-libgsm --enable-libmp3lame
     --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264
     --enable-gpl --enable-postproc --enable-pthreads --enable-shared
     --enable-swscale --enable-vdpau --enable-version3 --enable-x11grab
     --disable-yasm --enable-filters --enable-filter=movie
    
      libavutil    50. 40. 1 / 50. 40. 1
      libavcodec   52.120. 0 / 52.120. 0
      libavformat  52.108. 0 / 52.108. 0
      libavdevice  52.  4. 0 / 52.  4. 0
      libavfilter   1. 77. 0 /  1. 77. 0
      libswscale    0. 13. 0 /  0. 13. 0
      libpostproc  51.  2. 0 / 51.  2. 0
    
    [flv @ 0x11dd3b30] Estimating duration from bitrate, this may be inaccurate
    Input #0, flv, from 'user.flv':
    
      Metadata:
        duration        : 5
        videocodecid    : 2
        audiocodecid    : 6
        canSeekToEnd    : true
        createdby       : FMS 4.0
        creationdate    : Mon Oct 31 11:43:44 2011
    
      Duration: 00:00:04.62, start: 0.000000, bitrate: N/A
        Stream #0.0: Video: flv, yuv420p, 640x480, 1k tbr, 1k tbn, 1k tbc
        Stream #0.1: Audio: nellymoser, 44100 Hz, mono, s16
    
    [buffer @ 0x11ddc950] w:640 h:480 pixfmt:yuv420p
    
    [scale @ 0x11dda610] w:640 h:480 fmt:yuv420p -> w:400 h:300 fmt:yuv420p flags:0xa0000004
    
    [mpeg @ 0x11dd6bd0] VBV buffer size not set, muxing may fail
    
    Output #0, mpeg, to 'user_scaled.mpg':
      Metadata:
        duration        : 5
        videocodecid    : 2
        audiocodecid    : 6
        canSeekToEnd    : true
        createdby       : FMS 4.0
        creationdate    : Mon Oct 31 11:43:44 2011
        encoder         : Lavf52.108.0
    
        Stream #0.0: Video: mpeg1video, yuv420p, 400x300, q=2-31, 200 kb/s, 90k tbn, 60 tbc
    
        Stream #0.1: Audio: mp2, 44100 Hz, mono, s16, 64 kb/s
    
    Stream mapping:
    Stream #0.0 -> #0.0
    Stream #0.1 -> #0.1
    
    Press [q] to stop encoding
    frame=  230 fps=  0 q=10.2 size=     366kB time=3.82 bitrate= 785.6kbits/s dup=175 drop=0 
    frame=  267 fps=  0 q=10.7 Lsize=     412kB time=4.43 bitrate= 761.3kbits/s dup=203 drop=0    
    
    video:370kB audio:36kB global headers:0kB muxing overhead 1.568959%
    
  • FFMPEG API : How to connect to RTSP stream using av_open_input_file ?

    10 novembre 2011, par Alex

    I'm trying to connect to some RTSP stream using av_open_input_file() like this:

    AVFormatContext* ic; avcodec_register_all(); av_register_all(); av_open_input_file(&ic, "rtsp://login:password@xxx.xxx.xxx.xxx/videoinput_1/mjpeg/media.stm", NULL, 4096, NULL);

    It always returns 'file not found'. The same url, though, I can see in, say, VLC player. Do I do something wrong in my code?

    I'm using FFMPEG 0.6, shall I use the latest instead?

  • Get Stream and save as jpeg file from IP Camera using ffmpeg

    10 novembre 2011, par mekici

    How i can get stream from Ip Camera, Its using RTP, stream is MPEG4, i have multicast address and port,and i have ip camera's IP address and Port Number. And I cant reach via http forexample (http://ip/jpeg) And I cant reach stream with VLC Player too. forexample (rtp://ipadressofcam:port) and (rtp://multicastaddress:port)
    So What is ffmpeg command of that?
    I have windows OS, I only write code with C#, I dont know, c or c++.
    But producer created their own ocx which used for viewing cam,that plugin can work on .net but i dont want to use it becouse it doesnt have much funcionality, I mean you cant get current picture or snapshot of cams, thats why i have to do it myself i already asked before in that link
    Thanks