Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • libavformat / ffmpeg c program "not suitable input format"

    15 novembre 2013, par JonMorehouse

    Hello I'm attempting to encode videos using the C ffmpeg libraries. For some reason, when I attempt to create a format context I get an error with:

    [NULL @ 0x7ff574006600] Requested output format 'mp4' is not a suitable output format

    I know that my ffmpeg is compiled with the x264 flags, as a simple

    ffmpeg -i test.mov test.mp4

    works fine. I'm also linking with all of the generated pch files and everything else from the libav* libraries is working fine. Here's a full working example with the error's I'm recieving:

    #include avformat.h>
    #include avcodec.h>
    #include avutil.h>
    #include swscale.h>
    #include opt.h>
    #include swscale.h>
    #include imgutils.h>
    
    #include 
    
    int main() {
    
        AVFormatContext * output = NULL;
    
        // now lets initialize the actual format element
        if (avformat_alloc_output_context2(&output, NULL, "mp4", "test.mp4") < 0) {
    
            printf("%s", "INVALID");
        }
    
        return 0;
    
    }
    
  • Disconnect Network Xcode app crash

    15 novembre 2013, par Igor Malasevschi

    I am using ffmpeg library for publishing Video and Audio Live Streaming to the rtmp server. I work under MacOS (in Xcode), for capturing I use Qtkit framework.

    As example i consulted the open source app QTFFmpeg : https://github.com/BigHillSoftware/QTFFmpeg

    The main issue is : while i disconnect network cable application crash. For encode and stream i use AVFormatСontext.

    Callback for video is :

     -(void)captureOutput:(QTCaptureOutput*)captureOutput  didOutputVideoFrame:(CVImageBufferRef)videoFrame
    withSampleBuffer:(QTSampleBuffer*)sampleBuffer   fromConnection:(QTCaptureConnection*)connection
    
    
    
    returnval  = av_interleaved_write_frame(avFormatContext, &avPacket);
    if (returnVal != 0)
      { Never Happens   !!!! }
    

    Started debug and application crahs on :0 mach_msg_trap.

    Please help me to solve the issue. IF you are able to download the source and try to debug without network will be very good.

    Thank You, Igor

  • Variable size for ffmpeg filter

    15 novembre 2013, par DrakaSAN

    I am creating a bunch of script to easily use ffmpeg.

    All my scripts now work, but a lot of value are hardcoded, which make them wanting exact size for the video (854x240, size of my tests videos)

    A good example is better than long explanation:

    ffmpeg -i 0.mp4 -vf "
    scale=854/2:-1 [low];
    color=c=black@1.0:s=854x240:r=29.97:d=30.0 [bg];
    movie=1.mp4, scale=854/2:-1 [high];
    [bg][high] overlay=0:0 [bgh];
    [bgh][low] overlay=854/2:-1" leftright.mp4
    

    It take 0.mp4 and 1.mp4 and put them side by side in the same video. But the dimension value are hardcoded. But it work.

    I know I can use iw and ih as "input width" and "input height" for the first scale filter, but when I try to put anything else as dimension for the color background, it just throw me a error:

    Unable to parse option value "iw:ih" as image size
    Unable to parse option value "iw:240" as image size
    Unable to parse option value "860*2:240" as image size
    

    and I end up to put 1720x240 again, which is really bad.

    Is there a way to bypass this, or to put input-dependent value?

    Edit:

    Starting with video 1.mp4 (854x240) and 2.mp4 (520x520) (example value), put them side by side in out.mp4 (which in this case will have the dimension max(height)x(2xmax(width)), so in this case 854x1040), with black background.

      ax
    <---->
    .____.^
    |    ||
    |  1 ||
    |    ||ay
    |    ||
    |____|V
    
        bx
    <-------->
    .________.^
    |   2    ||by
    |________|V
    

    Will end up as

    ay>ax
    bx>by
    
        bx        bx
    <--------><-------->
    xx.____.xxxxxxxxxxxx^
    xx|    |xxxxxxxxxxxx|
    xx|  1 |xx.________.|
    xx|    |xx|    2   ||ay
    xx|    |xx|________||
    xx|____|xxxxxxxxxxxxV
    
  • Error on linking ffmpeg example code in linux

    15 novembre 2013, par user2995111

    I'm trying to work on the ffmpeg example source file. Now, I'm trying to compile and link from the command line but I can't seem to get it to link.

    I compiled the code and generated obj file.

    My problem is on linking ,

    I just tried this:

    gcc -Wall -o example -L/home/jayanthi/example -lavcodec -lavutil example.o 
    

    At this point, I get error of 'undefined reference error'

    example.o: In function `audio_encode_example':
    example.c:(.text+0x25): undefined reference to `avcodec_find_encoder'
    example.c:(.text+0x6a): undefined reference to `avcodec_alloc_context3'
    example.c:(.text+0xad): undefined reference to `avcodec_open'
    example.c:(.text+0x1ce): undefined reference to `sin'
    example.c:(.text+0x238): undefined reference to `avcodec_encode_audio'
    example.c:(.text+0x297): undefined reference to `avcodec_close'
    example.c:(.text+0x2a3): undefined reference to `av_free'
    example.o: In function `audio_decode_example':
    example.c:(.text+0x2f7): undefined reference to `av_init_packet'
    example.c:(.text+0x30b): undefined reference to `avcodec_find_decoder'
    example.c:(.text+0x359): undefined reference to `avcodec_alloc_context3'
    example.c:(.text+0x379): undefined reference to `avcodec_open'
    ..... etc.
    collect2: ld returned 1 exit status
    

    please help me out

  • How to convert a 5MB video to 2MB using ffmpeg [migrated]

    15 novembre 2013, par wilsonrufus

    Is it possible to convert a video of any file size x to a specific file size y ??

    I have a video test.mp4 which is 5mb i would like to set the size to 2mb

    Is it possible to get exact 2mb using ffmpeg