This tutorial is very outdated, eg. `AVPicture`, which is used throughout, is completely deprecated and removed from the library, so you will simply encounter linker errors trying to follow this tutorial and will have to replace every `avpicture` call made in the tutorial. Also, `avcodec_decode_video2` is deprecated and you have to use `avcodec_send_packet` and `avcodec_receive_frame`.
The FFmpeg libraries are possibly the worst thing I have ever worked with in my life. I have never been more afraid to use a library than this. FFmpeg libraries randomly break themselves, so if you find an answer from a few years ago, chances are it's useless. Want to free an AVPacket? `av_free_packet` is deprecated,. You can use `av_packet_unref` (but there's _also_ a function named `av_packet_free` that doesn't do quite the same thing).
Most questions on Stack Overflow or related platforms have no replies, the library is not well-documented (requiring you to always read the massive source code and the API reference). In addition, some things are outright undocumented and missing from the API reference or documentation and require reading often-unfinished conversations on the mailing lists with no solution. The FFmpeg libraries have very little error handling, which means if you're a bad C developer like me you are required to recompile FFmpeg with debugging information unstripped so you can trace segfaults in gdb.
For the last point: Most distros have some way to get debug symbols. On Ubuntu for example, you add some repos and install -dbgsym packages (documented in https://wiki.ubuntu.com/Debug%20Symbol%20Packages).
Yes, ffmpeg is one hell of a library and documentation doesn't make things easier. You have to ask a lot of questions to understand the low level details, and also have to answer them yourself by doing experiments.
For the point about packet freeing, i think ``av_packet_unref`` is supposed to de-reference the ``encoded video/audio`` data being read in the RAM, so that internal ffmpeg code can deallocate it. It has to be called for every ``av_read_frame``. ``av_packet_free`` is supposed to release the generic ``packet`` object/struct allocated by ``av_packet_alloc``.
I learnt this while making a simple video player based on ffmpeg library.
as the old saying goes... the best way to get a correct answer on the internet is not to ask a question but to post an incorrect answer on the internet. it's fine you opened up the discussion for everyone to see this much more well written resource.
I guess it was that, which triggered this (I saw your link posted yesterday).
I'm curious, how accurate/ useful is this 2015 guide today, Vs the newer (?) one you linked (which is also very cool too!).
Having been watching various media related YouTube videos lately, in wondering whether to jump on the AV1 bandwagon for encoding all of my family videos.
Currently I'm using H264/MP4 in 4K, my kids are only 1 and 3yo and I already have a couple of terabytes of video, not to mention all of the photos.
So it isn't just me then! There was this one time, I downloaded a piece of porn in h.265 .mkv and I wanted to change its container to mp4 using ffmpeg(so that I could view it on iPad), and I actually, actually got pissed. In the end I just re-encoded the whole thing using Handbrake. The documentation does not explain its syntax.
The FFmpeg libraries are possibly the worst thing I have ever worked with in my life. I have never been more afraid to use a library than this. FFmpeg libraries randomly break themselves, so if you find an answer from a few years ago, chances are it's useless. Want to free an AVPacket? `av_free_packet` is deprecated,. You can use `av_packet_unref` (but there's _also_ a function named `av_packet_free` that doesn't do quite the same thing).
Most questions on Stack Overflow or related platforms have no replies, the library is not well-documented (requiring you to always read the massive source code and the API reference). In addition, some things are outright undocumented and missing from the API reference or documentation and require reading often-unfinished conversations on the mailing lists with no solution. The FFmpeg libraries have very little error handling, which means if you're a bad C developer like me you are required to recompile FFmpeg with debugging information unstripped so you can trace segfaults in gdb.
https://github.com/leandromoreira/ffmpeg-libav-tutorial/ is a better and more up-to-date tutorial than this one.