Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • How to properly specify font file for ffmpeg as it's always defaulting to Arial ? [closed]

    21 avril, par Jim Jans

    When calling ffmpeg it keeps defaulting to Arial-MT / Arial-BoldMT even when specifying a font. How do you correctly specify the fontfile?

    When specifying any font it will always default back:

    [Parsed_subtitles_0 @ 000001915a83f800] fontselect: (DosisBold, 400, 0) -> ArialMT, 0, ArialMT

    I am calling ffmpeg with the following command:

    ffmpeg -i input.mp4 -vf subtitles='subtitle.srt':force_style='FontName=DosisBold,Alignment=10,Fontsize=24' output.mp4 -loglevel debug

    I have a file called "DosisBold.ttf" in the same folder as ffmpeg. I have already tried FontName=DosisBold.ttf and it also doesn't work. All files are in the same folder as the ffmpeg.exe.

    I have converted the .srt file to .ass and specified the font file but it still defaults back to ArialMT.

    Format: Name, Fontname, Fontsize {...}
    Style: SubStyle,DosisBold,24 {...}
    

    I am using "ffmpeg-n7.0-latest-win64-gpl-7.0", I have tried different versions of ffmpeg (e.g. "ffmpeg-master-latest-win64-gpl") and still no change. Also tried different fonts / font files and it always defaults back to Arial.

  • Can we limit max fps by using FFMPEG ?

    21 avril, par Oleksandr

    I want to limit max fps when I process a video.
    For example: set limit up to 30 frames per second.
    If I process a video with 24 fps then I don't change fps but if I process the video with 60 fps then I change fps to 30.
    Can it be done by using only FFmpeg (with filters or something else)?
    I think that it can be done by using filter like this:

    -filter:v "fps=fps='min($CURRENT_FPS,30)'"
    

    But I don't know is it possible to get current fps from an expression.

  • How do I use rust to read video (.mp4 or .mov) metadata on windows 11 ? [closed]

    21 avril, par Hchap

    I want to be able to read the metadata of .mp4 and .mov files with rust on windows 11 to find the date that the video was taken, and failing that, the file creation date.

    I need a step-by-step guide on how to set up the dependencies for the solution - I have tried with ffmpeg and was unable to get it working with msys2, at first I have issues with PKG_CONFIG_PATH but I resolved those, and then I specified the location of the includes in msys2 in cargo.toml, which resolved ffmpeg-sys not being able to find header files.

    However, I was unable to resolve the issue that rust could not find vcpkg - why does it need this? Do I need to install it? I believe I have incorrectly installed FFMPEG. How can I correctly install it, and will it be possible to build my rust project for release so that it can run on a variety of computers without FFMPEG installed?

  • ffmpeg concatenate a large number of videos with different codecs and resolutions

    21 avril, par Paul H

    The videos I am trying to concatenate can have different technical metadata, like codec, resolution, etc. So I wrote a filtergraph that works for my purposes. My complete command can look like this:

    ffmpeg -i "vid1.mp4" -i "vid2.mp4" -i "vid3.mp4" -filter_complex_script "filtergraph.txt" -map "[outv]" -map "[outa]" -c:v libx264 -r 60 -preset medium -crf 24 -c:a aac -b:a 160k "output.mp4"
    

    And "filtergraph.txt" looks like this (autogenerated by my own script before). I have the filters to change all input resolutions to Full HD. (Newlines in the following snippet are just introduced for readability, they are not contained in my filtergraph.txt)

    [0:v]scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,setsar=1[v0];
    [1:v]scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,setsar=1[v1];
    [2:v]scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,setsar=1[v2];
    [v0][0:a][v1][1:a][v2][2:a]concat=n=3:v=1:a=1[outv][outa]
    

    Now in this case, it works, I have the three source videos, they can have different resolutions, codecs or even different framerates - they are all combinded into one Full HD 60 FPS output video.

    The problem is, that I want to concatenate a large number of video files and get the error, that the command contains too many characters for cmd. That's why I already put the filtergraph to a seperate file and read it using -filter_complex_script which works.

    But it can still get too long if I have a few hundred source files that I want to concat.

    As far as I tested it, I can't use -f concat -i listOfFiles.txt because every source file would have to be in the same codec, resolution etc then, and I could not use the filtergraph for scaling due to the fact that ffmpeg would try to concat before demuxed output goes into filter.

    So, how could I concat hundreds of videos while resizing them all to Full HD and applying the other filters, but keep the cmd line short?

    Is there something similar to -filter_complex_script but for input files? Or will I have to encode each source video to my desired target format first and then concat them with stream copy?

  • How to concatenate multiple MP4 videos with FFMPEG without audio sync issues ?

    21 avril, par sb3k

    I have been trying to concatenate a number of MP4 clips (h264,aac) using the FFMPEG concat protocol documented here. The clips concatenate successfully, however there are multiple errors in the logs including:

    • Non-monotonous DTS in output stream
    • Past duration too large

    Additionally, it seems that the audio and video go slightly out of sync as more clips are added - though it is more noticeable on certain players (Quicktime & Chrome HTML5).

    Here is the code I am using, any tips would be appreciated!

    Convert each video to temp file

    ffmpeg -y -i -vcodec libx264 -acodec aac -f mpegts -bsf:v h264_mp4toannexb -mpegts_copyts 1

    Concat temp files

    ffmpeg -i concat -map 0 -vcodec copy -aprofile aac_low -acodec aac -strict experimental -cutoff 15000 -vbsf aac_adtstoasc -b:a 32k