Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Please provide latest version FFmpeg library(.so) file for android

    2 mai 2014, par Carlos

    i have using the following library files:

    {"ffmpeg",
            "libavcodec.so", "libavcodec.so.52", "libavcodec.so.52.99.1",
            "libavcore.so", "libavcore.so.0", "libavcore.so.0.16.0",
            "libavdevice.so", "libavdevice.so.52", "libavdevice.so.52.2.2",
            "libavfilter.so", "libavfilter.so.1", "libavfilter.so.1.69.0",
            "libavformat.so", "libavformat.so.52", "libavformat.so.52.88.0",
            "libavutil.so", "libavutil.so.50", "libavutil.so.50.34.0",
            "libswscale.so", "libswscale.so.0", "libswscale.so.0.12.0"
    };
    

    when i used the following commands

    String[] ffmpegCommand ={"/data/data/com.mobvcasting.mjpegffmpeg/ffmpeg","-i",Environment.getExternalStorageDirectory().getPath() + "/com.mobvcasting.mjpegffmpeg/bg.png",
                        "-r","5","-i",Environment.getExternalStorageDirectory().getPath() + "/com.mobvcasting.mjpegffmpeg/image%d.png","-filter_complex","overlay","-shortest",Environment.getExternalStorageDirectory().getPath() + "/com.mobvcasting.mjpegffmpeg/video.mp4"};
    

    i got Error Like

    10-15 11:22:55.970: E/MJPEG_FFMPEG(2620): ***FFmpeg version UNKNOWN, Copyright (c) 2000-2010 the FFmpeg developers***
    10-15 11:22:55.970: E/MJPEG_FFMPEG(2620): ***  built on Jul 28 2011 16:47:07 with gcc 4.4.3***
    10-15 11:22:55.970: E/MJPEG_FFMPEG(2620): ***  configuration: --target-os=linux --cross-prefix=arm-linux-androideabi- --arch=arm --sysroot=/Developer/android-ndk-r5b//platforms/android-3/arch-arm --soname-prefix=/data/data/com.mobvcasting.mjpegffmpeg/ --enable-shared --disable-symver --enable-small --optimization-flags=-O2 --enable-encoder=mpeg2video --enable-encoder=nellymoser --enable-protocol=file --prefix=../build/ffmpeg/armeabi --extra-cflags= --extra-ldflags=***
    10-15 11:22:55.970: E/MJPEG_FFMPEG(2620): ***  libavutil     50.34. 0 / 50.34. 0***
    10-15 11:22:55.970: E/MJPEG_FFMPEG(2620): ***  libavcore      0.16. 0 /  0.16. 0***
    10-15 11:22:55.970: E/MJPEG_FFMPEG(2620): ***  libavcodec    52.99. 1 / 52.99. 1***
    10-15 11:22:55.970: E/MJPEG_FFMPEG(2620): ***  libavformat   52.88. 0 / 52.88. 0***
    10-15 11:22:55.970: E/MJPEG_FFMPEG(2620): ***  libavdevice   52. 2. 2 / 52. 2. 2***
    10-15 11:22:55.970: E/MJPEG_FFMPEG(2620): ***  libavfilter    1.69. 0 /  1.69. 0***
    10-15 11:22:55.970: E/MJPEG_FFMPEG(2620): ***  libswscale     0.12. 0 /  0.12. 0***
    

    Please can anyone provide latest FFmpeg library file?

  • Need to write to a file using fopen in a C++ class for iOS project

    2 mai 2014, par Chuck Mc Duran

    I have a project that uses C++ classes and FFmpeg, I need to use fopen and write a file to the app sandbox, so the code that I need to write in C++ is the equivalent of:

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *docs_dir = [paths objectAtIndex:0];
    

    This would me to my app sandbox, where I can pretty much manipulate my files The question is how do I go about writing this code in C++ so that I can use fopen on a file?

    This is the method that needs implementation:

    int testGrabAndWrite(const char* streamURL, bool decode, const char* filename)
    {
        FILE *outfile;
        int ret;
        int counter = 0;
        uint8_t *data;              // Pointer to the received audio mem
        int size;                   // Size of the received audio buffer
    
    
        outfile = fopen(filename, "w");
    
        if (outfile == NULL)
            exit(1);
    
        // Open the RTP stream
        if ((ret = openStream(streamURL, decode)) < 0)
            return ret;
    
        // Print out info about the stream found
        int tmpSampleRate, tmpBitRate, tmpChannels;
        ret = getStreamInfo(tmpSampleRate, tmpBitRate, tmpChannels);
        printf("\nSample rate:%d Bit rateL%d Channels:%d\n",tmpSampleRate,tmpBitRate, tmpChannels);
    
        // Grab some sample data and write it to file.
        while (counter < 500) 
        {
            ret = getStreamData(data, size);
            fwrite(data, 1, size, outfile);                             // Write RTP packets, i.e. mp3, to file.
            printf("Wrote packet %d with size %d which returned %d. ", ++counter, size, ret);
        }
    
        fclose(outfile);
        closeStream();
    
        return ret;
    }
    
  • rtmpdump check status by command line

    2 mai 2014, par David

    I tried doing rtmpdump -r "rtmp-raw=rtmpe://watch.playfooty.tv/live playpath=nba1569 swfUrl=http://www.playfooty.tv/play/player/player.swf live=1 pageUrl=http://www.playfooty.tv/" But the output it´s like offline always

    RTMPDump v2.2e
    (c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
    DEBUG: Parsing...
    WARNING: Unknown protocol!
    
    DEBUG: Parsed host : watch.playfooty.tv
    DEBUG: Parsed app : live playpath=nba1569 swfUrl=http:/
    DEBUG: Protocol : RTMP
    DEBUG: Hostname : watch.playfooty.tv
    DEBUG: Port : 1935
    DEBUG: Playpath : www.playfooty.tv/play/player/player.swf live=1 pageUrl=http://www.playfooty.tv/
    DEBUG: tcUrl : rtmp://watch.playfooty.tv:1935/live playpath=nba1569 swfUrl=http:/
    DEBUG: app : live playpath=nba1569 swfUrl=http:/
    DEBUG: live : no
    DEBUG: timeout : 30 sec
    

    I tried a lot of links of a list and seems offline with this command, but When I play it in a software it worked.

    Does anyone have an idea how to test if this kind of links are alive or die?

    Thanks!

  • Parsing xml with perl and libXML

    2 mai 2014, par user3589690

    I have an XML file which I would like to parse and use to create an arguments set for ffmpeg encoding.

    This is what a dump of the xml looks like:

    $VAR1 = {
              'profile' => [
                           {
                             'enodingParam' => {
                                               'videoFrameRate' => {
                                                                   'arg' => '-r',
                                                                   'content' => '25'
                                                                 },
    
                                               'audioCodec' => {
                                                               'arg' => '-acodec',
                                                               'content' => 'libfaac'
                                                             },
                                               'videoCodec' => {
                                                               'arg' => '-vcodec',
                                                               'content' => 'libx264'
                                                             },
                                               'videoSize' => {
                                                              'arg' => '-s',
                                                              'content' => '640x360'
                                                            },
                                               'audioBitrate' => {
                                                                 'arg' => '-ab',
                                                                 'content' => '96k'
                                                               },
    
                                               'videoGOP' => {
                                                             'arg' => '-g',
                                                             'content' => '90'
                                                           },
                                               'audioRate' => {
                                                              'arg' => '-ar',
                                                              'content' => '22050'
                                                            },
                                               'audioChannels' => {
                                                                  'arg' => '-ac',
                                                                  'content' => '2'
                                                                },
                                               'videoPreset' => {
                                                                'arg' => '-vpre',
                                                                'content' => 'slow'
                                                              },
                                               'videoBitrate' => {
                                                                 'arg' => '-b',
                                                                 'content' => '1200k'
                                                               }
                                             },
                             'metadat' => {
                                         'fileContainer' => '.mp4',
                                         'profileName' => 'testpfrof1'
                                       }
                           },
                           {
                             'enodingParam' => {
                                               'videoFrameRate' => {
                                                                   'arg' => '-r',
                                                                   'content' => '25'
                                                                 },
    
                                               'audioCodec' => {
                                                               'arg' => '-acodec',
                                                               'content' => 'libfaac'
                                                             },
                                               'videoCodec' => {
                                                               'arg' => '-vcodec',
                                                               'content' => 'libx264'
                                                             },
                                               'videoSize' => {
                                                              'arg' => '-s',
                                                              'content' => '320x180'
                                                            },
                                               'audioBitrate' => {
                                                                 'arg' => '-ab',
                                                                 'content' => '96k'
                                                               },
    
                                                              },
                                               'videoGOP' => {
                                                             'arg' => '-g',
                                                             'content' => '90'
                                                           },
                                               'audioRate' => {
                                                              'arg' => '-ar',
                                                              'content' => '22050'
                                                            },
                                               'audioChannels' => {
                                                                  'arg' => '-ac',
                                                                  'content' => '2'
                                                                },
                                               'videoPreset' => {
                                                                'arg' => '-vpre',
                                                                'content' => 'slow'
                                                              },
                                               'videoBitrate' => {
                                                                 'arg' => '-b',
                                                                 'content' => '400k'
                                                               }
                                             },
                             'metadat' => {
                                         'fileContainer' => '.mp4',
                                         'profileName' => 'testProfile2'
                                       }
                           }
                         ]
            };
    

    I would like to use a foreach loop for the encodingparam node/tagname and end up with a string which looks something like this:

    -acodec libfaac -vcodec libx264 -s 640x360 -ab 96k 
    

    I am kind of stuck . This is what I have put together so far:

    #!/usr/bin/perl
    
    use warnings;
    use strict;
    use Data::Dumper;
    use XML::LibXML;
    my $filename = "xml/profile.xml";
    my $parser = XML::LibXML->new;
    my $doc    = $parser->parse_file($filename)
                    or die "can't parse profile file: $@";
    my $root = $doc->documentElement();
    my @nodeList = $doc->getElementsByTagName('enodingParam');
    

    here is the xml file

    <?xml version="1.0"?>
    
            
                            
                                    testp1
                                    .mp4
                            
                            
                                    libx264
                                    slow
                                    1200k
                                    640
                                    360
                                    640x360
                                    25
                                    90
                                    ab 96k
                                    -acodec libfaac
                                    2
                                    "22050"
                            
            
            
                            
                                    testProfile22
                                    .mp4
                            
                            
                                    libx264
                                    slow
                                    1200k
                                    640
                                    360
                                    640x360
                                    25
                                    90
                                    96k
                                    libfaac
                                    2
                                    22050
                            
            
    
    
    

    Modified the pl script to

    use warnings;
    use strict;
    use Data::Dumper;
    use XML::LibXML;
    my $filename = "xml/book.xml";
    my $parser = XML::LibXML->new;
    my @ffmpegargs;
    my $fileName="filename";
    my $doc    = $parser->parse_file($filename)
                    or die "can't parse profile file: $@";
    my $root = $doc->documentElement();
    my @paramList = $doc->getElementsByTagName('enodingParam');
    
    for my $ele (@paramList)
    {
        # You then need to iterate over all the children of that node...
    
        for my $param ($ele->nonBlankChildNodes())
        {
    
            my $inparams = " " . $param->getAttribute('arg') . " " . $param->textContent ;
            push ( @ffmpegargs, $inparams);
    
        }
        my $ffmpeg = join(" ", @ffmpegargs);
        print "ffmpeg" . $ffmpeg, "\n";
    }
    

    It is printing out correctly. Now how do i add the following to the string $filename , profileName, containerName (from the metadat node) to the same string so that my final output looks like:

    ffmpeg -vcodec libx264  -vpre slow  -b 1200k  -w 640  -h 360  -s 640x360 filename_profileName_containerName 
    

    ok tried zooming ue to profile. Not sure how to traverse the child nodes. Tried this. But its nor printing the right values

    use warnings;
    use strict;
    use Data::Dumper;
    use XML::LibXML;
    my $filename = "xml/book.xml";
    my $parser = XML::LibXML->new;
    my @ffmpegargs;
    my $fileName="filename";
    my $doc    = $parser->parse_file($filename)
                    or die "can't parse profile file: $@";
    my $root = $doc->documentElement();
    my @paramList = $doc->getElementsByTagName('profile');
    
    for my $ele (@paramList)
    {
        # You then need to iterate over all the children of that node...
    
        for my $param ($ele->findnodes('/encodingParam/*'))
        {
    
            my $inparams = " " . $param->getAttribute('arg') . " " . $param->textContent ;
            push ( @ffmpegargs, $inparams);
    
        }
        my $ffmpeg = join(" ", @ffmpegargs);
        print "ffmpeg" . $ffmpeg, "\n";
    }
    
  • Is possible play rtmpdump on web player ? [on hold]

    2 mai 2014, par David

    I would know wich is the best way for play rtmpdump links on a web player. I made some researchs and I don´t find clear info about it.

    Thanks

    David