1 year ago

#177857

test-img

Tomás Álvarez

Where is codec_tag coming from in libavcodec's AVCodecContext?

In libavcodec 3.3.9, the structure AVCodecContext contains several fields, two of them being codec_tag and codec_id. I know codec_id's value comes from an enum and it is used to identify the codec.

I cannot find exactly how codec_tag is working without going through libavcodec source code. I have two different streams that have ac3 audio. One of them has codec_tag 0x06 and the other one 0x332d4341.

Running ffprobe for both streams yields the following information for the targeted audio channel:

For the one with tag 0x06

Stream #0:3[0x7d5](deu): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, 5.1(side), fltp, 448 kb/s

For the other one:

Stream #0:3[0x8b2](dut): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 384 kb/s

If I try to receive the second one into a file using ffmpeg and -codec copy, and then ffprobe the resulting file, I get:

Stream #0:1[0x101](dut): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s

In all of this cases the codec_id field still remains the same one, AV_CODEC_ID_AC3.

My questions are:

  • how is libavcodec determining codec_tag?
  • why does it change when I receive the stream copying the codecs?

ffmpeg

libav

libavcodec

0 Answers

Your Answer

Accepted video resources