Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • How can I mux a video and audio from separate sources that go out of sync over time ?

    25 août 2017, par Rapta

    I'm having trouble muxing the video from one source with the audio from another as the audio drifts over time. Said sources are at different framerates, the video's at 23.976, and the audio's at 29.97.

    My code so far:

    ffmpeg -y -i source1.mkv -itsoffset 0.85 -i source2.mp4 -map 0:0 -map 1:1 -c:v libx264 -crf 23 -c:a aac -b:a 112k output.mp4
    

    I'm using nightly build 20170724-03a9e6f.

    Cheers for any help.

  • playing, decoding, seeking, audio from command line

    25 août 2017, par AbstractDissonance

    There are various way to use audio, I would like to find several different audio players that can do the following easily, from the command line:

    1. Carry out the standard audio function: Play, pause, stop, seek(absolute), volume(absolute), mute.

    2. Be able to decode and get the raw data of the audio input so one can display a waveform.

    -- Correct answers will provide the player, the command line to do the functions and/or how one can interact with it programmatically if necessary.

    e.g.,

    Program: FFmpeg decode: pipe out using -i -f s16le -ac 1 - play: ffplay -nodisp then send keys to wmproc(keys don't work without window open and -nodisp closes window, so much wm the keys) stop, pause, etc are the same. Does not have a way to absolutely seek or set volume.

    Other programs might be vlc, etc.

    The reason I am asking this is because I would like to provide several options for my program to use what the user might already have without having to require shipping or downloading dlls(i.e., hard dependencies).

    Bonus points for being able to control pitch and speed.

  • ffmpeg throws error while converting wav to flac

    24 août 2017, par user3815252

    I am working on a research project and it requires me to first record audios from browser (using getuserMedia) and save them in a wav format. My code looks like this:

    navigator.mediaDevices.getUserMedia({ audio: true }).then(stream => {
            const chunks = [];
            const recorder = new MediaRecorder(stream);
            recorder.ondataavailable = e => {
                chunks.push(e.data);
                if (recorder.state == 'inactive') {
                    $scope.blob = new Blob(chunks, { type: 'audio/wav' });
                    $scope.file = new File([$scope.blob], "myFile.wav", {type: 'audio/wav', lastModified: Date.now()});
    
                    $scope.blobUrl = URL.createObjectURL($scope.blob);
                    createAudioElement($scope.blobUrl);
                }
            };
            recorder.start(1000);
            $scope.stop = function() {
                recorder.stop();    
            };
    
        }).catch(console.error);
    

    After saving $scope.file on filesystem, I convert it to flac format using ffmpeg utility ([https://www.ffmpeg.org/).

    Now my problem is the ffmpeg tool sometimes gives me error saying that this file cannot be recognized as wav file. The exact output of ffmpeg tool is:

      ffmpeg-user: Wav to Flac conversion: Invalid data found when processing input
    
      ffmpeg version 3.3.3 Copyright (c) 2000-2017 the FFmpeg developers 
      built with Apple LLVM version 7.0.2 (clang-700.1.81) 
      configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.3 --enable-shared 
      --enable-pthreads --enable-gpl --enable-version3 
      --enable-hardcoded-tables 
      --enable-avresample --cc=clang --host-cflags= --host-ldflags= 
      --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl 
    
      --disable-lzma --enable-vda 
      libavutil      55. 58.100 / 55. 58.100 
      libavcodec     57. 89.100 / 57. 89.100 
      libavformat    57. 71.100 / 57. 71.100 
      libavdevice    57.  6.100 / 57.  6.100 
      libavfilter     6. 82.100 /  6. 82.100 
      libavresample   3.  5.  0 /  3.  5.  0 
      libswscale      4.  6.100 /  4.  6.100 
      libswresample   2.  7.100 /  2.  7.100 
      libpostproc    54.  5.100 / 54.  5.100 
    

    Does anyone know why am I getting this error?

  • How to use ffmpeg for youtube stream ads for 2017 [on hold]

    24 août 2017, par Trần Quang Họa

    Can anybody share me the code using the url of a video above any wed as input for ffmpeg so the stream output is not.

  • Django FileResponse not working with uwsgi

    24 août 2017, par Sandeep

    I have the following code which takes in an arbitrary audio stream and converts it to mp3 on the fly using ffmpeg. The code works fine when run using python manage.py runserver but is not working when run using uwsgi server.

    from django.http import FileResponse
    
    def mp3(request):
        audiourl = request.session['audiourl']
        title = request.session['title']
        process = Popen('ffmpeg -i "{}" -f mp3 -'.format(audiourl), shell=True, stdout=PIPE)
        response = FileResponse(process.stdout)
        fname = title + '.mp3'
        response['Content-Disposition'] = content_disposition(fname)
        return response
    

    It might work with gunicorn but I prefer to use uwsgi if possible. Kindly post your valuable suggestions.