[Ffmpeg-devel] Reading TAGS?

Mike Melanson mike
Fri Mar 30 23:34:27 CEST 2007


Wildex999 wrote:
> Hello, I'm trying to use the FFMPEG format reader for a poject I'm 
> working on, and I need to get the 4 byte(32-bit) tag/fourcc for a 
> video/audio codec after opening the stream, but it doesn't always return 
> a video tag, and never a readable audio tag. Am I doing something wrong, 
> or is there some functions I have to use?
> 
> Heres part of my code:
> av_open_input_file(&pFormatCtx, argv[i+1], NULL, 0, NULL) //Open file
> av_find_stream_info(pFormatCtx) //Read stream info
> cout << (char)(pFormatCtx->streams[ii]->codec->codec_tag);
> cout << (char)(pFormatCtx->streams[ii]->codec->codec_tag>>8);
> cout << (char)(pFormatCtx->streams[ii]->codec->codec_tag>>16);
> cout << (char)(pFormatCtx->streams[ii]->codec->codec_tag>>24);
> 
> */Not including error checking*/
> 
> I do sometimes get the right tags(SNOW, XVID, WMV3 etc) for video, but 
> the audio streams doesn't work, and some vidoe streams(MPEG being one) 
> doesn't return a tag =/

That's because MPEG files don't have tags, a.k.a. FourCCs (4-character 
codes). In Microsoft-oriented formats, audio tags are 16-bit numbers 
rather than alphanumeric FourCCs.

-- 
	-Mike Melanson




More information about the ffmpeg-devel mailing list