Newest 'ffmpeg' Questions - Stack Overflow

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

Articles published on the website

  • ffmpeg throwing System.AccessViolationException

    13 August, by shmit

    I am using ffmpeg to extract frames and iterate over them. The codes iterates correctly over few frames and then then randomly throws error

    "System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'
    
    

    Any suggestions on how to resolve it? System details and screenshot below:

    System Details: OS: Windows TargetFramework: .netCore3.1 Nugets: FFMediaToolkit v3.0.0 and SixLabors.ImageSharp v1.0.0 Shared dlls copied from: https://ffmpeg.zeranoe.com/builds/ for version 4.2.2

    ErrorScreenshot

  • Convert set of PNGs into rawvideo .raw FFMPEG

    13 August, by Wire

    Recently, I have been trying to modify the boot animation of a little robot. It is a .raw file and it contains every RGB565 frame one after the other. I have been able to get all of the frames using

    ffmpeg -f rawvideo -pixel_format rgb565 -video_size 184x96 -framerate 10 -i "boot_anim.raw" -r 1/1 boot_anim%02d.png

    But if I try to repack it with

    ffmpeg -i boot_anim%02d.png -f rawvideo -pix_fmt rgb565 -framerate 10 -video_size 184x96 -r 1/1 "boot_anim.raw"

    it only puts in the first two frames and nothing else. I have also tried libx264 and putting in vcodecs manually. Same result. I'm new to ffmpeg and Linux overall.

    Here is the full output:

    ffmpeg version N-98716-gb40dd2f Copyright (c) 2000-2020 the FFmpeg developers
      built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
      configuration: --enable-encoder=png --enable-decoder=png
      libavutil      56. 58.100 / 56. 58.100
      libavcodec     58.100.100 / 58.100.100
      libavformat    58. 50.100 / 58. 50.100
      libavdevice    58. 11.101 / 58. 11.101
      libavfilter     7. 87.100 /  7. 87.100
      libswscale      5.  8.100 /  5.  8.100
      libswresample   3.  8.100 /  3.  8.100
    Input #0, image2, from 'boot_anim%02d.png':
      Duration: 00:00:00.44, start: 0.000000, bitrate: N/A
        Stream #0:0: Video: png, rgba(pc), 184x96, 25 fps, 25 tbr, 25 tbn, 25 tbc
    File 'boot_anim.raw' already exists. Overwrite? [y/N] y
    Stream mapping:
      Stream #0:0 -> #0:0 (png (native) -> rawvideo (native))
    Press [q] to stop, [?] for help
    [swscaler @ 0x556d6993d940] full chroma interpolation for destination format 'rgb565le' not yet implemented
    Output #0, rawvideo, to 'boot_anim.raw':
      Metadata:
        encoder         : Lavf58.50.100
        Stream #0:0: Video: rawvideo (RGB[16] / 0x10424752), rgb565le, 184x96, q=2-31, 282 kb/s, 1 fps, 1 tbn, 1 tbc
        Metadata:
          encoder         : Lavc58.100.100 rawvideo
    frame=    2 fps=0.0 q=-0.0 Lsize=      69kB time=00:00:02.00 bitrate= 282.6kbits/s dup=0 drop=9 speed= 871x    
    video:69kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
    

    Any help appreciated!

  • How to batch watermark a directory of videos with FFMPEG on a Mac [closed]

    13 August, by analogvids

    I need to create a shell script that allows me to add a watermark (.PNG) to all of the video files in a given directory, and I need to do this on a Mac.

    I've successfully written and run a script to batch convert videos:

    for i in *.Avi; do ffmpeg -i "$i" -c:a aac -b:a 128k -c:v libx264  -preset veryslow "${i%}.mp4"; done)
    

    I have also successfully run a command to convert and watermark videos individually:

    ffmpeg -i test.MOV -i watermark.png -filter_complex "overlay=100:100" watermarked.mp4
    

    I combined them into the following script:

    #!/bin/bash

    for i in *.MOV; do ffmpeg -i "$i" -i watermark.jpeg -filter_complex “overlay=0” ”${I%}.mp4"; done

    and this is the error message terminal spits out: ./batchwatermark10.sh: line 3: unexpected EOF while looking for matching `"' ./batchwatermark10.sh: line 4: syntax error: unexpected end of file

    This answer doesn't help, though I tried to adapt it for Mac. And this answer works, but it doesn't help me batch process a directory of video files.

    Any guidance would be greatly appreciated!

  • How to batch watermark videos with FFMPEG on a Mac [closed]

    12 August, by analogvids

    I've seen a lot of code for scripts to batch convert and to batch watermark videos with FFMPEG but these are largely guides for windows. I need to know how to do this on a Mac. I've successfully written and run a shell script to batch convert videos:

    for i in *.Avi; do ffmpeg -i "$i" -c:a aac -b:a 128k -c:v libx264  -preset veryslow "${i%}.mp4"; done)
    

    I have also successfully run a command to convert and watermark videos individually:

    ffmpeg -i test.MOV -i watermark.png -filter_complex "overlay=100:100" watermarked.mp4
    

    I consistently get a syntax error when trying to combine these commands to create a script for batch watermarking. I do not need to batch convert in the same command, though having that option would be nice. Any guidance would be greatly appreciated.

    for clarification, this is the script i created:

    #!/bin/bash for i in *.MOV; do ffmpeg -i "$i" -i watermark.jpeg -filter_complex “overlay=0” ”${I%}.mp4"; done

    and this is the error message terminal spits out: ./batchwatermark10.sh: line 3: unexpected EOF while looking for matching `"' ./batchwatermark10.sh: line 4: syntax error: unexpected end of file

    Thanks!

  • How to change video size hevc (x265) with ffmpeg

    12 August, by dmj5

    I have video that has overall bit rate = 55,3 Mb/s and filesize 38,3 GB - it's coded with x265. I would like to convert it with ffmpeg (make it smaller) and change bit rate to ~24 Mb/s. Could someone help me, I have tried:

    ffmpeg -i "filename.mkv" -c:v libx265 -crf 23 -c copy "filename_output.mkv"

    but filesize is only 6 GB smaller. What should I change in this command?