Newest 'ffmpeg' Questions - Stack Overflow

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

Articles published on the website

  • FFmpeg macos install Reason: image not found

    26 April, by Joycon

    I'm trying to install FFmpeg on my mac.
    When I do

    brew install ffmpeg --with-chromaprint --with-fdk-aac
    --with-fontconfig --with-freetype --with-frei0r --with-game-music-emu --with-libass --with-libbluray --with-libbs2b --with-libcaca --with-libgsm --with-libmodplug --with-librsvg --with-libsoxr --with-libssh --with-libvidstab --with-libvorbis --with-libvpx --with-opencore-amr --with-openh264 --with-openjpeg --with-openssl --with-opus --with-rtmpdump --with-rubberband --with-sdl2 --with-snappy --with-speex --with-tesseract --with-theora --with-tools --with-two-lame --with-wavpack --with-webp --with-x265 --with-xz --with-zeromq --with-zimg
    

    This happens when I try to use FFmpeg

    dyld: Library not loaded: /usr/local/opt/rubberband/lib/librubberband.2.dylib  
    Referenced from: /usr/local/bin/ffmpeg  
    Reason: image not found  
    Abort trap: 6
    
  • Single FFMpeg command to merge 2 audio with 1 video

    26 April, by YadavK

    I have a requirement like i have to merge 2 audio with single video. I found lots of solutions but none of them provide just the single command for the requirement.

    Here is the solution for that :

    -i sample_video.mp4 -i sample_audio1.mp3 -i sample_audio2.mp3 -filter_complex [1][2]amix=inputs=2[a] -map 0:v -map [a] -c:v copy Output.mp4

    you can also set the audio range like 8sec - 20 sec then use the below command

    -i sample_video.mp4 -i sample_audio1.mp3 -i -ss 8 -t 20 sample_audio2.mp3 -filter_complex [1][2]amix=inputs=2[a] -map 0:v -map [a] -c:v copy Output.mp4

    the above sample will merge second audio from 8 sec to 20 sec only as we specify the range -ss 8 -t 20

  • Video capture using c++ Builder 10.3 and FFMPEG

    26 April, by Barry Andrews

    I am looking for an example of how I can use FFMPEG in c++ builder to create an application to record from usb capture device and playback video.

    I have tried Mitov components and winsoft camera which use directshow but their capture performance is poor.

    I need to capture 1920x1080 at up to 60fps into a compressed format and play this back later at both normal speed and slow speed.

  • Trying to send commands to ffmpeg via RedirectStandardInput by using a button

    26 April, by user1888932

    I'm making a program which opens up ffmpeg and runs a job which then the user can quit the job by pressing a button.

    I'm getting "An async read operation has already been started on the stream." on "BeginOutputReadLine" when I try to quit the job a second time.

    If I try putting "Dim p3 As New Process" inside "test_run()" I get: "StandardIn has not been redirected." on "StandardInput.WriteLine" if I attempt to quit the job once.

    This is a working sample of my code.

    Imports System.IO
    
    Public Class Form1
        Dim quote As String = """"
        Dim p3 As New Process
    
        Function generate_batch(aargs As String) As Integer
            Dim sb As New System.Text.StringBuilder
            sb.AppendLine("@echo off")
            sb.AppendLine("CD " + quote + Application.StartupPath + quote)
            sb.AppendLine("ffmpeg " + aargs)
            sb.AppendLine("(goto) 2>nul & del " + quote + "%~f0" + quote)
            IO.File.WriteAllText(Path.GetTempPath + "ffmpeg.bat", sb.ToString())
        End Function
    
        Private Sub test_run()
            If TextBox1.Text = "1" Then
                p3.StandardInput.WriteLine("q")
                p3.Close()
            Else
                generate_batch(arg.Text)
                With p3.StartInfo
                    .FileName = Path.GetTempPath + "\ffmpeg.bat"
                    .CreateNoWindow = True
                    .RedirectStandardOutput = True
                    .RedirectStandardError = True
                    .RedirectStandardInput = True
                    .UseShellExecute = False
                End With
    
                AddHandler p3.OutputDataReceived, AddressOf consoleOutputHandler
                AddHandler p3.ErrorDataReceived, AddressOf consoleErrorHandler
    
                p3.Start()
    
                p3.BeginOutputReadLine()
                p3.BeginErrorReadLine()
            End If
        End Sub
    
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            test_run()
        End Sub
    
        Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
            TextBox1.Text = "1"
            test_run()
        End Sub
    
        '///////////////////
        '/ Standard Output /
        '///////////////////
        Private Delegate Sub consoleOutputDelegate(ByVal outputString As String)
        Private Sub consoleOutput(ByVal outputString As String)
            'Invoke the sub to allow cross thread calls to pass safely
            If Me.InvokeRequired Then
                Dim del As New consoleOutputDelegate(AddressOf consoleOutput)
                Dim args As Object() = {outputString}
                Me.Invoke(del, args)
            Else
                'Now we can update your textbox with the data passed from the asynchronous thread
                RichTextBox1.AppendText(String.Concat("", outputString, Environment.NewLine))
            End If
        End Sub
        'Catch the Standard Output
        Sub consoleOutputHandler(ByVal sendingProcess As Object, ByVal outLine As DataReceivedEventArgs)
            If Not String.IsNullOrEmpty(outLine.Data) Then
                'If the Current output line is not empty then pass it back to your main thread (Form1)
                consoleOutput(outLine.Data)
            End If
        End Sub
    
        '///////////////////
        '// Error Output ///
        '///////////////////
        Private Delegate Sub consoleErrorDelegate(ByVal errorString As String)
        Private Sub consoleError(ByVal errorString As String)
            'Invoke the sub to allow cross thread calls to pass safely
            If Me.InvokeRequired Then
                Dim del As New consoleErrorDelegate(AddressOf consoleError)
                Dim args As Object() = {errorString}
                Me.Invoke(del, args)
            Else
                'Now we can update your textbox with the data passed from the asynchronous thread
                RichTextBox1.AppendText(String.Concat("", errorString, Environment.NewLine))
            End If
        End Sub
        'Catch the Error Output
        Private Sub consoleErrorHandler(ByVal sendingProcess As Object, ByVal errLine As DataReceivedEventArgs)
            If Not String.IsNullOrEmpty(errLine.Data) Then
                'If the Current error line is not empty then pass it back to your main thread (Form1)
                consoleError(errLine.Data)
            End If
        End Sub
    End Class
    

    What's inside "arg.text"

    -re -i video.mp4 -c copy -f rtp_mpegts rtp://127.0.0.1:10000?pkt_size=1316
    

    I expect the job to be able to be stopped and started for an unlimited number of times but I keep running into problems and I don't know why.

    I'm wondering if I have to stop the async read operation but I don't know if that's possible.

  • Video and Audio stream in Python pipe to ffmpeg

    26 April, by Praveen P K

    Raw video from Python pipe is converted to udp stream using FFMPEG is working correctly using following code:

    command = [ 'ffmpeg',
                '-y', # (optional) overwrite output file if it exists
                '-r', '25', # frames per second
                '-i', '-', # The imput comes from a pipe
                '-an', # Tells FFMPEG not to expect any audio
                '-r', '25',
                '-c:v', 'copy',
                '-f', 'mpegts', 
                'udp://ip:port'
            ]
    devl  = open(os.devnull, 'w')
    file_name = '/tmp/file.txt'
    err1 = open(file_name, 'w')
    pipe  = sp.Popen( command, stdin=sp.PIPE, stdout=devl, stderr=err1) 
    

    But when audio stream also coming in same python pipe, how i should change the program to get both audio and video stream to udp stream.