Live data from Hacker News

FFMPEG from Zero to Hero

ffmpegfromzerotohero.com

81–90 of 140 posts

Re: FFMPEG from Zero to Hero

#81
post #70

I love FFMPEG, but it has truly awful handling of timestamps by default. You can't easily extract a clip using an exact timestamp because it rounds to the nearest keyframe, which may be many seconds earlier. It's such a powerful command-line tool, but I find the user-interface far more difficult than it needs to be. In "git" terminology, there's so much plumbing but not enough porcelain I wish there was a scriptable…

I'm not a video expert, but one thing I've noticed is that there seems to be a lot of discrepancies between video files and the way programs use them. I think it might be differences between how the the container describes the video and the video itself, and which one is chosen as the truth during operations.

the "video itself" doesn't really exist. If you're on Windows and use MPC, you can test this yourself - use WMV9 as a renderer, take a PNG screenshot, then switch to NVENC, and take a screenshot at the same timestamp. You'll notice that on most videos, the screenshots are not the same (with NVEnc introducing macroblocking in darkness, which WMV9 gradients out properly). Using the rendered video as a source of truth instead of the source material itself would be as big of a mistake as using Photoshop on a JPEG.

Re: FFMPEG from Zero to Hero

#82

ffmpeg is really useful, but isn't doing some of these things on a CPU really inefficient? I know there are some offloads for Nvidia GPU’s for some video stuff, but I was under the impression that they used Nvidia’s proprietary libraries that have limited codec support.

NVENC is definitely limited -- it only supports H.264, H.265, and H.266. :P But it's absolutely the wrong thing to use for quality video encoding, since it introduces awful artifacting. GPGPU programs for H.264 is being limited, since CUVID is still seen as "good enough" so I've seen support for this in Blender, and nothing else.

Re: FFMPEG from Zero to Hero

#84

The part of the book that covers raw[0] image conversion is lacking. It suggests ImageMagick or SIPS (on macOS), completely ignoring the difficulty of properly converting image from scene-referred to output-referred format. The result is probably going to be of limited usefulness in most cases involving interpretation of raw footage. If the author is here, I suggest looking into RawTherapee. It offers a GUI for autho…

Is there any book you’d recommend for scripting vfx/media pipelines using tools like ffmpeg , imagemagick , etc ?

I don’t know of any book like that. I have a CinemaDNG processing workflow: create a camera/lens profile using a ColorChecker and DCamProf, batch develop DNGs using RawTherapee into 16-bit TIFFs, export TIFF sequence as a movie using DaVinci Resolve (30 FPS if delivering to popular services like Instagram, where 24 FPS causes subtle stuttering). I’ve been meaning to script this all, Resolve can be easily replaced with ffmpeg, but didn’t get around to that yet. For basic VFX I’ve used Blender (which can track the scene allowing to incorporate 3D objects, and can act as a decent NLE) but again not in a scripted way. It’s just personal projects so there’s not enough pressure to automate.

Re: FFMPEG from Zero to Hero

#85
I was looking into cutting a file and I came across two flags. Could anybody explain them in layman's terms.

-c copy - It doesn't re-encode the file. What does re-encoding mean?

-async 1 -which is deprecated in favour of aresample. If the correct syntax is aresample=async=1 then would it just cut off the audio timestamp and match it with video timestamp.

Re: FFMPEG from Zero to Hero

#86

I love FFMPEG, but it has truly awful handling of timestamps by default. You can't easily extract a clip using an exact timestamp because it rounds to the nearest keyframe, which may be many seconds earlier. It's such a powerful command-line tool, but I find the user-interface far more difficult than it needs to be. In "git" terminology, there's so much plumbing but not enough porcelain I wish there was a scriptable…

I use ffmpeg for encoding audio and metadata extraction... very powerful and a really sophisticated tool, but handling timestamps I agree with you. Some caveats that I came across along the way:

- Inaccurate time handling (https://github.com/yermak/AudioBookConverter/issues/21#issue...)

- Incorrect handling of mp3 chapters https://github.com/sandreas/m4b-tool/issues/71#issuecomment-...

If anyone who is interested in using ffmpeg in a docker container (without the dependencies / compiling stuff), this alias is pretty useful (with relative paths ;-):

  alias ffmpeg='docker run --rm -u $(id -u):$(id -g) -v "$PWD:$PWD" -w "$PWD" mwader/static-ffmpeg:4.3.2'

Re: FFMPEG from Zero to Hero

#87

I was looking into cutting a file and I came across two flags. Could anybody explain them in layman's terms. -c copy - It doesn't re-encode the file. What does re-encoding mean? -async 1 -which is deprecated in favour of aresample. If the correct syntax is aresample=async=1 then would it just cut off the audio timestamp and match it with video timestamp.

> What does re-encoding mean

It's something you may want done or not whenever a decoding step is happening by necessity anyway. The "possible benefit" would be if the original encoding was partially broken somewhere (which players/decoders can handle usually but they complain to stderr) or otherwise sub-par. Not sure about video but audio files floating about out there from the last 25 years are a wild mess, with "mp3"s really being layer 2 or 1 or not even mpeg at all inside etc.

Re: FFMPEG from Zero to Hero

#88

I was looking into cutting a file and I came across two flags. Could anybody explain them in layman's terms. -c copy - It doesn't re-encode the file. What does re-encoding mean? -async 1 -which is deprecated in favour of aresample. If the correct syntax is aresample=async=1 then would it just cut off the audio timestamp and match it with video timestamp.

re-encoding = transcoding. which means decoding one video codec and then encoding it into a different codec. OR, reading the source, but then recompressing it into the same codec. Either way, the new video is not the same as the original. `-c :v copy` literally takes the video from the source and places it into the output without doing anything than making it fit in the output.

Re: FFMPEG from Zero to Hero

#89

If this book does what it claims to do, it should probably cost more (pls raise the price after I buy it). I strongly believe that inside ffmpeg may be the secret to the cosmos, the universe and life itself

I have yet to get 42 as the output of any ffmpeg command I have ever used (and I use it daily). So not sure it is the answer to life, the universe, and everything.

Re: FFMPEG from Zero to Hero

#90

FFMPEG exposes a terrible API. Even something as simple as thumbnail extraction is overly complex and has a ton of pitfalls that you won't discover until a user uploads a weirdly encoded video.

how is it ffmpeg's fault for a goofy user suppled input?
Post reply on HN