Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • scale issues when adding images to a video

    27 septembre 2019, par Geo

    When I add two images to a video, the second image added is scaled down for some reason.

    I have two images arrow.png and icon1.png and one background.mp4 video, when I added the two images onto the video, the result is that the first image is added with the right size, but the second image is added with reduced size, probably in half of the specified size.

    this is my command:

    ffmpeg -i background.mp4 -i arrow.png -i icon1.png -filter_complex "[1:v]scale=311:175,setsar=1,format=bgra[img1];
    [img1]rotate=30*PI/180:c=none:ow=rotw(30*PI/180):oh=roth(30*PI/180)[rotate1];[2:v]scale=319:179,setsar=1,format=bgra[img2];
    [img2]rotate=59*PI/180:c=none:ow=rotw(59*PI/180):oh=roth(59*PI/180)[rotate2];[0][rotate1]overlay=242:-22:enable='between(t,0,6)',scale=hd720[overlay1];
    [overlay1][rotate2]overlay=34:13:enable='between(t,0,6)',scale=hd720" -c:a copy -c:v libx264 -preset ultrafast -y test01.mp4
    

    I am expecting the same size as the specified

  • Converting from .WAV to .txt or .dat with ffmpeg ?

    27 septembre 2019, par MrFarnham

    I need to convert from .WAV to ASCII text file for utilizing in my script. FFMpeg can translate from .wav to .raw:

    ffmpeg -i input.wav -f s16le -acodec pcm_s16le output.raw
    

    but I can't translate from .raw to .txt or .dat. I know of hexdump but I need something that works in windows.

    Any suggestions on how to make this work, or another method all together of converting from .wav to .txt?

  • Add two MP3 files to an MP4 file using ffmpeg

    26 septembre 2019, par sigur7

    I am using ffmpeg on Windows and getting the following error as I try to add two MP3

    Stream specifier '' in filtergraph description [1]adelay=1|1[b];[2]adelay=100|100[c];[0][b][c]amix=3 matches no streams.
    

    using the following command

    ffmpeg -i vidwithnoaudio.mp4 -i audio0.mp3 -i audio1.mp3 -filter_complex "[1]adelay=1|1[b];[2]adelay=100|100[c];[0][b][c]amix=3" vidwithaudio.mp4
    

    Here is an alternative command I have found I am trying to edit into working with this:

    ffmpeg -i 1.mp4 -i 1.3gp -i 2.3gp -i 1.mp3
      -filter_complex "[2]adelay=10000|10000[s2];[3:a][1:a][s2]amix=3[a]"
      -map 0:v -map "[a]" -c:v copy result.mp4
    
  • FFMpeg and max bitrate

    26 septembre 2019, par Aurelien Stride

    For a personal project, using AV1 codec, I have a bitrate constraint for a video to 88kbps, with choosen video bitrate at 66kbps and mono audio bitrate at 22kbps.

    I currently use this command:

    ffmpeg -i input.mp4 -c:v libaom-av1 -strict -2 -b:v 66150 -c:a libfdk_aac -ar 22050 -b:a 22050 -ac 1 -maxrate 66150 -bufsize 66150 -vf scale=720:-1 -movflags +faststart output.mp4
    

    However, my final video has a 95kbps bitrate:

    Duration: 00:01:09.73, start: 0.000000, bitrate: 95 kb/s

    Stream #0:0(und): Video: av1 (Main) (av01 / 0x31307661), yuv420p(tv, progressive), 720x302, 69 kb/s, 24 fps, 24 tbr, 12288 tbn, 12288 tbc (default)

    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, mono, fltp, 22 kb/s (default)

    Is there a method to validate my need? Is it normal that 66+22>88kbps?

    Regards,

    EDIT 1: as @Gyan suggested, I've tried to reduce -bufsize parameter, but I still have a too high bitrate. The most working way is to set video bitrate -b:v to 50kbps, but it gives poorer image...

    ffmpeg -i input.mp4 -c:v libaom-av1 -strict -2 -b:v 50k -c:a libfdk_aac -ar 22050 -b:a 22050 -ac 1 -minrate 33075 -maxrate 66150 -bufsize 44100 -vf scale=-1:360 -movflags +faststart -threads 1 output.mp4
    

    Any idea to limit overhead, if overhead is in cause?

  • Timelimit plays for twice the duration [on hold]

    26 septembre 2019, par the_new_james

    I am using the following command to stream to a test an endpoint:

    ffmpeg -loglevel debug -f lavfi -re -i testsrc=size=hd720:rate=30 
           -f lavfi -re -i anoisesrc 
           -vf "drawtext=fontfile=\'/Library/Fonts/Arial.ttf\': text=\'Local time %{localtime\: %Y\/%m\/%d %H.%M.%S} (%{n})\': x=50: y=50: fontsize=48: fontcolor=white: box=1: boxcolor=0x00000099" 
           -pix_fmt yuv420p -c:v libx264 -b:v 1000k -g 30 -profile:v baseline -preset veryfast 
           -c:a libfdk_aac -b:a 96k -timelimit 60 -f flv $RTMP_OUTPUT/$NAME
    

    Because I'm adding this command to my automation, I would like to protect it from running indefinitely in case something goes wrong with my script (I start the ffmpeg job in a background process that is detached from the script). Therefore, I added the flag -timelimit 60, that, according to the documentation, the job should exit after duration seconds.

    I can see that the command is being parsed correctly

    Reading option '-timelimit' ... matched as option 'timelimit' (set max runtime in seconds) with argument '60'.
    ...
    Finished splitting the commandline.
    ...
    Applying option timelimit (set max runtime in seconds) with argument 60.
    ...
    

    Here's an example output

    enter image description here

    The issue is that I noticed that the stream runs for longer than the specified time. After a couple of tests, I noticed that it is running for double the time, which got me thinking if it is taking the number of frames (assuming 2-second frames).

    Can someone clarify the timelimit option, please? And the possible causes for running longer than specified.

    PS: I'm using ffmpeg version 4.1.4 on a MAC OS Mojave (10.14.6)