Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Check if a video file has subtitles [closed]

    18 mai, par TRS

    Is it possible to check if a video file has a subtitle using bash and get a simple answer like "yes" or "no". I don't need to know any details about the subtitles.

    Maybe using ffmpeg?

  • Increase volume on multiple files

    17 mai, par Reckless Velociraptor

    Let say I have a couple of hundreds mp3 files. How do I increase volume in all of them with ffmpeg?

    This is for single file:

    ffmpeg -i input.mp3 -filter:a "volume=1.5" output.mp3
    

    And what about multiple files with one command?

  • Black screen when recording specific screen / window using ffmpeg [closed]

    16 mai, par Mark Brin

    Issue: I'm trying to capture the specific window using ffmpeg & i've tried these below command for that:

    ffmpeg -f gdigrab -framerate 30 -i title="Window Title" -b:v 3M -pix_fmt yuv420p output_FILENAME.webm
    

    And also try changing output format to .mp4

    ffmpeg -f gdigrab -framerate 30 -i title="Window Title" -b:v 3M -pix_fmt yuv420p output_FILENAME.mp4
    

    but the output video just shows the black screen with cursor.

    What i've tried:

    Get-Process |
      Where-Object { $_.MainWindowTitle -ne "" } |
      Select-Object -Unique MainWindowTitle
    

    System I'm using:

    Windows 11

  • Converting mkv files to mp4 with ffmpeg-python

    16 mai, par myth0s

    I have a lot of .mkv files that I'm trying to convert to .mp4, so I decided to try and program a solution in python. After a few hours, trying to figure out how to copy the subfolders too, I gave up on it and decided to stick with converting individual subfolders, and then copying them over to another directory.

    I've made a simple script, that should convert .mkv files that are in the same folder as the script. However, I keep getting this error:

    FileNotFoundError: [WinError 2] The system cannot find the file specified

    Here's my code:

    import os
    import ffmpeg
    
    start_dir = os.getcwd()
    
    def convert_to_mp4(mkv_file):
        no_extension = str(os.path.splitext(mkv_file))
        with_mp4 = no_extension + ".mp4"
        ffmpeg.input(mkv_file).output(with_mp4).run()
        print("Finished converting {}".format(no_extension))
    
    for path, folder, files in os.walk(start_dir):
        for file in files:
            if file.endswith('.mkv'):
                print("Found file: %s" % file)
                convert_to_mp4(file)
            else:
                pass
    
    
  • How to interact with process output ?

    14 mai, par 1ben99

    Ok so at the moment I have a program which runs FFmpeg using a process in VB.net. I send the process arguments in the startinfo as well as other things like the file location. When I run the code it sends the console output to the debug console; this is probably because I have the .UseShellExecute = False and processInfo.RedirectStandardOutput = True

    My question is: How do I make something which can interpret the output? Also with FFmpeg, the process is continuous so the process is always running for the most part and constantly adding more output lines in the debug console.

    The code I am using:

    Dim process As New Process
            Dim processInfo As New ProcessStartInfo
            processInfo.FileName = tempPath
            processInfo.Arguments = ("-r 1/.1 -i " + link + " -c copy " + saveLocation + "\" + streamerName + ".ts")
            processInfo.UseShellExecute = False
            processInfo.WindowStyle = ProcessWindowStyle.Hidden
            processInfo.CreateNoWindow = True
            processInfo.RedirectStandardOutput = True
            process.StartInfo = processInfo
            process.Start()
    

    I tried this with no luck.

    Dim output As String
            Using StreamReader As System.IO.StreamReader = process.StandardOutput
                output = StreamReader.ReadToEnd().ToString
            End Using
    

    Edit: I now have this code:

    Dim process As New Process
            AddHandler process.OutputDataReceived, AddressOf CallbackProcesoAsync
            AddHandler process.ErrorDataReceived, AddressOf ErrorDataReceivedAsync
            Dim processInfo As New ProcessStartInfo
            processInfo.FileName = tempPath
            processInfo.Arguments = ("-r 1/.1 -i " + link + " -c copy " + saveLocation + "\" + streamerName + ".ts")
            processInfo.UseShellExecute = False
            processInfo.WindowStyle = ProcessWindowStyle.Hidden
            processInfo.CreateNoWindow = False
            processInfo.RedirectStandardOutput = True
            processInfo.RedirectStandardError = True
            process.StartInfo = processInfo
            process.Start()
            processes.Add(Tuple.Create(tempPath, streamerName))
            Debug.WriteLine("Attempting to record " + streamerName)
            Dim output As String
            Using StreamReader As System.IO.StreamReader = process.StandardOutput
                output = StreamReader.ReadToEnd().ToString
            End Using
        End If
    End Sub
    
    Private Sub CallbackProcesoAsync(sender As Object, args As System.Diagnostics.DataReceivedEventArgs)
        If Not args.Data Is Nothing AndAlso Not String.IsNullOrEmpty(args.Data) Then
            RichTextBox1.Text = args.Data
        End If
    End Sub
    
    Private Sub ErrorDataReceivedAsync(sender As Object, args As System.Diagnostics.DataReceivedEventArgs)
        If Not args.Data Is Nothing AndAlso Not String.IsNullOrEmpty(args.Data) Then
            RichTextBox2.Text = args.Data
        End If
    End Sub
    

    But I have not recieved any outputs to the richtextboxes?

    I feel like it has something to do with the streamReader so I removed it and it still didn't work? I don't have any more ideas what it could be.