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

Reg input video formats supported #1278

Closed
gopi77 opened this issue Jan 2, 2025 · 9 comments
Closed

Reg input video formats supported #1278

gopi77 opened this issue Jan 2, 2025 · 9 comments
Labels
state:Done This issue has been resolved/dismissed type:Bug Something isn't working

Comments

@gopi77
Copy link

gopi77 commented Jan 2, 2025

Hi
I'm able to provide a mp4 input file, and it works fine.
Ubuntu 24, Command Line:
video2x -i ducks_take_off_1920x1080_50Hz_8bit_P420.mp4 -o output.hevc -p libplacebo -w 3840 -h 2160 -c libx265

I'm looking for support to provide hevc as input.
Also would like to know the other input video formats supported by this project (Ex: yuv/y4m files).

@github-actions github-actions bot added the state:Backlog This issue will be worked on in the future label Jan 2, 2025
@k4yt3x
Copy link
Owner

k4yt3x commented Jan 2, 2025

Theoretically all formats FFmpeg supports are supported by Video2X, since it uses the FFmpeg C libraries. The HEVC codec should already be supported, also raw HEVC streams:

image

...although I don't quite get why you don't want to put it in a container.

@gopi77
Copy link
Author

gopi77 commented Jan 2, 2025 via email

@k4yt3x
Copy link
Owner

k4yt3x commented Jan 2, 2025

You can see my screenshot

@gopi77
Copy link
Author

gopi77 commented Jan 3, 2025

I tried as per your screenshot, but got an output which is just 175kb file and not an actual video.
Please check & help.

video2x -i output_4k.hevc -o output_hd.hevc -e crf=20 -e preset=slow -p libplacebo -w 1920 -h 1080 --libplacebo-shader anime4k-v4-a -c libx265 --no-copy-streams
[2025-01-03 10:01:14] [info] Video2X version 6.3.1
[2025-01-03 10:01:14] [info] Processing file: output_4k.hevc
[2025-01-03 10:01:14] [info] Using Vulkan device: NVIDIA GeForce GTX 1070 (0x1b81)
[2025-01-03 10:01:14] [info] Press [space] to pause/resume, [q] to abort.
x265 [info]: HEVC encoder version 3.5+1-f0c1022b6
x265 [info]: build info [Linux][GCC 13.2.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x265 [info]: Main profile, Level-4.1 (Main tier)
x265 [info]: Thread pool created using 8 threads
x265 [info]: Slices : 1
x265 [info]: frame threads / pool features : 3 / wpp(17 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge : star / 57 / 3 / 3
x265 [info]: Keyframe min / max / scenecut / bias : 25 / 250 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt : 25 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb : 1 / 1 / 0
x265 [info]: References / ref-limit cu / depth : 4 / on / on
x265 [info]: AQ: mode / str / qg-size / cu-tree : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress : CRF-20.0 / 0.60
x265 [info]: tools: rect limit-modes rd=4 psy-rd=2.00 rdoq=2 psy-rdoq=1.00
x265 [info]: tools: rskip mode=1 signhide tmvp strong-intra-smoothing lslices=4
x265 [info]: tools: deblock sao
[2025-01-03 10:01:14.786] [warning] Option 'colorspace' is not supported by the buffer filter.
[2025-01-03 10:01:14.786] [warning] Option 'range' is not supported by the buffer filter.
[2025-01-03 10:01:14.788] [warning] Estimating the total number of frames using duration * fps
[2025-01-03 10:01:14.788] [warning] Unable to determine the video's duration
[2025-01-03 10:01:14.788] [warning] Unable to determine the total number of frames
frame=497/0 (0.00%); fps=16.03; elapsed=00:00:31; remaining=00:00:00x265 [info]: frame I: 1, Avg QP:27.80 kb/s: 69059.60
x265 [info]: consecutive B-frames: 100.0% 0.0% 0.0% 0.0% 0.0%

encoded 1 frames in 31.60s (0.03 fps), 69059.60 kb/s, Avg QP:27.80
frame=497/0 (0.00%); fps=16.03; elapsed=00:00:31; remaining=00:00:00
[2025-01-03 10:01:46] [info] Video processed successfully
====== Video2X Processing summary ======
Video file processed: output_4k.hevc
Total frames processed: 497
Total time taken: 00:00:32
Average processing speed: 15.53 FPS
Output written to: output_hd.hevc
<<<

@k4yt3x
Copy link
Owner

k4yt3x commented Jan 3, 2025

Hmm I think the timestamp got messed up when it tries to process the hevc file. I'll investigate.

@k4yt3x k4yt3x added state:InProgress This issue is being worked on type:Bug Something isn't working and removed state:Backlog This issue will be worked on in the future type:Question labels Jan 3, 2025
@k4yt3x
Copy link
Owner

k4yt3x commented Jan 4, 2025

@gopi77 I did some tests, it turns out the issue isn't with the PTS, but that libplacebo always return AVERROR(EAGAIN) except for one frame:

image

Other filters that don't have this mechanism don't have this problem. You should be able to process with Real-ESRGAN, Real-CUGAN, and RIFE just fine. I'll look into why libplacebo has these problems.

@gopi77
Copy link
Author

gopi77 commented Jan 4, 2025

Thanks, it works.

The command line:
video2x -i ducks_take_off_1920x1080_50Hz_8bit_P420.hevc -o output_hevc_HD_to_4k.hevc -p realesrgan -s 2 -c libx265
[2025-01-04 11:17:05] [info] Video2X version 6.3.1
[2025-01-04 11:17:05] [info] Processing file: ducks_take_off_1920x1080_50Hz_8bit_P420.hevc
[2025-01-04 11:17:05] [info] Using Vulkan device: NVIDIA GeForce GTX 1070 (0x1b81)
[2025-01-04 11:17:05] [info] Press [space] to pause/resume, [q] to abort.
x265 [info]: HEVC encoder version 3.5+1-f0c1022b6
x265 [info]: build info [Linux][GCC 13.2.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x265 [info]: Main profile, Level-5.1 (Main tier)
x265 [info]: Thread pool created using 8 threads
x265 [info]: Slices : 1
x265 [info]: frame threads / pool features : 3 / wpp(34 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge : hex / 57 / 2 / 3
x265 [info]: Keyframe min / max / scenecut / bias : 25 / 250 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb : 1 / 1 / 0
x265 [info]: References / ref-limit cu / depth : 3 / off / on
x265 [info]: AQ: mode / str / qg-size / cu-tree : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress : CRF-28.0 / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip mode=1 signhide tmvp
x265 [info]: tools: b-intra strong-intra-smoothing lslices=8 deblock sao
[0 NVIDIA GeForce GTX 1070] queueC=2[8] queueG=0[16] queueT=1[2]
[0 NVIDIA GeForce GTX 1070] bugsbn1=0 bugbilz=0 bugcopc=0 bugihfa=0
[0 NVIDIA GeForce GTX 1070] fp16-p/s/u/a=1/1/1/0 int8-p/s/u/a=1/1/1/1
[0 NVIDIA GeForce GTX 1070] subgroup=32 basic/vote/ballot/shuffle=1/1/1/1
[0 NVIDIA GeForce GTX 1070] fp16-8x8x16/16x8x8/16x8x16/16x16x16=0/0/0/0
[1 llvmpipe (LLVM 17.0.6, 256 bits)] queueC=0[1] queueG=0[1] queueT=0[1]
[1 llvmpipe (LLVM 17.0.6, 256 bits)] bugsbn1=0 bugbilz=0 bugcopc=0 bugihfa=0
[1 llvmpipe (LLVM 17.0.6, 256 bits)] fp16-p/s/u/a=1/1/1/1 int8-p/s/u/a=1/1/1/1
[1 llvmpipe (LLVM 17.0.6, 256 bits)] subgroup=8 basic/vote/ballot/shuffle=1/1/1/1
[1 llvmpipe (LLVM 17.0.6, 256 bits)] fp16-8x8x16/16x8x8/16x8x16/16x16x16=0/0/0/0
[0 NVIDIA GeForce GTX 1070] queueC=2[8] queueG=0[16] queueT=1[2]
[0 NVIDIA GeForce GTX 1070] bugsbn1=0 bugbilz=0 bugcopc=0 bugihfa=0
[0 NVIDIA GeForce GTX 1070] fp16-p/s/u/a=1/1/1/0 int8-p/s/u/a=1/1/1/1
[0 NVIDIA GeForce GTX 1070] subgroup=32 basic/vote/ballot/shuffle=1/1/1/1
[0 NVIDIA GeForce GTX 1070] fp16-8x8x16/16x8x8/16x8x16/16x16x16=0/0/0/0
[1 llvmpipe (LLVM 17.0.6, 256 bits)] queueC=0[1] queueG=0[1] queueT=0[1]
[1 llvmpipe (LLVM 17.0.6, 256 bits)] bugsbn1=0 bugbilz=0 bugcopc=0 bugihfa=0
[1 llvmpipe (LLVM 17.0.6, 256 bits)] fp16-p/s/u/a=1/1/1/1 int8-p/s/u/a=1/1/1/1
[1 llvmpipe (LLVM 17.0.6, 256 bits)] subgroup=8 basic/vote/ballot/shuffle=1/1/1/1
[1 llvmpipe (LLVM 17.0.6, 256 bits)] fp16-8x8x16/16x8x8/16x8x16/16x16x16=0/0/0/0
[2025-01-04 11:17:06.290] [warning] Estimating the total number of frames using duration * fps
[2025-01-04 11:17:06.290] [warning] Unable to determine the video's duration
[2025-01-04 11:17:06.290] [warning] Unable to determine the total number of frames
frame=498/0 (0.00%); fps=1.13; elapsed=00:07:22; remaining=00:00:00x265 [info]: frame I: 2, Avg QP:32.90 kb/s: 100930.00
x265 [info]: frame P: 124, Avg QP:33.73 kb/s: 77901.58
x265 [info]: frame B: 372, Avg QP:36.77 kb/s: 20039.41
x265 [info]: Weighted P-Frames: Y:4.0% UV:4.0%
x265 [info]: consecutive B-frames: 0.8% 0.8% 0.8% 97.6% 0.0%

encoded 498 frames in 442.19s (1.13 fps), 34771.72 kb/s, Avg QP:36.00

[2025-01-04 11:24:27] [info] Video processed successfully
====== Video2X Processing summary ======
Video file processed: ducks_take_off_1920x1080_50Hz_8bit_P420.hevc
Total frames processed: 498
Total time taken: 00:07:22
Average processing speed: 1.13 FPS
Output written to: output_hevc_HD_to_4k.hevc

@k4yt3x
Copy link
Owner

k4yt3x commented Jan 18, 2025

So I ended up giving it another try. It seems like the reason why libplacebo cannot process the video properly is because the .hevc container doesn't contain PTS (presentation timestamp) information. This issue can be addressed by manually specifying a framerate and calculating the PTS of each frame before they are passed to libplacebo, but it is outside the normal use case.

@k4yt3x
Copy link
Owner

k4yt3x commented Jan 18, 2025

I've implemented this change in eae89ce. You can build from the latest commit if you want to try it out.

@k4yt3x k4yt3x closed this as completed Jan 18, 2025
@github-actions github-actions bot added state:Done This issue has been resolved/dismissed and removed state:InProgress This issue is being worked on labels Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:Done This issue has been resolved/dismissed type:Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants