Skip to content

Commit

Permalink
Added Matroska other extensions. Fixed alpha_mode case. Added alpha_m…
Browse files Browse the repository at this point in the history
…ode to saving (works only with Matroska).
  • Loading branch information
ggarra13 committed Feb 19, 2024
1 parent ad60ed4 commit 63d1de5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/tlIO/FFmpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ namespace tl
{ ".flv", io::FileType::Movie },
{ ".m4v", io::FileType::Movie },
{ ".mkv", io::FileType::Movie },
{ ".mk3d", io::FileType::Movie },
{ ".mov", io::FileType::Movie },
{ ".mp4", io::FileType::Movie },
{ ".mpg", io::FileType::Movie },
Expand All @@ -215,6 +216,7 @@ namespace tl

// Audio Formats
{ ".aiff", io::FileType::Audio },
{ ".mka", io::FileType::Audio },
{ ".mp3", io::FileType::Audio },
{ ".ogg", io::FileType::Audio },
{ ".opus", io::FileType::Audio },
Expand Down
2 changes: 1 addition & 1 deletion lib/tlIO/FFmpegReadVideo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ namespace tl
if (string::compare(
key,
"alpha_mode",
string::Compare::CaseSensitive))
string::Compare::CaseInsensitive))
{
if (value == "1" && _avInputPixelFormat == AV_PIX_FMT_YUV420P)
{
Expand Down
11 changes: 10 additions & 1 deletion lib/tlIO/FFmpegWrite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,16 @@ namespace tl

p.avVideoStream->time_base = { rational.second, rational.first };
p.avVideoStream->avg_frame_rate = { rational.first, rational.second };

// \bug: this does not add alpha_mode to the .webm container
if (profile == Profile::VP9)
{
if (pix_fmt == AV_PIX_FMT_YUVA420P)
{
av_dict_set(
&p.avVideoStream->metadata, "alpha_mode", "1", 0);
}
}

for (const auto& i : info.tags)
{
av_dict_set(&p.avFormatContext->metadata, i.first.c_str(), i.second.c_str(), 0);
Expand Down

0 comments on commit 63d1de5

Please sign in to comment.