Newest 'ffmpeg' Questions - Stack Overflow

Articles published on the website

  • How to start video recording of tests via ffmpeg, in headless mode

    31 May, by Vitalii

    I have rspec tests that need to run in headless browser mode, the system macos 10.15.
    I want to record videos using ffmpeg without starting the browser. On linux systems, there is xvfb, but there is no macos version.
    Can you tell me how I can create a virtual screen, run tests, and save them in ffmpeg ?

    This is my command for record video - ffmpeg -f avfoundation -i '1' -c:v libx264 -preset ultrafast ~/Desktop/output.mkv, where avfoundation -i '1' is my screen number, but i need run virtual screen.

    I understand that there is a selenoid, but I don't need it.

    I found a xquartz, but i don't understand, how it work ...

  • Can ffmpeg transcode an audio track and add it as a second audio track at the same time, or if not, how to do it as separate commands?

    31 May, by wb6vpm

    A bit of history. I am using Plex as my media server, but for reasons unknown, it has issues transcoding the DTS-HD MA 7.1 audio to EAC3 stereo and keeps buffering (the server has plenty of horsepower on all fronts, CPU/RAM/drive space & speed, gigabit networks connections for all devices. The playback device (TCL Roku TV, with a 3rd party soundbar connected via HDMI ARC) doesn't support the built-in 7.1 audio, so I get silence if I play it back directly by putting the file on a USB stick.

    Also, I am by no means a ffmpeg guru, I figured out what I do know by Google University and asking questions, so please be kind and forgive me if I ask follow-up questions that may seem n00b-ish, and please provide example commands (preferably in the context of my command below so that I can have a known point of reference to start with).

    I have a movie with 4K (HEVC Main 10 HDR) video and DTS-HD MA 7.1 audio that I am looking to leave the video and audio untouched, but to add a 2nd audio track in either EAC3 or if necessary, just AC3 in stereo

    So what I am looking for is as follows:


    • Existing->4k video file (no change)
    • Existing->7.1 audio (no change)
    • Convert and add->stereo audio as a 2nd audio track to the output.mkv file

    Below is the command I've historically used with ffmpeg to convert and replace the audio file with the stereo audio, but since I'd prefer to leave the 7.1 audio in place, this doesn't work: ffmpeg -i "D:\video.mkv" -c:v copy -c:a aac -b:a 128k "D:\output.mkv"

    And if this cannot be done as a single command, please also let me know what steps I do need to take to be able to do it.

    Thanks in advace, Mike

  • moviepy ruining video after combining them

    31 May, by jjakeryan

    I'm trying to make a program that downloads videos from TikTok and combines all the separate videos into one .mp4 file and moves the final video to a folder on my desktop. I've been able to make it download all the videos and when I watch the separate videos they play fine however when I combine the videos some of the videos are messed up and look like this but the audio is looks like this

    #slecting all .mp4 files
        video_files = glob.iglob("*.mp4")
        clips = []
        for clip in video_files:  # For each mp4 file name
            clips.append(VideoFileClip(clip))  # Store them as a VideoFileClip and add to the clips list
        today =
        final = concatenate_videoclips(clips)  # Concatenate the VideoFileClips
        final.write_videofile(f"{today}.mp4", codec="libx264")
    #moving completed video to folder on desktop
        shutil.move(f'{today}.mp4', '/Users/jacobmarrandio/Desktop/done_videos/')

    thanks for any help

  • How to create chunks of videos (.ts) and .m3u8 file from a mp4 video?

    31 May, by Nafisur Ahmed

    I need to create chunks of videos (.ts) of fixed duration (say 5 or 10 seconds) from a mp4 video. And also I need the chunks in different formats (260p, 480p, 720p, 1080p).

    I'm able to create the chunks and m3u8 using the command below:

    ffmpeg -i input.mp4 -g 60 -hls_time 10 out.m3u8

    but not able to create for different resolutions as mentioned above.

  • How can i merge 2 videos with audio using ffmpeg?

    31 May, by Easy Tricks For Android

    I tried this command ffmpeg -f concat -i mylist.txt -c copy output.mp4 (the mylist.txt contains this file '1.mp4' file '2.mp4') but output.mp4 has no audio. please help me