Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • 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?

  • Confused about writing a media converter

    23 août 2011, par Erich Lancaster

    I want to write my own media converter application using ffmpeg. I have a couple of questions

    1. Can I use a command line to make the conversion. I don't think that would work if the user hasn't installed ffmpeg on to his system. If that's the case, how'd I overcome it. I don't believe their API has anything for media conversion.

    2. Is it possible to write it in Java?

  • Transcoding a video from GoToMeeting WMV to MP4 using FFMPEG on Windows locks up dos window [migrated]

    22 août 2011, par Ryan

    I've been tasked with converting some pre-recorded GoToMeeting videos from wmv to mp4 format. I've got the GoToMeeting transcoder app available from Citrix (g2mtranscoder.exe) that takes the source wmv and makes it so that ffmpeg can work with the wmv. The problem I have is when I then try and take that wmv and transcode it to mp4.

    I'm using the latest pre-compiled static version of ffmpeg for Windows from here http://ffmpeg.zeranoe.com/builds/

    Here is the command line I'm using to begin the conversion:

    "C:\ffmpeg\ffmpeg.exe" -i "999_1366_768_g2m_transcoded.wmv" -f "mp4" -b "1000k" -r "30" -ab "128k" -ar "22050" -s "1366x768" -strict "experimental" -y "999.mp4"
    

    Here is FFMPEG's output. The last line is where the dos window seems to stop executing/locks up (when I say lock up I mean just the dos window is locked up, not the entire machine):

    ffmpeg version N-31932-g41bf67d, Copyright (c) 2000-2011 the FFmpeg developers built on Aug 16 2011 18:54:12 with gcc 4.6.1
    configuration: --enable-gpl --enable-version3 --enable-memalign-hack --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
      libavutil    51. 12. 0 / 51. 12. 0
      libavcodec   53. 10. 0 / 53. 10. 0
      libavformat  53.  7. 0 / 53.  7. 0
      libavdevice  53.  3. 0 / 53.  3. 0
      libavfilter   2. 31. 1 /  2. 31. 1
      libswscale    2.  0. 0 /  2.  0. 0
      libpostproc  51.  2. 0 / 51.  2. 0
    [asf @ 01BBB600] max_analyze_duration 5000000 reached at 5194000
    
    Seems stream 1 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 59.92 (719/12)
    Input #0, asf, from 'D:\Inetpub\g2m\Transcoding\999_1366_768_g2m_transcoded.wmv':
      Metadata:
        WMFSDKVersion   : 10.00.00.4007
        WMFSDKNeeded    : 0.0.0.0000
        IsVBR           : 1
        VBR Peak        : 4403
        Buffer Average  : 1470
        WM/ToolVersion  : 4.8 Build 723
        WM/ToolName     : GoToMeeting
        BitRateFrom the writer: 1553
        Audio samples   : 6221
        Video samples   : 3455
        recording time  : Mon, 22 Aug 2011 11:48:42 Eastern Daylight Time
      Duration: 00:38:30.71, start: 0.000000, bitrate: 160 kb/s
        Stream #0.0: Audio: wmav2, 44100 Hz, 1 channels, s16, 48 kb/s
        Stream #0.1: Video: wmv3 (Main), yuv420p, 1366x768, 2154 kb/s, 59.92 tbr, 1k tbn, 1k tbc
    [buffer @ 01BBC120] w:1366 h:768 pixfmt:yuv420p tb:1/1000000 sar:0/1 sws_param:
    Output #0, mp4, to '\\nas4\FMS_APPLICATIONS\SVC\sk12\webinars\999.mp4':
      Metadata:
        WMFSDKVersion   : 10.00.00.4007
        WMFSDKNeeded    : 0.0.0.0000
        IsVBR           : 1
        VBR Peak        : 4403
        Buffer Average  : 1470
        WM/ToolVersion  : 4.8 Build 723
        WM/ToolName     : GoToMeeting
        BitRateFrom the writer: 1553
        Audio samples   : 6221
        Video samples   : 3455
        recording time  : Mon, 22 Aug 2011 11:48:42 Eastern Daylight Time
        encoder         : Lavf53.7.0
        Stream #0.0: Video: mpeg4, yuv420p, 1366x768, q=2-31, 1000 kb/s, 30 tbn, 30 tbc
        Stream #0.1: Audio: aac, 22050 Hz, 1 channels, s16, 128 kb/s
    Stream mapping:
      Stream #0.1 -> #0.0
      Stream #0.0 -> #0.1
    Press [q] to stop, [?] for help
    frame=  149 fps= 63 q=23.5 size=    1103kB time=00:00:04.96 bitrate=1818.6kbits/s dup=144 drop=0
    

    Does anyone have any idea why it's locking up the dos window and essentially failing to convert the file to mp4? I had a friend test it on a linux box and he was able to convert the video just fine.

    Thanks

  • Decoding a TCP stream using ffmpeg

    22 août 2011, par JConway

    I am using the Ffmpeg library in an Android application I am writing. I have written the code to open up a local file and decode that using avformat_open_input(). However I need to use Ffmpeg to read in a video stream over TCP. I have found a few things within Ffmpeg such as libavcodec/tcp.h but I can't establish how to actually open up a TCP stream into the decoder.

    Any suggestions would be really appreciated.