Skip to content
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

gbrp pixel format gets "End of file" error #827

Open
bczhc opened this issue Apr 28, 2024 · 4 comments
Open

gbrp pixel format gets "End of file" error #827

bczhc opened this issue Apr 28, 2024 · 4 comments

Comments

@bczhc
Copy link

bczhc commented Apr 28, 2024

Maybe a follow-up of #395. Demonstration file (audio muted).

Hello. I use ffmpeg x11grab to record lossless rgb videos like this:

ffmpeg -f x11grab -framerate "$framerate" -i "$DISPLAY" \
        -f pulse -i "$pulse_device" \
        -c:v libx264rgb -r "$framerate" ${=FF_ARGS} \
        -crf 0 \
        -preset ultrafast \
        -c:a libopus -b:a 96k \
        "$output_file"

But when using av1an, it gives "End of file" error during scene scanning.

~/screenrecord ❯ ~/av1an --sc-only -s scenes.json -i 1.mp4                                                                                                                                 07:50:46
INFO [av1an_core::context] Input: 2560x1440 @ 30.000 fps, GBRP, SDR
Scene detection
⠒ 00:00:01 ▕                                                                                                                                                      ▏   0%  0/300 (0 fps, eta unknown)
Error: End of file

Also, if hevc gbrp (Rext profile) is used, e.g.:

ffmpeg -i 1.mp4 -c:v hevc_nvenc -b:v 50M -pix_fmt gbrp 2.mp4

Then for 2.mp4, av1an gives the same error.

av1an --version:

av1an 0.4.1-unstable (rev e69826f) (Release)

* Compiler
  rustc 1.75.0-nightly (LLVM 17.0)

* Target Triple
  x86_64-unknown-linux-gnu

* Date Info
  Commit Date:  2024-04-23

* VapourSynth Plugins
  systems.innocent.lsmas : Not found
  com.vapoursynth.ffms2  : Not found
  com.vapoursynth.dgdecodenv : Not found
  com.vapoursynth.bestsource : Not found
@master-of-zen
Copy link
Owner

Try converting to yuv420p lossless with ffmpeg, or use vapoursynth script that use your video as input and converts to yuv420p, and set that script as input

@bczhc
Copy link
Author

bczhc commented Apr 28, 2024

Actually what does "yuv420p lossless" mean please? If I first convert it to yuv420p (or yuv420p10le) using ffmpeg, and then set it as the input of av1an, it will work.

For screenrecords I prefer rgb instead of yuv, and ffmpeg can do this. That's, these two ffmpeg commands will work:

# gbrp
ffmpeg -i 1.mp4 -c:v libaom-av1 -row-mt 1 -tile-rows 2 -tile-columns 2 -tune psnr -cpu-used 5 -crf 50 -threads 16 -pix_fmt yuv420p a.mkv

# yuv420p
ffmpeg -i 1.mp4 -c:v libaom-av1 -row-mt 1 -tile-rows 2 -tile-columns 2 -tune psnr -cpu-used 5 -crf 50 -threads 16 -pix_fmt yuv420p b.mkv

I used to hear of, that aomenc cannot output rgb videos, and this is a limitation of aomenc the CLI but not libaom-av1 the library which ffmpeg uses? May be related to aomenc?

@master-of-zen
Copy link
Owner

Actually what does "yuv420p lossless" mean please?

It means convert video with something like ffmpeg x264 yuv420p for compatible color space, and using crf 0 for lossless encoding, so there is no quality loss.

ffmpeg -i input -c:a copy -c:v libx264 -crf 0 -pix_fmt yuv420p input_for_av1an.mkv
will suffice

In case when ffmpeg gets RGB as input, it does the conversion internally

@bczhc
Copy link
Author

bczhc commented Apr 28, 2024

Yes, I tried and this worked.

ffmpeg -i 1.mp4 -c:a copy -c:v libx264 -crf 0 -pix_fmt yuv420p input_for_av1an.mkv
<ffmpeg outputs>
/mnt/nvme/av1/3 ❯ ~/av1an -i input_for_av1an.mkv                                19:46:30
INFO [av1an_core::context] Input: 2560x1440 @ 30.000 fps, YUV420P, SDR
Scene detection
INFO [av1an_core::context] scenecut: found 1 scene(s) [with extra_splits (300 frames): 1 scene(s)]
  00:00:02 ▕█████████████████████████████████████████▏ 100%  300/300 (133.32 fps, eta 0s)Queue 1 Workers 1 Passes 2
Params: --threads=8 --cpu-used=6 --end-usage=q --cq-level=30 --tile-columns=1 --tile-rows=0
/mnt/nvme/av1/3 ❯

Seems the error encounters only with RGB inputs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants