russelltg / wl-screenrec

High performance wlroots screen recording, featuring hardware encoding
Apache License 2.0
266 stars 9 forks source link

Unable to build [no variant or associated item named / no field `time_base`] #2

Closed mailhost closed 1 year ago

mailhost commented 1 year ago

Cool project and would like to give this a try, just having a build failure.

podman run -ti --entrypoint=/bin/bash docker.io/library/rust:1.66.1
apt install libavutil-dev libavformat-dev libavfilter-dev libavdevice-dev libclang-dev
cargo install --git https://github.com/russelltg/wl-screenrec

as well as...

git clone https://github.com/russelltg/wl-screenrec.git
cd wl-screenrec
rustup toolchain install stable-x86_64-unknown-linux-gnu
rustup run stable cargo build --release

Yields

Compiling wl-screenrec v0.1.0 (/build/wl-screenrec)
error[E0609]: no field `time_base` on type `AVFrame`
   --> src/main.rs:302:42
    |
302 |                     (*surf.as_mut_ptr()).time_base.num = 1;
    |                                          ^^^^^^^^^ unknown field
    |
    = note: available fields are: `data`, `linesize`, `extended_data`, `width`, `height` ... and 49 others

error[E0609]: no field `time_base` on type `AVFrame`
   --> src/main.rs:303:42
    |
303 |                     (*surf.as_mut_ptr()).time_base.den = 1_000_000_000;
    |                                          ^^^^^^^^^ unknown field
    |
    = note: available fields are: `data`, `linesize`, `extended_data`, `width`, `height` ... and 49 others

error[E0599]: no variant or associated item named `VAAPI` found for enum `Pixel` in the current scope
   --> src/main.rs:668:31
    |
668 |         enc.set_format(Pixel::VAAPI);
    |                               ^^^^^ variant or associated item not found in `Pixel`

error[E0599]: no variant or associated item named `VAAPI` found for enum `Pixel` in the current scope
   --> src/main.rs:866:47
    |
866 |             (*hwframe_casted).format = Pixel::VAAPI.into();
    |                                               ^^^^^ variant or associated item not found in `Pixel`

error[E0599]: no variant or associated item named `VAAPI` found for enum `Pixel` in the current scope
   --> src/main.rs:960:37
    |
960 |         out.set_pixel_format(Pixel::VAAPI);
    |                                     ^^^^^ variant or associated item not found in `Pixel`
russelltg commented 1 year ago

Interesting, what ffmpeg version is this?

russelltg commented 1 year ago

Can repro in that container

russelltg commented 1 year ago

The first one is fixable, and I should be able to fix it in the next few days. But I think I require libavutil >= 57, and that container has 56.

mailhost commented 1 year ago

Very good, I have it built and working now with ffmpeg-5.1.2 (libvutil 57). Looks I was building with ffmpeg-4.4.3 previously.

russelltg commented 1 year ago

Excellent!