Commit Graph

8292 Commits

Author SHA1 Message Date
Martin Pulec
00ddaec63c added file display module
just a simple, video only, display at the moment
2023-09-01 13:50:50 +02:00
Martin Pulec
f2e5350561 configure.ac: convert ADD_MODULE to sh function
Shell functions are more convenient and easier to work with (without
the knowledge of M4 and the autoconf stuff).
2023-09-01 13:40:23 +02:00
Martin Pulec
5e525dbe0e lavc video: try_open_remaining_pixfmts - do not crash on pix_fmts==NULL
Do not crash on codec->pix_fmts == NULL in try_open_remaining_pixfmts.

This can occur eg. for h264_v4l2m2m encoder on RPi.
2023-08-28 10:18:56 +02:00
Martin Pulec
efe73aad41 configure.ac: incl -latomic on 32b aarch64 builds
\-latomic is needed to prevent errors:
```
undefined reference to `__atomic_load_8'
````
even if target_cpu is aarch64 but building on 32-bit Raspberry Pi OS
(which is still default).
2023-08-28 09:38:26 +02:00
Martin Pulec
49c859b8c2 lavc video: use aux_data also for extradata
it simplifies the things
2023-08-25 11:54:34 +02:00
Martin Pulec
4a745780e2 lavc video: header_inserter - support HEVC
\+ ignore leading AUD NALU if present (add own 4B start code instead) -
it could have produced problems when AUD+SPS+PPS is prepended to regular
frame that is not an IDR frame
2023-08-25 11:54:33 +02:00
Martin Pulec
c185014766 lavc video: added header_inserter option
The option solves a problem with streams that do not correctly prepend
video headers, namely (and currently only implemented) SPS/PPS in
H.264 stream. Support for HEVC can be added later.
2023-08-25 11:54:29 +02:00
Martin Pulec
972355db8e lavc video AMF: default usage to ultralowlatency
for H.264 and HEVC, AV1 has only lowlatency

t should be mostly the same, see pg. 16 of
[AMF_Video_Encode_API.pdf]. There is just some mysterious
AMF_VIDEO_ENCODER_LOWLATENCY_MODE option that is enabled by this.

[AMF_Video_Encode_API.pdf]:
https://github.com/GPUOpen-LibrariesAndSDKs/AMF/blob/v1.4.28/amf/doc/AMF_Video_Encode_API.pdf
2023-08-24 15:16:09 +02:00
Martin Pulec
e2f0bb34d7 lavd video: removed parser
This effectively reverts recent commit d70e2fb3 (from 15th Aug).

The use of parser seems to be a problem for UG workflow, in the end -
the point is that it may cache a packet until arival of next packet
(commit 6e9a4142), so in that commit, as a solution flushing with EOF
was added.

However, it seems to produce problems with simple (but not with H.264 parser):
```
uv -d gl -t  testcard -c libavcodec:encoder=libx265
```
because the parser seems to be confused when parsing frames after EOF
so for the subsequent frames it consumes 1 byte producing 1 byte output. This
is mostly harmless (it is actually '\0', part of the start code), but
it produces errors:
```
[lavc hevc @ 0x68216c0055c0] missing picture in access unit with size 1
```

Possible solution would be to re-create the parser for every frame
(sic!) but it is unclear the overhead (which applies also to parsing the
frames, anyways). Anyways, as piggy-backed frames should not occur since
the commit c57f2fc5, it is perhaps best to remove this stuff altogether.
2023-08-23 16:51:04 +02:00
Martin Pulec
09488b085e lavc check_av_opt_set: simplified
Actually all options can be passed as a c-string with av_opt_set(),
which then converts it to a correct type. So use to_string to convert
non-cstrings to std::string.
2023-08-23 14:49:26 +02:00
Martin Pulec
8db1db9d61 lavc video AMF: set default RC to CQP 2023-08-23 14:14:40 +02:00
Martin Pulec
3543f187f1 CI Linux FFmpeg: enable Vulkan 2023-08-23 14:14:40 +02:00
Martin Pulec
8922476204 Revert "CI Linux: use Vulkan directy from repo"
FFmpeg Vulkan support requires at least Vulkan headers v1.3.238 but
Ubuntu 20.04 has only 1.2.131.

This reverts commit 8cb7e7e779.
2023-08-23 14:14:40 +02:00
Martin Pulec
945e2e9841 vidcap testcard: fixed opt shortcut for pattern
`-t testcard:p=noise` didn't work
2023-08-23 14:14:40 +02:00
Martin Pulec
bfa197a98c configure.ac: summary - fixed alhabetical order 2023-08-23 14:14:34 +02:00
Martin Pulec
ecf1ed6fef lavd video: set dav1d default for AV1
The dav1d decoder is performing better than the reference AOM
implementation that would be selected otherwise.
2023-08-22 16:51:46 +02:00
Martin Pulec
9e996bd37d lavc video: set header insertion for av1_amf
Set to "gop" as with HEVC, for av1_amf, it is also possible to set to
"frame" (unsure if better).
2023-08-22 16:51:46 +02:00
Martin Pulec
9b25da71a2 show_encoder_help: don't double print default opt
some codecs have alread default value in the description, eg. profile
- _Set the profile (default main)_, thus it is unneeded to print the
information second times.

\+ do not print float default vals with "F" suffix because it can be a
little bit misleading, indicate the type in braces instead
2023-08-22 16:51:28 +02:00
Martin Pulec
eb88c64d3b lavc vid: show_encoder_help simplified 2023-08-22 16:51:17 +02:00
Martin Pulec
6104131316 lavd video: debug print parsed pict_type
Only if could not decompress frame, otherwise picture type is printed
in decompress duration summary (also in debug mode).
2023-08-22 15:29:13 +02:00
Martin Pulec
9fb2c63257 ipc_frame_unix.cpp: print init errors 2023-08-22 10:47:06 +02:00
Martin Pulec
6d4ab5d472 configure.ac: --enable-object missing global replace 2023-08-22 09:54:42 +02:00
Martin Pulec
d2f8f2df8b lavc video: avoid nullptr dereference
When `--param keep-pixfmt` is used but the encoder doesn't produce a
packet (AVPacket.size == 0), nullptr dereference can occur.

fixes CID 416601
2023-08-22 08:57:56 +02:00
Martin Pulec
18c55c1191 configure: do not prefer qmake6 over qmake
See also previous commit - if Qt6 is installed in macOS, _qmake6_ is
linked to _/usr/local/bin_.
2023-08-21 14:43:09 +02:00
Martin Pulec
47b1abfd93 CI mac: enforce use of Qt5 even if Qt6 present
fixes failed run
<https://github.com/CESNET/UltraGrid/actions/runs/5925739298/job/16065753514>

From some point, it seems that Qt6 (Homebrew port _qt_) is already
installed but it doesn't bundle successfully. So enforce using Qt5
(previous symlink command didn't replace the `/usr/local/opt/qt` symlink
if already present).

\+ copy the link instead of linking it to prevent:

    Error: /usr/local/opt/qt@5 is not a valid keg
2023-08-21 14:29:24 +02:00
Martin Pulec
4e16bab401 DELTACAST: VideoMaster 6.21 compat
VHD_BOARDTYPE_HDMI is neither deprecated in 6.21, nor
VHD_BOARDTYPE_HDMI_DEPRECATED is defined anymore.
2023-08-21 12:08:12 +02:00
Martin Pulec
5f229e66bf CI FFmpeg Linux: use NV headers 12.0
This implies driver version 520 in Linux.

That driver is not avaiable on Kepler cards (1st generation supporting
NVENC), which is almost 10 years old and only basic H.264 was supported
there.

This SDK version allows acceleration of AV1 on supported cards (GeForce
40 series - Ada Lovelace).
2023-08-21 11:34:48 +02:00
Martin Pulec
989d732d80 lavd video: fixed parsing workflow
(see also previous 2 commits)

Fixed according to [FFmpeg decode video example] - the parser needs
final call with zero long buffer to flush the frame.

\+ prefix eventual parser error with identifying prefix

[FFmpeg decode video example]:
https://github.com/FFmpeg/FFmpeg/blob/master/doc/examples/decode_video.c
2023-08-21 11:34:48 +02:00
Martin Pulec
6e9a4142fd Revert "lavd video: don't print false positive errs"
This reverts commit d4be2d97b5.

The fix was not correct, because it just hided the root of the problem -
the av_parser_parse2 needs final call with buf_size == 0 to flush last
frame. Otherwise it will remain in the queue, effectivelly adding a
delay by one frame, because the particular frame will get flushed when
processing next frame.

See also:
<https://github.com/FFmpeg/FFmpeg/blob/master/doc/examples/decode_video.c>
2023-08-21 11:34:45 +02:00
Martin Piatka
94740e221c screen_pw: Fix out_ptr segv
g_variant_get is a varargs function, which doesn't seem to play well
with out_ptr. Call the type conversion operator explicitly
2023-08-18 15:33:14 +02:00
Martin Piatka
1e6bbbee9f screen_pw: Replace frame_wrapper by unique_ptr 2023-08-18 15:29:27 +02:00
Martin Pulec
d4be2d97b5 lavd video: don't print false positive errs
do not print errors like:

    uv -d dummy -t testcard -c libavcodec
    [lavd] Error while decoding frame (rc == 42836): Error number 42836 occurred.

when decoder returns empty packet ("error" code acutally indicated number
of consumed bytes).
2023-08-18 12:57:00 +02:00
Martin Pulec
732441f07a cineform dec.: removed needless frame_seq storing 2023-08-18 12:25:41 +02:00
Martin Pulec
12364a9025 lavd video: removed handling of dropped VP8 frms
removed skipping P frames after missing P frame in VP8

This doesn't seem to be needed anymore and removing it simplifies the
code a bit. Moreover, if frame drops was the case, now frames, that
have been skipped until now will be presented, potentially reducing
twitching.
2023-08-18 12:25:41 +02:00
Martin Pulec
2179179b77 video compress sync frame API: follow tile API
Updated sync frame API to match updated tile API as defined by the
commit  e9a407ad.

Note: none of 2 compression using this API currently need reading
additional frames.
2023-08-18 12:25:40 +02:00
Martin Pulec
3943cc739d video compress async tile: removed frame erasing
There was a comment that the frame is no longer valid, which was a bit
misleading, because the the tiles hold reference to that frame but do
not modify it in any way.

Also removed assigning NUL altogether - it was not much functional,
since it will be released soon thereafter, anyways, so it is possibly
not much needed.
2023-08-18 12:25:40 +02:00
Martin Pulec
c57f2fc57b lavc video: read frames consecutively
Read and send the frames consecutively, even though the encoder presents
them at once (see previous commit description).
2023-08-18 12:25:33 +02:00
Martin Pulec
690244686a Compress sync tile API: fetch additional frames
Modified the API in order to fetch additional frames from compression
with iterative passing NULL pointer (similarly as for audio).

This is particularly usefull when inter-frame compression outputs 2
frames at once, which can occur when B-frames would be enabled. It,
however sometimes happen even when B-frames are disbled, eg. with
h264/hevc_mf HW encoder on AMD (AMDh265Encoder; see commit d70e2fb3c).

Please note that semantic of passing NUL frame is different in this API
to that in async API, where it works as a poison pill.
2023-08-18 11:07:57 +02:00
Martin Pulec
f035e43ac5 lavc video: store/restore metadata reliably
In case that the encoder buffers frame for whatever reason (NVENC
with delay, hevc_mf sometimes batching 2 frames /returned frames count
0,1,2,0,1,2.../) so that output frame doesn't match the currently
enqueued onei, metadata would be incorrect (currently enqueued copied
to non-matching dequeued one).
2023-08-16 16:10:48 +02:00
Martin Pulec
ffa749eb4f lavd video: do not fail if parser init fails
some codecs (FFV1, HFYU) do not have parsers
2023-08-16 15:38:14 +02:00
Martin Pulec
e5b3f5ffa6 lavd video: do not crash if FFV1/HFYU init fails 2023-08-16 15:38:13 +02:00
Martin Pulec
d70e2fb3c1 lavd video: parse the received video buffer
use AVParser for the received compressed data

This is particularly useful when encoder produces frames glued together -
it shouldn't be the case most of the times, since UG programmatically
disables B-frames but there can be some not handled encoders, notably
currently problematic _hevc_mf_ on AMD (AMDh265Encoder).

The FFmpeg native H.264 and HEVC decoders are particuraly sensitive to
passing 2 encoded frames at once, breaking the picture with errors like:

    [lavc hevc @ 0x61c590004d80] Two slices reporting being the first in the same frame.
    [lavc hevc @ 0x61c590004d80] Could not find ref with POC 7

or

     [lavc h264 @ 0x6ee80c004d80] Frame num change from 3 to 4
     [lavc h264 @ 0x6ee80c004d80] decode_slice_header error

After this fix, decoding is correct. Excess frames are dismissed but
decoding works and more importantly, user is informed what is the
problem.
2023-08-15 16:27:06 +02:00
Martin Pulec
4fbe76085e lavd_flush: print error msgs, not only numbers 2023-08-15 16:26:59 +02:00
Martin Pulec
aaf8ff9771 lavd decode: H.264/HEVC - read forced props early
Moved reading eventual forced props at the beginning. Previously, it
must have been waited until first IDR, which is unecessary, because the
custom NAL unit is appended to every frame.

Also it is not needed to read it in all compressions since it is
codec-specific and thus as implemented now, it is only applicable to
H.264/HEVC.
2023-08-15 15:39:35 +02:00
Martin Pulec
f36384247a lavd video: moved usable decoder select to func
Mostly refactor only (just changed bound-checking if-s to assert because
the condition should not happen - it is not depending on user input).
2023-08-15 15:39:31 +02:00
Martin Piatka
e58c6a98f0 conference: fps is optional 2023-08-15 13:08:13 +02:00
Martin Piatka
59f04ba511 configure.ac: Add missing audio filter playback 2023-08-15 13:08:13 +02:00
Martin Piatka
9e92834ea1 rpi4_out: Use out_ptr 2023-08-15 13:08:12 +02:00
Martin Piatka
6679bc7de1 conference: Use out_ptr 2023-08-15 13:08:12 +02:00
Martin Piatka
ddf64f32cf hd-rum-recompress: Use out_ptr 2023-08-15 13:08:12 +02:00