Giter Site home page Giter Site logo

ffmpeg tips about blog-post-issues HOT 5 OPEN

aben20807 avatar aben20807 commented on August 15, 2024
ffmpeg tips

from blog-post-issues.

Comments (5)

aben20807 avatar aben20807 commented on August 15, 2024

Convert video to gif

ffmpeg -y -i input.flv -filter_complex "fps=4,scale=1920:-1:flags=lanczos,split[s0][s1];[s0]palettegen=max_colors=256[p];[s1][p]paletteuse=dither=bayer" output.gif

scale and max_colors impact the output gif's size

from blog-post-issues.

aben20807 avatar aben20807 commented on August 15, 2024

Concat (w/o re-encode - fast)

  • ref
  • input: A.mp4, B.mp4, C.mp4, ...
ffmpeg -safe 0 -f concat -i <(find . -type f -name '*.mp4' -printf "file '$PWD/%p'\n" | sort) -c copy output.mp4

Concat (w/ re-encode - slow)

  • remove -c:v h264_nvenc if there is no GPU driver
ffmpeg -i A.mp4 -i B.mp4 -filter_complex "concat=n=2:v=1:a=1" -c:v h264_nvenc output.mp4

if error when different DAR

[Parsed_concat_4 @ 0x55c55ae4d400] Input link in0:v0 parameters (size 1280x720, SAR 1:1) do not match the corresponding output link in0:v0 parameters (1280x720, SAR 8001:8000)
[Parsed_concat_4 @ 0x55c55ae4d400] Failed to configure output pad on Parsed_concat_4
Error reinitializing filters!

Correct the aspect of one of videos first.

ffmpeg -i tmpA.mp4 -aspect 16:9 -c copy A.mp4

from blog-post-issues.

aben20807 avatar aben20807 commented on August 15, 2024

Convert webp images into jpeg format

find . -iname '*.webp' -exec bash -c 'ffmpeg -y -hide_banner -loglevel error -i "$1" -q:v 1 -qmin 1 -qmax 1 "${1%.*}.jpg"; printf "$1\n"' _ {} \;

轉換完後刪除原檔

find . -iname '*.webp' -exec bash -c 'ffmpeg -y -hide_banner -loglevel error -i "$1" -q:v 1 -qmin 1 -qmax 1 "${1%.*}.jpg"; printf "$1\n" && rm "$1"' _ {} \;

from blog-post-issues.

aben20807 avatar aben20807 commented on August 15, 2024

Reduce file size

  • -crf N: N: 0–51, where 0 is lossless, 23 is the default, and 51 is worst quality possible
  • -b 800k: limit the bitrate (optional)
ffmpeg -i input.flv -c:v h264_nvenc -crf 30 -c:a aac -b:a 192k -vf format=yuv420p -movflags +faststart output.mp4

from blog-post-issues.

aben20807 avatar aben20807 commented on August 15, 2024

Combine video and audio

ffmpeg -i video.mp4 -i audio.m4a -c copy -map 0:v:0 -map 1:a:0 output.mp4

optional

 yt-dlp -F {youtube url}

from blog-post-issues.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.