Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Need help correcting Access Violation with FFmpeg DLL

    26 septembre 2012, par James

    I'm trying to use the FFmpeg dll's using Visual Studio 2012 and I'm getting a run time access violation when I call avcodec_find_encoder. Here is the code:

    // TestFFmpeg.cpp : Defines the entry point for the console application.
    //
    
    #include "stdafx.h"
    
    extern "C" {
    #include "libavcodec\avcodec.h"
    #include "libavformat\avformat.h"
    }
    
    #define INBUF_SIZE 4096
    
    int _tmain(int argc, _TCHAR* argv[])
    {
        AVCodec *codec;
    
        const char *videoFilename = "C:\\Users\\Public\\Videos\\Sample Videos\\Wildlife.wmv";
    
        av_register_all(); // This works; however, no parameters or return values.
    
        codec = avcodec_find_encoder(CODEC_ID_WMV3);  // Run time Access Violation HERE
        if (!codec) {
        fprintf(stderr, "Codec not found\n");
            exit(1);
        }
    
        return 0;
    }
    

    Here is the error message:

    Unhandled exception at 0x75C18B60 (msvcrt.dll) in TestFFmpeg.exe: 0xC0000005: Access violation reading location 0x00000049.

    The stack trace is:

        msvcrt.dll!_strcmp()    Unknown
        avcodec-54.dll!6a56caac()   Unknown
        [Frames below may be incorrect and/or missing, no symbols loaded for avcodec-54.dll]    
    >   TestFFmpeg.exe!wmain(int argc, wchar_t * * argv) Line 23    C++
        TestFFmpeg.exe!__tmainCRTStartup() Line 533 C
        TestFFmpeg.exe!wmainCRTStartup() Line 377   C
        kernel32.dll!@BaseThreadInitThunk@12()  Unknown
        ntdll.dll!___RtlUserThreadStart@8() Unknown
        ntdll.dll!__RtlUserThreadStart@8()  Unknown
    

    I'm guessing there's a problem with returning the codec pointer, but I'm new to C++ and have no idea how to correct it. I tried the cdecl, stdcall, and fastcall calling conventions -- none corrected the issue. I'm using the latest 32-bit DLL from Zeranoe. Any suggestions?

    EDIT: I've called other functions in the DLL and they work. For example, avformat_open_input works properly. I can pass parameters and the function returns a successful return value (0) and populates the format context structure. av_find_stream_info works as well. I still can't figure out why avcodec_find_decoder creates an access violation.

  • FFMPEG Segmenting skips when m3u8 changes file

    25 septembre 2012, par user792164

    I am attempting to segment a large video file in to segments. When streamed (even locally) by opening the m3u8 file it will jump forward in time by some period of time less than 1 second.

    The following commands are executed:

    First mp4 --> ts:

    ffmpeg -i input_file.mp4 -bsf:v h264_mp4toannexb -acodec libfaac -vcodec libx264 -f mpegts -threads 0 output.ts
    

    Then I split using:

    ffmpeg -i output.ts -vcodec copy -acodec copy -map 0 -f segment -segment_time 30 -segment_list output.m3u8 -segment_list_type m3u8 -segment_format mpegts output%03d.ts 
    

    Note: Changing segment time has no effect on issue.

    Generated manifest:

    #EXTM3U
    #EXT-X-VERSION:4
    #EXTINF:30.947578,
    output000.ts
    #EXTINF:30.155111,
    output001.ts
    ...
    #EXTINF:24.023989,
    output082.ts
    #EXT-X-TARGETDURATION:37
    #EXT-X-ENDLIST
    

    Meta Data:

    $> ffmpeg -version
    ffmpeg version git-2012-08-19-a93c221
    built on Aug 19 2012 13:18:58 with gcc 4.4.5 (Debian 4.4.5-8)
    configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib/ --mandir=/usr/share/man --extra-cflags='-O3 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions \ -fstack-protector --param=ssp-buffer-size=4 -mtune=generic' --enable-gpl --enable-shared --enable-nonfree --enable-version3 --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-pthreads --enable-libxvid --enable-postproc --enable-libgsm --enable-libspeex --enable-avfilter --disable-decoder=libdirac --enable-libfreetype --enable-libschroedinger --disable-decoder=libschroedinger --enable-libopenjpeg --disable-ffplay --disable-ffserver
    libavutil      51. 70.100 / 51. 70.100
    libavcodec     54. 53.100 / 54. 53.100
    libavformat    54. 25.104 / 54. 25.104
    libavdevice    54.  2.100 / 54.  2.100
    libavfilter     3. 11.101 /  3. 11.101
    libswscale      2.  1.101 /  2.  1.101
    libswresample   0. 15.100 /  0. 15.100
    libpostproc    52.  0.100 / 52.  0.100
    

    -

    $> ffprobe input_file.mp4
    
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input_file.mp4':
    Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isom
    creation_time   : 2011-09-08 11:43:25
    Duration: 00:41:31.00, start: 0.000000, bitrate: 1146 kb/s
    Stream #0.0(und): Video: h264 (High), yuv420p, 720x404 [PAR 1:1 DAR 180:101], 1015 kb/s,    23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc
    Metadata:
      creation_time   : 2011-09-08 11:43:25
    Stream #0.1(und): Audio: aac, 48000 Hz, stereo, s16, 124 kb/s
    Metadata:
      creation_time   : 2011-09-08 11:43:25
    

    -

    $> ffprobe output_file.ts
    Input #0, mpegts, from 'output_file.ts':
    Duration: 00:41:30.98, start: 1.400000, bitrate: 807 kb/s
    Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0.0[0x100]: Video: h264 (High), yuv420p, 720x404 [PAR 1:1 DAR 180:101], 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc
    Stream #0.1[0x101](und): Audio: aac, 48000 Hz, stereo, s16, 141 kb/
    

    Is it possible to remove this jump, if so, what encoding parameters or incorrect assumptions have I made? Thanks.

  • FFMPEG FLV to 3GP more than 176x144 size

    25 septembre 2012, par Tom

    Hi all I am converting my.flv to my.gp3 with this command

    ffmpeg -i my.flv -acodec libamr_nb -s 176x144 -ar 8000 -b 120000 -vcodec h263 -ab 10.2k -ac 1 my.3gp
    

    but size of my flv is 320x240 and I am trying change 176x144 to 320x240 but getting 3gp file with 0kb , how can I do that and get my.3gp file with same size like my.flv

    And one more thing , the my.flv is product of converting from my.swf(vide) , if you know some command which will do swf->3gp with same size it would be better . Thanks a lot.

  • How do I correctly convert .avi to .flv with ffmpeg ? [closed]

    25 septembre 2012, par terbooter

    UPDATE Shame on me ) I chacked red5 logs again and found that I placed converted files to wrong place. Now all works fine

    I have two red5 apps.

    1. Recorder. It can record live stream and save it to flv file to disk

      private void startRecord(String uid, String name, IConnection connection) {
          // Get a reference to the current broadcast stream.
          ClientBroadcastStream stream = (ClientBroadcastStream) this.getBroadcastStream(
                  connection.getScope(), name);
          try {
              // Save the stream to disk.
              String path = uid + "/" + name;
              stream.saveAs(path, true);
      
              System.out.println("file..:" + stream.getSaveFilename());
      
          } catch (Exception e) {
              System.out.println("Error while saving stream: " + name + e);
          }
      }
      
      private void stopRecord(String name) {
          IConnection conn = Red5.getConnectionLocal();
          System.out.println("Stop recording show for: {}" + conn.getScope().getContextPath());
      
          ClientBroadcastStream stream = (ClientBroadcastStream) this.getBroadcastStream(conn.getScope(), name);
          // Stop recording.
          if (stream != null) {
              stream.stopRecording();
          }
      }
      
    2. Second red5 app (Chat) streams recorded flv file to flash client

      public static String serverStreamCreate(String path, String streamName) {
      
          IServerStream serverStream = StreamUtils.createServerStream(Red5.getConnectionLocal().getScope(), streamName);
          SimplePlayItem item = SimplePlayItem.build(path);
      
          IPlaylistController controller = new MyPlayListController();
      
          serverStream.setPlaylistController(controller);
          serverStream.setRepeat(false);
          serverStream.addItem(item);
          serverStream.addItem(item);
          serverStream.start();
          return streamName;
      }
      

    If I record stream from flash client to flv file with Recorder and after that stream this flv file back to client with Chat, all works fine.

    Now I want to convert avi file to flv and stream it from red5 app to flash client. I used ffmpeg

    ffmpeg -i 24.avi -ar 22050 -an -f flv -b 500k -s 320x240 -y 24_c.flv
    

    But if I stream 24_c.flv from Chat app flash client have no video. 24_c.flv cant be playd by VLC player and have same code information as flv file created by Recorder red5 app.

    I really dont know where to dig.

  • Working FFMPEG settings for converting to WebM format ? [migrated]

    25 septembre 2012, par Tony

    Can anyone give me working settings for converting video to WebM with ffmpeg?

    I am on Windows 7 with the FFmpeg git-67f5650 64-bit Static (Latest) build from http://ffmpeg.zeranoe.com/builds/

    I've tried several settings found on google, a couple of different input formats and even "all default" settings like ffmpeg -i a.wmv -f webm a.webm and still ffmpeg just gives me a "stopped working" error.

    Thanks in advance!