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
update FFmpeg to version 5.1 #627
Conversation
I have merged this into devel/ffmpeg-resync |
I have cherry-picked these two commits into devel/ffmpeg-resync |
I have cherry-picked the two new commits into devel/ffmeg-resync |
@bennettpeter I am now satisfied with the changes. Remember, you will need to revert 88632cd before merging back into master. |
@kmdewaal Could you test this attached patch with either this pull request or devel/ffmpeg-resync to test if https://trac.ffmpeg.org/ticket/9532 is still a bug? Apply the patch in the |
I have cherry-picked these three commits. I have found a bug when playing an mpeg-2 recording that has no seek table. If an mpeg-2 recording is put in the video directory or an mpeg-2 recording's seek table is removed, then playback shows video length of 0 and does not allow any skip forward, not does it resume from a bookmark that was set previously. I don't know when this started, but it happens of devel/ffmpeg-resync and does not happen on master. It happens also before these latest three commits. A different file shows recording length 4281 hours, and another shows recording length 146 hours. These can skip forward but the progress bar is wrong. The problem is actually with transport stream files rather than mpeg-2. mpeg-4 (h264) ts recordings placed in the videos directory have the same problem. We have had this issue before but I cannot remember what the fix was or who fixed it. |
I fixed it before. The problem was you were using the original FFmpeg mpegts demuxer. However, FFmpeg looks for "mpegts" which is our version and our customization needed to be extended to look for "mpegts-ffmpeg". I can confirm the bug with my video samples and the FFmpeg demuxer and will investigate. |
c142145
to
0344545
Compare
I had fixed it in b105b07 but part of the customization was lost in the move from utils.c to demux.c. See the new commit for the fix. |
0344545
to
4a2f296
Compare
This fixes the problem. |
There was a cryptic message from git saying that two cherry-picks had been dropped because they were duplicate but I could have specified some option in my settings to keep the comments that went with them, or something to that effect. |
Scott, I updated v4l2_request ffmpeg code to ffmpeg5.1 and give run test for current ffmpeg-resync branch on v4l2_request platforms (Allwinner/Rockchip). it works ok for mpeg2/hevc/vp8 content. Below is gdb trace:
|
@warpme I suspect my change over to the new channel layout API. Try this:
However, the code as is should work, unless there is a non-NULL terminated list (array) of If the above patch doesn't work, a trace with debug symbols for libmythtv and libmythavutil would be necessary. |
Scott, |
@bennettpeter New commit. @warpme I still feel that However, from skimming your v4l2_request patch I couldn't find any reference to I had tested my |
I have cherry-picked the latest commit f813141 |
Scott, I was testing and getting segfaults on highly optimised aarch64 build (-O3, LTO, neon-fp) with latest gcc compiler (gcc12.2) - but i don't think this might be root cause. When i was trying to correlate content specs->segfault - segfaults are for sure on TV channel i'm frequently watching (TVN). So maybe issue is by speciffic TV channel? |
Piotr, Your sample plays fine for me as a video, even with the following patch to test
So if you are still getting segmentation faults, I would need a new stack trace. This sample had AC-3 audio instead of MP2. FFmpeg's AC-3 decoder does support downmix. However, I am getting a segmentation fault with my patch and another sample from you that has MP2 audio, so |
Scott, Pls find trace from current ffmepg-resync with applied #627 (comment) and without #627 (comment) Segfault was for playing sample: http://warped.inet2.org/h264-TVN_1080i_25fps.ts pls let me know is this sufficent for you. |
Piotr, I meant a stack trace from the current devel/ffmpeg-resync if that still has segmentation faults. I know Further investigation did not reveal anything and I failed to create a minimal example that segfaulted, so I don't know why it was segfaulting. Since I have replaced the failing code, I will not investigate that anymore. |
Ah - current ffmpeg-resync has applied f813141 I rebuild with ffmpeg-resync f813141 and done tests. Results:
|
Next steps: Is everybody ready for this? Anything still to be done before I proceed? |
Wiadomość napisana przez Peter Bennett ***@***.***> w dniu 16.09.2022, o godz. 18:56:
Next steps:
Remove buildffmpeg.yml
rebase devel/ffmpeg-resync on master
merge devel/ffmpeg-resync into master
Is everybody ready for this? Anything still to be done before I proceed?
Peter,
Perfectly fine for me :-)
|
FFmpeg has split their version.h into version_major.h and version.h. libavutil has an empty version_major.h.
To satisfy -fpermissive
This code was removed between FFmpeg 4.4 and 5.1.
Modeled after the audio code. I hope it works.
to satisfy -fpermissive
codec_info_nb_frames was a private member of AVStream and is now a member of the private FFStream so we can't use it. However, the RealVideo codecs are not used for TV broadcasts, so we don't care.
FFmpeg constified its `AVInputFormat*`s to `const AVInputFormat*` causing this to raise an -fpermissive error.
pts_wrap_bits no longer exists and cur_dts was moved to the private FFStream since it was a private member of AVStream
This is just for logging, so remove it.
Trying to satisfy -fpermissive.
I don't think the option "pred" exists anymore. Copy av_encode_video2 replacement from io/mythavformatwriter.cpp
to make it compile since it is now part of FFStream instead. av_stream_get_parser() has existed since FFmpeg 2.3 to expose this private member of AVStream.
FFmpeg constified AVCodec* and others.
FFmpeg removed it since it duplicated libswresample.
MythTV did not use it and FFmpeg has removed it since it duplicated libswresample.
Replace the uses of AVCodecContext::request_channel_layout, which only did something for a limited number of codecs. The deprecation message was: `@deprecated use "downmix" codec private option`. All `AudioOutput`s can and *must* downmix, otherwise the code will present non-downmixed audio, since the "downmix" option only exists for a select few codecs, e.g. AC-3.
FFmpeg 5.1 does not define these preprocessor MACROs.
…ts demuxer I had fixed this previously, but the change must have been lost in the move from utils.c to demux.c.
since it was causing segmentation faults in FFmpeg. Restore the prior switch case with two additions that also support the "downmix" option: MLP (Meridian Lossless Packing) DTS Coherent Acoustics (DCA, also just referred to as DTS) This should also be faster, since it doesn't have to iterate over any lists (arrays) of `AVOption`s.
330c922
to
176a5c6
Compare
Since you are rebasing, in the interactive rebase just drop 9f0e8b4 .
I have rebased this pull request onto master if you want to compare the rebased devel/ffmpeg-resync to it. (My rebase skipped 399c942 due to it already being in master.)
I'm ready and fine with it as it is. |
Thank you for all the hard work. I have rebased devel/ffmpeg-resync and merged into master. |
@bennettpeter It compiles but I'm not really satisfied with some of the changes, particularly replacing the removed, deprecated
av_encode_video2
. I just copied the code from the audio version, but I don't use the transcode functionality so I couldn't test it.I also disabled the dts seeking hack, see 1962fae , and it seems to still work in my testing.
The
const
ification of AVCodec, etc., was annoying to fix but a reasonable change.There are many, many new deprecation warnings I have not rectified, but I think should be fairly trivial. However, I wanted the "just compile it" part reviewed first.
Checklist