Determining codec name from VideoCodecId and AudioCodecId

I’ve been looking through the server-side API and in the IMedia section I see the getPublishVideoCodecId and getPublishAudioCodecId calls. Both of these calls return an int. How do I translate that int into the name of the codec?

Take a look at IVHost.CODEC_VIDEO_*

And you can use FLVUtils.getVideoCodecToString(int)

Richard

I’ve been looking through the server-side API and in the IMedia section I see the getPublishVideoCodecId and getPublishAudioCodecId calls. Both of these calls return an int. How do I translate that int into the name of the codec?

Returns:

codec id IVHost.CODEC_VIDEO_*

Check IVHost for definitions of audio and video codecs. You have to enumerate theese if you need a String.

It is in the version of the server-side api that I have.

Richard

Tit,

I’m not sure, but the version running on this machine is 3.1.1

Richard

rrlanham: getVideoCodecToString is undocumented (the only mention I found was on one or two wowza forum threads). API pdf or javadoc are both without it.

Ok,

this needs updating: https://www.wowza.com/resources/WowzaMediaServer_ServerSideAPI.pdf :slight_smile:

I’ll ignore the javadoc, as I’m running 3.0.6 because of EC2 requirements :). In which version was the method added, if you have that information?

Best,

Tit

Returns:

codec id IVHost.CODEC_VIDEO_*

Check IVHost for definitions of audio and video codecs. You have to enumerate theese if you need a String.

It looks like this should contain the info I need, but it also looks like the onPublish method must be too early to call it, as I’m getting audioCodecId and videoCodecId of -1. Where would be the appropriate place in the overall flow to call this?

Better yet, when I look though Eclipse’s log output I see lines like:

INFO server comment - MediaStreamMap.getLiveStreamPacketizer: Create live stream packetizer: cupertinostreamingpacketizer:1084563

INFO server comment - CupertinoPacketHandler.startStream[liverecord/definst/1084563]

INFO server comment - LiveStreamPacketizerCupertino.handlePacket[liverecord/definst/1084563]: Video codec:H264 isCompatible:true

INFO server comment - LiveStreamPacketizerCupertino.handlePacket[liverecord/definst/1084563]: Audio codec:AAC isCompatible:true

INFO server comment - LiveStreamPacketizerCupertino.handlePacket[liverecord/definst/1084563][mp4a.40.2]: AAC Audio info: {AACFrame: size: 0, rate: 44100, channels: 2, samples: 1024, errorBitsAbsent: true, profileObjectType: “LC”}

INFO server comment - MediaStreamMap.getLiveStreamPacketizer: Create live stream packetizer: smoothstreamingpacketizer:1084563

INFO server comment - LiveStreamPacketizerSmoothStreaming.startStream[liverecord/definst/1084563]

INFO server comment - LiveStreamPacketizerCupertino.handlePacket[liverecord/definst/1084563][avc1.66.30]: H.264 Video info: {H264CodecConfigInfo: profile: “Baseline”, level: 3.0, frameSize: 640x480, displaySize: 640x480, PAR: 1:1, frameRate: 24.0}

I would dearly love to be able to write this info into a database. Two questions: 1) I assume this info is only available for streams that are coming via RTMP, is that correct? That would be ok as at present all of my live streams are RTMP; I’ll worry about getting that info for stream that come in via RTSP later; and 2) can I access that information somehow, short of having to parse the log file?

FOLLOWUP:

I added calls to getPublishVideoCodecId() and FLVUtils.videoCodecToString() in my onStreamCreate, onMediaStreamCreate, and onPublish methods, and in every case they get audio and video codec IDs of -1. Where should I be making these calls?