Populate stream-specific fields into an existing FileMetadata.
Appends codec name, pixel format, dimensions, frame rate, bit_rate, etc.
- Parameters
-
| demux | The demux context that owns the format_context. |
| out | Metadata struct to append into. |
Definition at line 398 of file VideoStreamContext.cpp.
400{
402 return;
403
404 out.attributes[
"video_codec"] = std::string(avcodec_get_name(
codec_context->codec_id));
406 out.attributes[
"video_codec_long_name"] = std::string(
codec_context->codec->long_name);
407 out.attributes[
"video_width"] =
width;
412
413 const char* pix_fmt_name = av_get_pix_fmt_name(
codec_context->pix_fmt);
414 if (pix_fmt_name)
415 out.attributes[
"video_pixel_format"] = std::string(pix_fmt_name);
416
418 out.attributes[
"video_color_range"] =
static_cast<int>(
codec_context->color_range);
420 out.attributes[
"video_colorspace"] =
static_cast<int>(
codec_context->colorspace);
422 out.attributes[
"video_color_trc"] =
static_cast<int>(
codec_context->color_trc);
424 out.attributes[
"video_color_primaries"] =
static_cast<int>(
codec_context->color_primaries);
425
428 return;
429
430 if (
stream->sample_aspect_ratio.num > 0 &&
stream->sample_aspect_ratio.den > 0) {
431 out.attributes[
"video_sar_num"] =
stream->sample_aspect_ratio.num;
432 out.attributes[
"video_sar_den"] =
stream->sample_aspect_ratio.den;
433 }
434
435 AVDictionaryEntry* tag = nullptr;
436 while ((tag = av_dict_get(
stream->metadata,
"", tag, AV_DICT_IGNORE_SUFFIX)))
437 out.attributes[std::string(
"video_stream_") + tag->key] = std::string(tag->value);
438}
Core::GlobalStreamInfo stream
std::vector< float > * out
double frame_rate
Average frame rate (fps).
uint32_t height
Source height in pixels.
uint32_t width
Source width in pixels.
AVCodecContext * codec_context
Owned; freed in destructor.
References codec_context, frame_rate, MayaFlux::IO::FFmpegDemuxContext::get_stream(), height, out, stream, stream_index, total_frames, and width.