Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Using FFMPEG library in PPAPI : Naclports with FFmpeg

    30 avril 2017, par rasulzhan

    I have configured Webports, ffmpeg; and I have created the following Makefile for the current project. However, I have met some problem with ffmpeg library linking.

    $ TOOLCHAIN=pnacl make
      LINK pnacl/Release/client_unstripped.bc
    pnacl/Release/src/client.o: error: undefined reference to 'av_register_all'
    make: *** [pnacl/Release/client_unstripped.bc] Error 1
    

    Can you tell me what I am doing wrong here, my Makefile is shown below:

    VALID_TOOLCHAINS := pnacl glibc clang-newlib win

    NACL_SDK_ROOT ?= $(abspath $(CURDIR)/../..)

    TARGET = client

    OTHERDIR=src

    INC_DIR = inc

    FFMPEG_INC_DIR = ../../toolchain/mac_pnacl/le32-nacl/usr/include

    INCLUDES = -I$(INC_DIR) -I$(FFMPEG_INC_DIR)

    include $(NACL_SDK_ROOT)/tools/common.mk

    CHROME_ARGS += --allow-nacl-socket-api=localhost

    LIBS = nacl_io ppapi_cpp ppapi

    CFLAGS = -Wall -g -O2 $(INCLUDES) -L../../toolchain/mac_pnacl/le32-nacl/usr/lib -lavformat \ -lvpx -lvorbisenc -lvorbis -logg -ltheoraenc -ltheoradec -logg -lmp3lame -lm -pthread -lavcodec -lvpx -lvorbisenc -lvorbis -logg \ -ltheoraenc -ltheoradec -logg -lmp3lame -lm -pthread -lswresample -lm -lavutil -lm -lavdevice -lavfilter

    SOURCES = $(OTHERDIR)/tcp_util.cc $(OTHERDIR)/tpool.cc $(OTHERDIR)/net.cc $(OTHERDIR)/rtsp_response.cc \ $(OTHERDIR)/rtsp.cc $(OTHERDIR)/rtsp_common.cc \ $(OTHERDIR)/rtsp_client.cc $(OTHERDIR)/udp_util.cc \ $(OTHERDIR)/client.cc

    # Build rules generated by macros from common.mk:

    $(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),$(CFLAGS))))

    # The PNaCl workflow uses both an unstripped and finalized/stripped binary. # On NaCl, only produce a stripped binary for Release configs (not Debug). ifneq (,$(or $(findstring pnacl,$(TOOLCHAIN)),$(findstring Release,$(CONFIG)))) $(eval $(call LINK_RULE,$(TARGET)_unstripped,$(SOURCES),$(LIBS),$(DEPS))) $(eval $(call STRIP_RULE,$(TARGET),$(TARGET)_unstripped)) else $(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) endif

    $(eval $(call NMF_RULE,$(TARGET),))

    And here is the way, how the library has been used in the class context.

    class VideoDecodePack {
    public:
        VideoDecodePack() {
            av_register_all();
        }
    };
    
    class ClientInstance : public pp::Instance {
     public:
      explicit ClientInstance(PP_Instance instance) : pp::Instance(instance){
        cses = InitRtspClientSession();
        _videoDecoder = new VideoDecodePack();
      }
    ...
    
  • ffmpeg join multiple audio with acrossfade filter

    30 avril 2017, par alditis

    I have audio file multiple:

    001.ogg, 002.ogg, ..., 100.ogg
    

    I need join the files with overfade filter between they.

    I did it two in two a cumulative way:

    ffmpeg -i 001.ogg -i 002.ogg -filter_complex acrossfade=d=3:o=1:c1=tri:c2=tri -b:a 128k -o r01.ogg
    ffmpeg -i r01.ogg -i 003.ogg -filter_complex acrossfade=d=3:o=1:c1=tri:c2=tri -b:a 128k -o r02.ogg
    ffmpeg -i r02.ogg -i 004.ogg -filter_complex acrossfade=d=3:o=1:c1=tri:c2=tri -b:a 128k -o r02.ogg
    
    ....
    ffmpeg -i r98.ogg -i 100.ogg -filter_complex acrossfade=d=3:o=1:c1=tri:c2=tri -b:a 128k -o final.ogg
    

    But final.ogg does not have good sound on the firsts songs (less quality while more cumulative).

    How can I avoid less quality in the final.ogg?

    Other way is concat but: How do you define the filter acrossfade using concat?

    ffmpeg -i "concat:1.ogg|2.ogg|...|100.ogg" copy final.ogg
    
  • How to increase de volume of an interval of an mp3 file with ffmpeg ?

    30 avril 2017, par user2128078

    I'd like to increase de volume of an interval of and mp3 file, i.e. from 20s to 30s increase in 15%. I'm using ffmpeg.

    Thank you so much for your help!

    Regards,

    Raul.

  • Download ONLY audio from a youtube video

    30 avril 2017, par Feras

    I know that there are a million ways to download a video from youtube and then convert it to audio or do further processing on it. But recently I was surprised to see an app called YoutubeToMp3 on mac actually showing "Skipping X mb of video" and supposedly only downloading the audio from the video, without the need to use bandwith to download the entire video and then convert it. I was wondering if this is actually correct and possible at all because I cant find any way to do that. Do you have any ideas ?

    EDIT: After some tests here is some additional information on the topic. The video which I tried to get the audio from is just a sample mp4 file from the internet:

    http://download.wavetlan.com/SVV/Media/HTTP/MP4/ConvertedFiles/MediaCoder/MediaCoder_test6_1m9s_XVID_VBR_306kbps_320x240_25fps_MPEG1Layer3_CBR_320kbps_Stereo_44100Hz.mp4

    I tried

    ffmpeg -i "input" out.mp3

    ffmpeg -i "input" -vn out.mp3

    ffmpeg -i “input” -vn -ac 2 -ar 44100 -ab 320k -f mp3 output.mp3

    ffmpeg -i “input” -vn -acodec copy output.mp3

    Unfortunately non of these commands seems to be using less bandwith. They all download the entire video. Now that you have the video can you confirm if there is actually a command that downloads only the audio stream from it and lowers the bandwith usage? Thanks!

  • Failed to capture a avi file using opencv

    30 avril 2017, par Wei

    I am quite new to c++ compilation. I am trying to work on a simple problem using opencv where I read a video file and display it.

    My code looks like:

    #include cv.h>
    #include highgui.h>
    #include "opencv2/opencv.hpp"
    #include core/core.hpp>
    #include highgui/highgui.hpp>
    
    
    #include 
    #include 
    
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    
    
    using namespace cv;
    
    IplImage* image = 0; 
    IplImage* prev_image = 0;
    
    int show = 1; 
    
    int main( int argc, char** argv )
    {
        int frameNum = 0;
    
        char* video = argv[1];
        VideoCapture capture(video);
    
        if( !capture.isOpened() ) { 
            printf( "Could not initialize capturing..\n" );
            return -1;
        }
    
        if( show == 1 )
            cvNamedWindow( "Video", 0 );
    
        while( true ) {
            IplImage* frame = 0;
            int i, j, c;
    
            // get a new frame
            //frame = cvQueryFrame( capture );
            Mat mat_img;
            capture >> mat_img;
            IplImage frame1 = mat_img.operator IplImage();
            frame = &frame1;
            if( !frame )
                break;
    
            if( !image ) {
                image =  cvCreateImage( cvSize(frame->width,frame->height), 8, 3 );
                image->origin = frame->origin;
            }
    
            cvCopy( frame, image, 0 );
    
            if( show == 1 ) {
                cvShowImage( "Video", image);
                c = cvWaitKey(3);
                if((char)c == 27) break;
            }
    
            std::cerr << "The " << frameNum << "-th frame" << std::endl;
            frameNum++;
        }
    
        if( show == 1 )
            cvDestroyWindow("Video");
    
        return 0;
    }
    

    Then I compile it like:

    g++ test.cpp -o Video -pipe -D __STDC_CONSTANT_MACROS -D STD=std -Wall -I. -I/usr/local/ -O3 -DNDEBUG -ggdb -L/usr/local/ -lopencv_core -lopencv_highgui -lopencv_video -lopencv_imgproc -lavformat -lavdevice -lavutil -lavcodec -lswscale
    

    Compilation works fine and no errors returned.

    However, when I was running it, I got:

    (Video:5651): GLib-GObject-CRITICAL **: g_object_set: assertion 'G_IS_OBJECT (object)' failed
    Could not initialize capturing..
    

    Some other information: 1. I test my opencv and ffmpeg by running simple examples, which work well. 2. I can stream frames from my camera and display it using opencv.

    Anyone has idea of what causes this?

    Any idea is appreciated.