Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • FFMPEG- Is it possible to overlay multiple images over a video at specified intervals ?

    22 mars 2017, par hack

    I want to overlay multiple images (Say 5) in a 120 second video at specified intervals , like, between 3-7 seconds overlay image 1. Is is it possible without splitting the video in multiple parts?

  • How to record live streamed video from rtsp url in android

    22 mars 2017, par Astro

    I am doing an android application. In my application I need to record live streamed video.And here I am using rtsp protocol and ffmpeg library to stream and record video.Live streaming is working properly, but video recording is not working. I think it's a problem of URL Connection I am used here to record video.But I don't know what is the correct connection method.I search lot about this, but can't find anything. If anybody know this please help me.

    This is my startRecording() method

    private void startRecording() {
    
        try {
    
            URL url = new URL(path);
            URLConnection urlConnection1 = url.openConnection();
            in1 = new BufferedInputStream(urlConnection1.getInputStream());
    
        } catch (IOException e) {
            e.printStackTrace();
        } 
    
        try {
    
            mIn = new MjpegInputStream(in1,MIN_ARRAY_LENGTH);
            mIn.resetFrameCount();
          //  return new MjpegInputStream(in, MIN_ARRAY_LENGTH);
            recorder.start();
            calltimer();
    
            audioStatus = Micstatus.equals("1");
            startTime = 0;
            completedFrames = 0;
            audioCompleted = 0;
    
            isRecording = true;
            if (isJelliBean) {
                resetTextureLayout();
            }
            trial.setCanZoom(isRecording);
            setMenuEnabled();
    
            threadVideo = new VideoRecording();
            threadVideo.start();
    
            if (audioStatus) {
                threadAudio = new AudioRecordRunnables();
                threadAudio.start();
            }
    
    
        } catch (Exception e) {
            try {
    
                isRecording = false;
                trial.setCanZoom(isRecording);
                setMenuEnabled();
    
                Toast.makeText(getApplicationContext(), "Try again1", Toast.LENGTH_SHORT).show();
            } catch (Exception e1) {
            }
        }
    
    }
    

    This is my ViedoRecording class

    private class VideoRecording extends Thread implements Runnable {
    
        public void run() {
            try {
    
    
                int i = -1;
                int cc = 0;
                int completed = 0;
    
                FileOutputStream out;
                RecordingHelper recordingHelper;
                try {
                    Thread.sleep(VIDEO_FRAME_RATE < 6 ? 2000 : 300);
                } catch (Exception e) {
    
                }
                String file = getCacheDir() + "/temp.jpg";
                opencv_core.IplImage iplImage;
                runOnUiThread(videoTimeRunnable);
    
                while (isRecording || completed < mIn.totalFrames || true)             {
                    try {
                        if (cc < 10) {
                            cc++;
                        }
    
                        if (i > (MIN_ARRAY_LENGTH - 2)) {
                            i = -1;
                        }
                        recordingHelper = mIn.datas[i + 1];
    
    
                        if (recordingHelper != null && recordingHelper.length > 1) {
                            i++;
                            completed++;
                            if (startTime == 0) {
                                startTime = System.currentTimeMillis();
                            }
    
                            completedFrames++;
    
    
                            out = new FileOutputStream(file);
                            out.write(recordingHelper.data);
                            out.flush();
    
                            out.close();
    
                            Log.e("recording", "=" + recordingHelper.rotaion);
                            iplImage = cvLoadImage(file, 1);
    
                            OpenCVFrameConverter.ToIplImage grabberConverter = new OpenCVFrameConverter.ToIplImage();
                            Frame frame = grabberConverter.convert(iplImage);
                            recorder.record(frame);
                            opencv_core.cvReleaseImage(iplImage);
                            mIn.datas[i] = null;
                            totalFramesRecordedByActivity++;
                            runOnUiThread(videoTimeRunnable);
    
                        } else if (!isRecording && startTime > 0) {
                            break;
                        } else if (cc > 5 && mIn.totalFrames < 1) {
                            break;
                        }
    
                    } catch (Exception e) {
    
                    }
    
                }
    
                new File(file).delete();
                endTime = System.currentTimeMillis();
                videoThreadFinished = true;
    
                finalizeRecording();
    
    
            } catch (Throwable t) {
                finishThis();
    
            }
    
        }
    }
    
  • ffmpeg output does not contain any stream when concatenating mp4

    22 mars 2017, par Fahmida Joyti

    I am trying to concatenate mp4 files using ffmpeg and I used the following command to create

    sudo ffmpeg -i slide-1.mp4 -c copy  -f mpegts intermediate1.ts 
    

    and so on for multiple files it works fine but when I execute

    sudo ffmpeg -i "concat:intermediate1.ts|intermediate2.ts" -c copy -bsf:a aac_adtstoasc output2.mp4 
    

    I get the following message:

    Could not find codec parameters for stream 0 (Video: mpeg4 ([16][0][0][0] / 0x0010), yuv420p): unspecified size Consider increasing the value for the 'analyzeduration' and 'probesize' options

    and I get Output file #0 does not contain any stream error message I am not sure what I am doing wrong since I did specify the input in my command

  • Install ffmpeg on Centos6 x64 using FFmpegInstaller 8.0 Issue [on hold]

    21 mars 2017, par woshka

    I have the following issue while installing ffmpeginstaller8.0 on centos 6 x64 on the mplayer installtion it fails as followes on cpu.c what is the issue and how to solve it?

    Thanks

    EDIT: I have found the best solution to install ffmpeg and all of it's libraries with this link enter link description here

    YASM    libavcodec/x86/vp9lpf_16bpp.o
    YASM    libavcodec/x86/vp9itxfm_16bpp.o
    YASM    libavcodec/x86/vp9lpf.o
    YASM    libavcodec/x86/hevc_mc.o
    YASM    libavcodec/x86/vp9itxfm.o
    AR      libavcodec/libavcodec.a
    make[1]: Leaving directory `/usr/src/ffmpegscript/mplayer/ffmpeg'
    make -C ffmpeg libavutil/libavutil.a
    make[1]: Entering directory `/usr/src/ffmpegscript/mplayer/ffmpeg'
    CC      libavutil/cpu.o
    libavutil/cpu.c:20:23: warning: stdatomic.h: No such file or directory
    libavutil/cpu.c:28:5: warning: "HAVE_SCHED_GETAFFINITY" is not defined
    libavutil/cpu.c:34:5: warning: "HAVE_GETPROCESSAFFINITYMASK" is not defined
    libavutil/cpu.c:34:36: warning: "HAVE_WINRT" is not defined
    libavutil/cpu.c:37:5: warning: "HAVE_SYSCTL" is not defined
    libavutil/cpu.c:48: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'cpu_flags'
    libavutil/cpu.c: In function 'av_force_cpu_flags':
    libavutil/cpu.c:86: error: implicit declaration of function 'atomic_store_explicit'
    libavutil/cpu.c:86: error: 'cpu_flags' undeclared (first use in this function)
    libavutil/cpu.c:86: error: (Each undeclared identifier is reported only once
    libavutil/cpu.c:86: error: for each function it appears in.)
    libavutil/cpu.c:86: error: 'memory_order_relaxed' undeclared (first use in this function)
    libavutil/cpu.c: In function 'av_get_cpu_flags':
    libavutil/cpu.c:91: error: implicit declaration of function 'atomic_load_explicit'
    libavutil/cpu.c:91: error: 'cpu_flags' undeclared (first use in this function)
    libavutil/cpu.c:91: error: 'memory_order_relaxed' undeclared (first use in this function)
    libavutil/cpu.c: In function 'av_set_cpu_flags_mask':
    libavutil/cpu.c:101: error: 'cpu_flags' undeclared (first use in this function)
    libavutil/cpu.c:102: error: 'memory_order_relaxed' undeclared (first use in this function)
    libavutil/cpu.c:265:5: warning: "HAVE_WINRT" is not defined
    libavutil/cpu.c:268:5: warning: "HAVE_SCHED_GETAFFINITY" is not defined
    libavutil/cpu.c:275:7: warning: "HAVE_GETPROCESSAFFINITYMASK" is not defined
    libavutil/cpu.c:279:7: warning: "HAVE_SYSCTL" is not defined
    libavutil/cpu.c:285:7: warning: "HAVE_SYSCONF" is not defined
    libavutil/cpu.c:287:7: warning: "HAVE_SYSCONF" is not defined
    libavutil/cpu.c:289:7: warning: "HAVE_WINRT" is not defined
    make[1]: *** [libavutil/cpu.o] Error 1
    make[1]: Leaving directory `/usr/src/ffmpegscript/mplayer/ffmpeg'
    make: *** [ffmpeg/libavutil/libavutil.a] Error 2
    cp: cannot create regular file `/usr/local/cpffmpeg/etc/mplayer/codecs.conf': No such file or directory
    Installation of mplayer.tar.gz ....... Completed
    
    
       Mplayer installation Failed :( ,  please contact  professional support sales@syslint.com
    
  • Python + ffmpeg TypeError : not all arguments converted during string formatting

    21 mars 2017, par Sonic Motion

    I'm sending a file to a function in python, and trying to save the results to a variable, but I keep getting that error.

    I've looked over the other answers but nothing seems to fit. Any help is appreciated:

    def ffmpegLUFS(fileName):
        subprocess.Popen("ffmpeg -i %s -filter_complex ebur128 -f null - 2>&1 | grep -n '.*' | grep -A 5 'size' | grep 'I:' | cut -d ':' -f3-" % tuple(map(pipes.quote, sys.argv[1])),stdout=subprocess.PIPE,shell=True).communicate()[0]
        return
    
    Traceback (most recent call last):
      File "/Volumes/videos/videos/DROP_BIN/CHRIS/POD_Workflow_Files/WebContent_Audio.py", line 30, in 
        sourceLUFS = ffmpegLUFS(sys.argv[1])
      File "/Volumes/videos/videos/DROP_BIN/CHRIS/POD_Workflow_Files/WebContent_Audio.py", line 18, in ffmpegLUFS
        subprocess.Popen("ffmpeg -i %s -filter_complex ebur128 -f null - 2>&1 | grep -n '.*' | grep -A 5 'size' | grep 'I:' | cut -d ':' -f3-" % tuple(map(pipes.quote, fileName)),stdout=subprocess.PIPE,shell=True).communicate()[0]
    TypeError: not all arguments converted during string formatting