My understanding is that a codec is both a decoder and a specification for decoding. So some group writes a codec which explains how to decode from their format back into the raw bitstream, and they leave the encoding implementation up to anybody who wants to write a compatible encoder. Thus, for example, h.264 is a famous video codec (decoder) and x264 is a well-known FOSS encoder for h.264. But there are many other h.264 encoders.
My understanding is that VideoForLinux (V4L2) is a suite of kernel- and user-space libraries for working with streaming video on Linux machines.
My understanding is that ALSA is a suite of kernel- and user-space libraries for working with streaming audio on Linux machines.
If anything I have stated above is incorrect, please begin by correcting/clarifying me!
Assuming I'm more or less correct, then I'm failing to see what role (if any) V4L2 and ALSA have to play when trying to encode, compress and transmit audio and video bitstreams on a Linux machine.
If I could use x264 to encode my video stream, faac to encode my audio stream, and then
ffmpeg to compress, mux and transmit the two streams inside, say, an MPEG-TS container, then where do V4L2 and ALSA come into play?
And if the answer is "they don't", then could someone please give an example or two for when V4L2/ALSA would be used so I can put them into context and understand the use cases where they are required? Thanks in advance.