Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Link to ffmpeg libraries using mingw c++ -> undefined reference [duplicate]

    16 juillet 2016, par Gerhard

    This question already has an answer here:

    I read about a lot of very similar problems here, but none of them seems to solve my problem. I feel that I need only a very small step to succeed...

    I have an existing c++ project and try to include some FFmpeg functions. When linking with MinGW on Windows OS against the FFmpeg libraries, I get always the error message "undefined reference to...".

    I reduced my code totally to the following sample:

    // START of file simple.cpp
    #ifndef INT64_C
    #define INT64_C(c) (c ## LL)
    #define UINT64_C(c) (c ## ULL)
    #endif
    
    #include 
    
    #include opt.h>
    #include avcodec.h>
    #include channel_layout.h>
    #include common.h>
    #include imgutils.h>
    #include mathematics.h>
    #include samplefmt.h>
    
    int main(int argc, char **argv){
        avcodec_register_all();
        return 0;
    }
    // END of file simple.cpp
    

    I compile with:

    g++ -o simple.o -c simple.cpp -std=gnu++11
    

    which worked well. My link command is:

    g++ -o simple.exe simple.o -lavcodec -std=gnu++11
    

    and I get the error message:

    simple.o:simple.cpp:(.text+0xc): undefined reference to avcodec_register_all()

    So, at least the libraries are found ;-) I used the libraries directly from Zeranoe and I also managed to compile new ones from source. The error message is the same in both cases.

    A step to find the solution might be the following test (compile with gcc instead of g++):

    1. I rename simple.cpp to simple.c

    2. I compile with:

      gcc -o simple.o -c simple.c

    3. I link with:

      g++ -o simple.o -c simple.c -lavcodec

    And that will work!!!

    But, unfortunately, that is no solution for me, because my main program is definitely c++ und must be compiled using g++.

    So, what the hell is wrong here?
    Is that a FFmpeg topic or is that a gcc/g++ topic?
    Please, all hints are welcome.

    I already tried out all possible 'extern' and extern "C"- statements, no success.

  • Blu-Ray does not play any ffmpeg converted action video

    15 juillet 2016, par Gert de Vries

    Video from an AAE S60 action camera is in .mp4 files, according to VLC with codec: H264-MPEG-4 AVC(part10)(avc1), resolution 1920x1080, frame rate 50. The Sony Blu-Ray BDP-S4100 should play MPEG4/AVC, but it cannot handle this video. I have tried everyting using ffmpeg: reduce resolution, frame rate, recode to H264 and combinations, nothing seems to help. Does anybody have an idea why not?

  • FFmpeg iOS -> output file is invalid

    15 juillet 2016, par Vive

    I'm using following library to convert mkv to mp4: https://github.com/SterlingOnLoop/FFmpegWrapper.

    - (void)convertUsingFFmpegWrapper {
        NSString *mp4Extension = @"mp4";
        NSString *mkvExtension = @"mkv";
    
        NSString *videoName = @"file1";
    //    NSString *videoName = @"file2";
    
        NSString *mkvVideoFilePath = [[NSBundle mainBundle] pathForResource:videoName ofType:mkvExtension];
        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
        NSString *documentsDirectory = paths[0];
        NSString *mp4VideoFilePath = [NSString stringWithFormat:@"%@/%@.%@", documentsDirectory, videoName, mp4Extension];
    
        FFmpegWrapper *ffmpegWrapper = [[FFmpegWrapper alloc] init];
        NSDictionary *options = @{kFFmpegInputFormatKey: mkvExtension, kFFmpegOutputFormatKey: mp4Extension};
        [ffmpegWrapper convertInputPath:mkvVideoFilePath outputPath:mp4VideoFilePath options:options progressBlock:nil completionBlock:^(BOOL success, NSError *error) {
            if (success && !error) {
                // delete mp4 file
            } else if (error) {
                NSLog(@"Error during .MKV -> .MP4 conversion occured: %@", error.localizedDescription);
            } else {
                NSLog(@"Unknown error during .MKV -> .MP4 conversion occured.");
            }
        }];
    }
    

    Here are the values from LLDB about the automatically detected codec types:

    (lldb) po inputStream.codecName
    aac
    
    (lldb) po outputStream.codecName
    aac
    

    I should mention here, that originally the file is generated on Linux with following codecs: vaapiencode_h264 for video and faac for sound.

    The issue is that the file simply does not work. I get huge amount of logs in the console, where most important is:

    [aac @ 0x7f7f65019200] Format aac detected only with low score of 1, misdetection possible!
    

    Inside the library, the following function is used:

    int streamInfoValue = avformat_find_stream_info(inputFormatContext, NULL);
    

    And exactly this line does the whole mess with the logs. Obviously, without this line I receive an error with invalid argument.

    When that line is turned on, the .mp4 file is generated. It lasts > 5 minutes, while input file is 11 seconds long. It cannot be played using VLC on my mac (seems to be broken). I get following errors (I'm pasting few of them, full track can be found here, it's too long to quote it here):

    [aac @ 0x7ff07c00b000] More than one AAC RDB per ADTS frame is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
    [aac @ 0x7ff07c00b000] channel element 0.0 is not allocated
    [aac @ 0x7ff07c00b000] Sample rate index in program config element does not match the sample rate index configured by the container.
    [aac @ 0x7ff07c00b000] Inconsistent channel configuration.
    [aac @ 0x7ff07c00b000] get_buffer() failed
    [aac @ 0x7ff07c00b000] channel element 3.10 is not allocated
    [aac @ 0x7ff07c00b000] Reserved bit set.
    [aac @ 0x7ff07c00b000] invalid band type
    [aac @ 0x7ff07c00b000] Number of scalefactor bands in group (50) exceeds limit (41).
    [aac @ 0x7ff07c00b000] Reserved bit set.
    [aac @ 0x7ff07c00b000] Number of bands (7) exceeds limit (4).
    [aac @ 0x7ff07c00b000] Reserved bit set.
    [aac @ 0x7ff07c00b000] Dependent coupling is not supported together with LTP
    

    Any idea how to simply convert mkv to mp4? I don't have any idea why the errors occurs. I'd claim that the file is not aac, but the linux uses this encoding, so it should be valid.

  • How to join two images into one with FFmpeg ?

    15 juillet 2016, par n2v2rda2

    There are two images: a.jpg and b.jpg.

    I just want to know how to join them into one image using ffmpeg.

    How should I finish the ffmpeg -i a.jpg -i b.jpg command to get a c.jpg output image?

    This is an example of what I am trying to achieve:

    1. a.jpg

      a.jpg

    2. b.jpg

      b.jpg

    3. c.jpg

      a.jpg and b.jpg side-by-side on one image

  • ffmpeg : Putting Short video and long audio together

    15 juillet 2016, par Timo Dörsching

    i'm using macos.

    i've got a serval videos without audio (mp4 oder mov) with 0:30-1:00min and serval longer audiofiles (3:00-10:00)

    is there a command line solution to slowdown (slo-mo) the video so that it has the same length than the audio file and putting both together.

    example: video1.mov (0:30min) & audio1.mp3 (3:00min) = newvideo.avi/.mp4 (3:00min)

    i've tested the slowdown option of ffmpeg but there is no option to put in the length you can just give a percent like 2.5 times slower video.... And every audio and every video has different length, so i've to calc every percent?

    thanks a lot for your hints