Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Bulk identifying images with FFMPEG that contain a graphic

    26 septembre 2019, par edwardv

    I need to be able to bulk sort through images that contain a graphic and remove these images from the folder. The graphic is a ruler-like image for scale.

    I'm a novice with FFMPEG, but have already written a batch script that resizes images. The logic seems pretty understandable, however my issue is that I don't know what and where to research for a solution to my problem. From what I read, imagemagik might also be a great tool, but I feel more comfortable with FFMPEG.

    I expect the script to look through all image files in a folder and find those the contain the ruler graphic and remove the said images with the rule graphic from the folder. The images are product shots on white backgrounds and the rule graphic is not overlaying anything or acting like a watermark.

    Ideally, if possible, a way to crop out the graphics would be an amazing next step.

  • I need the script open waiting for new files

    26 septembre 2019, par AUDICOM

    I use the following FFMPEG script for DAV to AVI file conversion:

    for %% A IN (* .dav) DO ffmpeg -i "%% A" -vcodec libx264 "%% A.avi
    

    But DAV files are generated in the folder every 30 minutes, the script is triggered when the 1st DAV file is generated, but the conversion is fast, and it finishes before the next DAV file is generated in the folder, I need the script. convert the DAV and wait for the next file to arrive in the folder, or after converting the last DAV file that arrives in the folder 12:00 PM the script terminates the process.

  • ffmpeg mp4 convert script with sub directories

    25 septembre 2019, par burro me

    I have a folder with multiple subfolders with mkv files

    main directory

    then

    Directory A Dir B Dir C Dir D Dir E Dir F Dir G

    I need a script that will search all directories for .mkv and convert to .mp4

    i currently have this script

    for file in *.mkv; do ffmpeg -i "$file" -c:a aac -q:a 2 -c:v copy "${file%.m kv}.mp4"; done

    but it only works if the .sh file is placed in each dir

  • I can not apply an overlay on top of an overlay using ffmpeg

    25 septembre 2019, par meraklis56

    As the title says, I can not apply an overlay on top of an overlay. More specifically, I have these layers:

    1. background
    2. video
    3. stickers

    And I want to create a fourth layer, on the size of 1 and 3rd layer. So the order I want to have is:

    1. white layer
    2. background
    3. video
    4. stickers

    Following the documentation I came up with:

    const command = [
               '-y', // always overwrite file
               '-loop', '1', // one time
               '-i', dataObject['bg_src'], // bg image
               '-i', dataObject['videos']['main']['src'], // video
               '-i', dataObject['fg_src'], // sticker image
               '-i', dataObject['fg_src'], // bg image2
               '-preset', 'veryfast', // fast encoding
               '-crf', '23', // quality
               '-vcodec','libx264', // codec
               '-t', '3', // time threshold
               '-loglevel', '24', // verbose level
               '-filter_complex',
               '[0:v]pad=ceil(iw/2)*2:ceil(ih/2)*2[bg_src];' +                      // bg_src: to make width even, export it as [bg_src]
               '[2:v]pad=ceil(iw/2)*2:ceil(ih/2)*2[fg_src];' +                      // fg_src: to make width even, export it as [fg_src]
               '[3:v]pad=ceil(iw/2)*2:ceil(ih/2)*2[fg_src2];' +                     // bg_src: to make width even, export it as [fg_src2]
               'color=white,format=rgb24[white_canvas];' +                          // create white background
               '[white_canvas][fg_src2]scale2ref[b][a];' +                          // make white background same size as [fg_src2]
               '[a][b]overlay=0:0[white_canvas_scaled];' +                          // export it as white_canvas_scaled
               '[1:v]scale=%s:-1[video_scaled];' +                                  // video: scale it (width is injected here)
               '[white_canvas_scaled][video_scaled]overlay=%s:%s:shortest=1[bg];' + // white background & scaled video
               '[bg][bg_src]overlay=0:0[bg2]',                                      // bg_src overlay here
               '[bg2][fg_src]overlay=0:0',                                          // fg_src overlay here
               FileService.photoPath + '/output.mp4'];
    

    But in last command fails and I receive:

    Unable to find a suitable output format for '[bg2][fg_src]overlay=0:0'

    What is wrong?

  • Newly coded libvpx 1.8.1 webm MSE can't be played in chrome, firefox is OK

    25 septembre 2019, par d3im

    Error of Chrome:

    Error Message: CHUNK_DEMUXER_ERROR_APPEND_FAILED: Got a block with negative timecode offset -14

    I make webm video using latest ffmpeg 4.2.1 with libvpx 1.8.1:

    1-st pass:

    ffmpeg -y -i input.mp4 -c:v libvpx-vp9 -b:v 800k -pix_fmt yuv420p -vf scale=-1:720 -tile-columns 2 -quality good -speed 4 -max-intra-rate 0 -lag-in-frames 25 -row-mt 1 -pass 1 -an -threads 0 -f webm /dev/null
    

    2-nd pass:

    ffmpeg -i input.mp4 -c:v libvpx-vp9 -b:v 800k -pix_fmt yuv420p -vf scale=-1:720 -tile-columns 2 -quality good -speed 0 -max-intra-rate 0 -auto-alt-ref 1 -lag-in-frames 25 -row-mt 1 -pass 2 -c:a libopus -b:a 64k -frame_duration 60 output.webm
    

    Then I use mse-tools (https://github.com/acolwell/mse-tools) to remux output.webm. When I use dump tool from this package it shows me negative offsets which are source of problem in Chrome - It can't append chunk with negative offset.