New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Newer codecs (svt_av1, rav1e, svt_hevc) #445
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #445 +/- ##
===========================================
+ Coverage 42.37% 48.30% +5.93%
===========================================
Files 129 128 -1
Lines 13276 9967 -3309
===========================================
- Hits 5626 4815 -811
+ Misses 7650 5152 -2498
Continue to review full report at Codecov.
|
src/FFmpegWriter.cpp
Outdated
@@ -462,6 +462,18 @@ void FFmpegWriter::SetOption(StreamType stream, std::string name, std::string va | |||
case AV_CODEC_ID_AV1 : | |||
c->bit_rate = 0; | |||
av_opt_set_int(c->priv_data, "crf", std::min(std::stoi(value),63), 0); | |||
if (strstr(info.vcodec.c_str(), "svt_av1") != NULL) { | |||
//av_opt_set_int(c->priv_data, "qp", std::min(std::stoi(value),63), 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be removed.
//av_opt_set_int(c->priv_data, "qp", std::min(std::stoi(value),63), 0); |
src/FFmpegWriter.cpp
Outdated
av_opt_set_int(c->priv_data, "forced-idr",1,0); | ||
} | ||
if (strstr(info.vcodec.c_str(), "rav1e") != NULL) { | ||
//av_opt_set_int(c->priv_data, "qp", std::min(std::stoi(value),255), 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same.
//av_opt_set_int(c->priv_data, "qp", std::min(std::stoi(value),255), 0); |
src/FFmpegWriter.cpp
Outdated
av_opt_set_int(c->priv_data, "speed", 7, 0); | ||
av_opt_set_int(c->priv_data, "tile-rows", 2, 0); | ||
av_opt_set_int(c->priv_data, "tile-columns", 4, 0); | ||
//av_opt_set(c->priv_data, "tile-row", "", 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's 'tile-row'? I saw it commented out in a few places.
src/FFmpegWriter.cpp
Outdated
if (strstr(info.vcodec.c_str(), "aom") != NULL) { | ||
// Hack to set tiles; libaom doesn have qp only crf | ||
av_opt_set_int(c->priv_data, "crf", std::min(std::stoi(value),63), 0); | ||
av_opt_set_int(c->priv_data, "tile-rows", 1, 0); // log2 of number of rows | ||
av_opt_set_int(c->priv_data, "tile-columns", 2, 0); // log2 of number of columns | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Hack to set tiles?" So if I'm understanding this right, when using the aom
codec:
// Encode with a CRF of 15 and.... (no? default?) tiling
writer.setOption(VIDEO_STREAM, "crf", 15)
// Encode with a CRF of 15 and tile-rows=1, tile-columns=2
writer.setOption(VIDEO_STREAM, "qp", 15)
Is that right? Feels a bit magical for my blood. Is there any reason to do it this way, instead of just setting the tile-*
values for aom
in the crf
option processing, the way it's done for rav1e
?
In my defence this was just a copy of my tests that I quickly included. That has to be changed. I only wanted that this finally is visible to other people and people can comment on it and improve it. |
I think the crf AND qp is simply a bug. I have to check. I think one should only use one of them. |
tiles are in rows and columns. Unfortunately the name of the option my not be the same for different encoders. |
Sorry about the delay. You might have noticed that I am somehow time restrained and this was another one of the times where I had to be somewhere else. |
This comment is misleading. Sorry. |
This reminds me the OpenShot/openshot-qt#3138 which is not an issue but the wrong interpretation of the right data by Windows 10. In mp4/mov the samples are calculated and duration of the last one is can be zero (it's normal). |
I don't use Windows. |
Can you provide the file sample (.mp4) ? |
The video audio Both calculations below is not correct! This is wrong calculations for example only! Thus you may see the fps as What number do you see as fps for the file in your system? To be honest, the MediaInfo shows constant FPS for the file. |
30.38961 fps both in VLC and when I import the file in openshot it show 2340 / 77. |
I don't know what OpenShot shows, but as you see every programmer tries to simplify the things and thus making mistakes. Feel free to make report to the VLC project. |
I think it is the last empty video frame. The track duration is 512 (or one video frame) too short. The fps is calculated by dividing the duration by the frame number but when calculating the duration the last empty frame is not taken into account while it is counted as a frame when calculating the frame count. |
I have uploaded this file to the YouTube and I don't know what are you talking about. There is no issues in the mentioned file. I think, Europe servers of YouTube are much closer to me. But if you have other results, try to ask the YouTube service itself, why it don't allow to you to upload this video. |
If it works I'm OK with that. |
@SuslikV Actually the first station where I would have to complain about showing the wrong fps would be Openshot. After importing that clip and then looking at the file properties (Video Details: Frame Rate:) it shows 2340 / 77. |
Just a mistake in OpenShot. You want to fix it, yourself? Edit: ...seems to be not. |
Merging now! Thanks Peter! |
|
||
if (AV_GET_CODEC_TYPE(video_st) == AVMEDIA_TYPE_VIDEO && AV_FIND_DECODER_CODEC_ID(video_st) == AV_CODEC_ID_RAWVIDEO) { | ||
#else | ||
ZmqLogger::Instance()->AppendDebugMethod("FFmpegWriter::write_video_packet", "frame->number", frame->number, "oc->oformat->flags & AVFMT_RAWPICTURE", oc->oformat->flags & AVFMT_RAWPICTURE); | ||
|
||
if (oc->oformat->flags & AVFMT_RAWPICTURE) { | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I know this is merged already, but I had one small question.) I guess it would be: do we really need the non-4.0 path here at all?
AVFMT_RAWPICTURE
was finally removed in 4.0, but it was marked deprecated waaaay back in 3.0, in this commit:
From: Luca Barbato <lu_zero@gentoo.org>
Date: Mon, 12 Oct 2015 14:06:07 +0000 (+0200)
Subject: avformat: Do not use AVFMT_RAWPICTURE
X-Git-Tag: n3.1-dev~97^2~347
X-Git-Url: http://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff_plain/34ed5c2e4d9b7fe5c9b3aae2da5599fabb95c02e
avformat: Do not use AVFMT_RAWPICTURE
There are no formats supporting it anymore and it is deprecated.
Update the documentation accordingly.
---
Clearly, even at that time it was already considered legacy code.
Meanwhile, at least in terms of the codec enum, AV_CODEC_ID_RAWVIDEO
has existed in its current form since FFmpeg 1.0 — and it only didn't exist before then, because that's when it was renamed from CODEC_ID_RAWVIDEO
to the AV_
prefix. But it's easily as old as dirt.
So, it sounds like that code we have to use with libavformat >= 58
is actually the code we should be using on all versions... or at the very least, all versions since 3.0 (libavformat 57) for sure. (And as far as I'm concerned, we should just stop supporting any version earlier than 3.0 — if not later.)
Is there something to recommend sticking with AVFMT_RAWPICTURE
in pre-4.0 code? Does it give us any advantage? Or is it just legacy code we could be rid of?
Initial changes to include new codecs