Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Rails 3.1 asset pipeline needs restart if new file created ?

    26 août 2011, par Reed G. Law

    I have a server that's taking video clips with a webcam and placing them in #{Rails.root}/app/assets/videos. The problem is I can't see newly created video clips until the server is restarted. Is there a workaround for this?

    Here's the code in the controller:

    @file_name = Time.now.strftime("%Y-%m-%d_%H-%M-%S-%p") + ".mp4"
    system("ffmpeg -f video4linux2 -s 320x240 -t 10 -i /dev/video0
      #{Rails.root.to_s}/app/assets/videos/#{@file_name}")
    

    And in the view:

    
    
  • RTP H263 frames to FFMPEG

    25 août 2011, par Pierluigi Cifani

    I've been trying to develop an RTP demuxed based on RFC 2190 to pass to the FFMPEG (libavcodec) H263 packets in Mode-A.

    However I can't seem to make the FFMPEG happy with the I-frames I am feeding it with. With fragmented frames (such as a large I-frame) I am rebuilding the whole frame following RFC 2190 and the "Marker" rules and passing it to the Libavcodec layer. However video looks buggy and it looks that I have to add some kind of header to the beginning of each frame before passing it to the Libavcodec layer. Errors like this are coming out all the time:

    illegal dc 128 at 0 3
    illegal ac vlc code at 0x3
    Error at MB: 69
    illegal ac vlc code at 4x15
    Error at MB: 349
    concealing 379 DC, 379 AC, 379 MV errors
    

    I have previously built an H264 over RTP demuxer and I had to add 0x00 0x00 0x00 0x01 0x21 header to every fragment of I Frame in order for it to be decoded correctly. But I can't find anywhere documentation on how to do this with H263.

    Maybe you could lend me a hand?

    Cheers and thanks a lot

  • FFMPEG Does not work on Windows Server 2008

    25 août 2011, par Khaldoun

    I have an ASP.NET MVC Web Site ,the user can upload a video and When Done It finish uploading I show him an image extracted from the Video, To do this I used the FFMPEG exe to get a frame. Everthing works well in the developement machine , when I use the test environement it does not work!! I've given the read/write and execute permissions to following folders: 1. videos(folder that store uploaded video files) 2. thumbnails (folder that store the thumbnails of videos, captured by ffmpeg) 3.ffmpeg.exe file at root and given read/write execute permissions to that file also. but it does not work.

     var _converter = new ImageConvertor(@System.Configuration.ConfigurationManager.AppSettings["FFmpegExec"].ToString());
                _converter.WorkingPath = Server.MapPath("~/VideoSamples");
                OutputPackage oo = _converter.ConvertToFLV(videoFilepath);
                FileStream outStream = System.IO.File.OpenWrite(Path.Combine(Server.MapPath("~/VideoSamples"), id.ToString() + ".flv"));
                oo.VideoStream.WriteTo(outStream);
    

    This Code Works on developement env but not in test env !!! Any Ideas Please

  • FFmpeg (sharpFFmpeg) decoding - Protected memory error

    25 août 2011, par mazharenko.a

    I'm trying to use C# binding of FFmpeg library calling SharpFFmpeg to decode H264 video stream that I receive by RTP. I think I correctly decapsulate NALUs from RTP-packets, but I can't decode complete frames. Function avcodec_decode_video calling throws an AccessViolationException (Attempted to read or write protected memory).
    Here are some code lines:

        //buf is a byte array containing encoded frame
        int success;
        FFmpeg.avcodec_init();
        FFmpeg.avcodec_register_all();
        IntPtr codec = FFmpeg.avcodec_find_decoder(FFmpeg.CodecID.CODEC_ID_H264);
        IntPtr codecCont = FFmpeg.avcodec_alloc_context(); //AVCodecContext
        FFmpeg.avcodec_open(codecCont, codec);
        IntPtr frame = FFmpeg.avcodec_alloc_frame();  //AVFrame
        FFmpeg.avcodec_decode_video(codecCont, frame, ref success, (IntPtr)buf[0], buf.Length); //exception
    

    Function has been imported as follows:

        [DllImport("avcodec.dll", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
        public unsafe static extern int avcodec_decode_video(IntPtr pAVCodecContext, IntPtr pAVFrame, ref int got_picture_ptr, IntPtr buf, int buf_size);
    

    Unfortunately, I don't know what do I have to do with the codecCont. Somebody wrote that it is needed to fill this structure by AVCDCR using session description received by RTSP. But I don't know which field(s) store this record.
    I'll be glad for any help.
    P.S. Excuse me for my English

  • TCP connection error when using FFServer / FFMpeg

    24 août 2011, par Mike

    I am getting a "TCP connection to localhost:8090 failed: Connection refused" error when trying to use FFServer on Ubuntu 10.04LTS Desktop.

    I am typing:

    ffmpeg -f video4linux2 -s 640x480 -r 30000/1001 -i /dev/video0 -f avi -vcodec mjpeg -r 30000/1001 http://localhost:8090/feed1.ffm

    Here is the full output:

    Input #0, video4linux2, from '/dev/video0': Duration: N/A, start: 1314207657.841770, bitrate: N/A Stream #0.0: Video: mjpeg, yuvj420p, 1280x720 [SAR 96:96 DAR 16:9], -5 kb/s, 30 tbr, 1000k tbn, 30 tbc [tcp @ 0x9e58980] TCP connection to localhost:8090 failed: Connection refused [buffer @ 0x9e58260] w:1280 h:720 pixfmt:yuvj420p tb:1/1000000 sar:96/96 sws_param: Output #0, avi, to 'http://localhost:8090/feed1.ffm': Metadata: ISFT : Lavf53.8.0 Stream #0.0: Video: mjpeg, yuvj420p, 1280x720 [SAR 96:96 DAR 16:9], q=2-31, 200 kb/s, 29.97 tbn, 29.97 tbc Stream mapping: Stream #0.0 -> #0.0`

    FFServer seems to acknowledge the request though:

    Wed Aug 24 13:40:57 2011 127.0.0.1 - - [POST] "/feed1.ffm HTTP/1.1" 200 1356

    Where is the problem? How can I use FFMPeg correctly?