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

Update vf_gopromax_opencl.c #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update vf_gopromax_opencl.c #1

wants to merge 1 commit into from

Conversation

gmat
Copy link

@gmat gmat commented Dec 16, 2021

changes to get the filter declaration VV->V and not |->| to correct the bug Too many inputs specified for the "gopromax_opencl" filter.

changes to get the filter declaration `VV->V` and not `|->|` to correct the bug `Too many inputs specified for the "gopromax_opencl" filter.`
@soheer
Copy link

soheer commented Mar 16, 2022

Hello,

we install FFmpeg according to install.md file, when running make command we got this error

POD doc/ffmpeg.pod POD doc/ffprobe.pod POD doc/ffmpeg-all.pod POD doc/ffprobe-all.pod MAN doc/ffmpeg.1 MAN doc/ffprobe.1 MAN doc/ffmpeg-all.1 MAN doc/ffprobe-all.1 LD ffmpeg_g /usr/bin/ld: libavfilter/libavfilter.a(vf_gopromax_opencl.o): in function gopromax_opencl_load':
/home/ubuntu/FFmpeg/libavfilter/vf_gopromax_opencl.c:97: undefined reference to clCreateCommandQueue' /usr/bin/ld: /home/ubuntu/FFmpeg/libavfilter/vf_gopromax_opencl.c:104: undefined reference to clCreateKernel'
/usr/bin/ld: libavfilter/libavfilter.a(vf_gopromax_opencl.o): in function gopromax_opencl_stack': /home/ubuntu/FFmpeg/libavfilter/vf_gopromax_opencl.c:165: undefined reference to clSetKernelArg'
/usr/bin/ld: /home/ubuntu/FFmpeg/libavfilter/vf_gopromax_opencl.c:169: undefined reference to clSetKernelArg' /usr/bin/ld: /home/ubuntu/FFmpeg/libavfilter/vf_gopromax_opencl.c:179: undefined reference to clEnqueueNDRangeKernel'
/usr/bin/ld: /home/ubuntu/FFmpeg/libavfilter/vf_gopromax_opencl.c:161: undefined reference to clSetKernelArg' /usr/bin/ld: libavfilter/libavfilter.a(vf_gopromax_opencl.o): in function gopromax_opencl_load':
/home/ubuntu/FFmpeg/libavfilter/vf_gopromax_opencl.c:113: undefined reference to clReleaseCommandQueue' /usr/bin/ld: /home/ubuntu/FFmpeg/libavfilter/vf_gopromax_opencl.c:115: undefined reference to clReleaseKernel'
/usr/bin/ld: libavfilter/libavfilter.a(vf_gopromax_opencl.o): in function gopromax_opencl_stack': /home/ubuntu/FFmpeg/libavfilter/vf_gopromax_opencl.c:185: undefined reference to clFinish'
/usr/bin/ld: libavfilter/libavfilter.a(vf_gopromax_opencl.o): in function gopromax_opencl_uninit': /home/ubuntu/FFmpeg/libavfilter/vf_gopromax_opencl.c:267: undefined reference to clReleaseKernel'
/usr/bin/ld: /home/ubuntu/FFmpeg/libavfilter/vf_gopromax_opencl.c:274: undefined reference to clReleaseCommandQueue' /usr/bin/ld: libavfilter/libavfilter.a(opencl.o): in function ff_opencl_filter_uninit':
/home/ubuntu/FFmpeg/libavfilter/opencl.c:157: undefined reference to clReleaseProgram' /usr/bin/ld: libavfilter/libavfilter.a(opencl.o): in function ff_opencl_filter_load_program':
/home/ubuntu/FFmpeg/libavfilter/opencl.c:173: undefined reference to clCreateProgramWithSource' /usr/bin/ld: /home/ubuntu/FFmpeg/libavfilter/opencl.c:181: undefined reference to clBuildProgram'
/usr/bin/ld: /home/ubuntu/FFmpeg/libavfilter/opencl.c:206: undefined reference to clReleaseProgram' /usr/bin/ld: /home/ubuntu/FFmpeg/libavfilter/opencl.c:190: undefined reference to clGetProgramBuildInfo'
/usr/bin/ld: /home/ubuntu/FFmpeg/libavfilter/opencl.c:195: undefined reference to clGetProgramBuildInfo' /usr/bin/ld: libavfilter/libavfilter.a(opencl.o): in function ff_opencl_filter_work_size_from_image':
/home/ubuntu/FFmpeg/libavfilter/opencl.c:296: undefined reference to clGetMemObjectInfo' /usr/bin/ld: /home/ubuntu/FFmpeg/libavfilter/opencl.c:309: undefined reference to clGetImageInfo'
/usr/bin/ld: /home/ubuntu/FFmpeg/libavfilter/opencl.c:317: undefined reference to clGetImageInfo' /usr/bin/ld: libavfilter/libavfilter.a(opencl.o): in function ff_opencl_get_event_time':
/home/ubuntu/FFmpeg/libavfilter/opencl.c:353: undefined reference to clGetEventProfilingInfo' /usr/bin/ld: /home/ubuntu/FFmpeg/libavfilter/opencl.c:354: undefined reference to clGetEventProfilingInfo'
collect2: error: ld returned 1 exit status
make: *** [Makefile:125: ffmpeg_g] Error 1
`

we searched for it but we got nothing , any suggestion please.
Thanks

@gmat
Copy link
Author

gmat commented Mar 16, 2022

@soheer don't forget to pass --enable-opencl option to ./configure

./configure --enable-opencl

@soheer
Copy link

soheer commented Mar 21, 2022

Hello,
after installing ffmpeg (with enable-opencl option) we tested it using the command available in README section,
but we got the same error that appears while using the default ffmpeg.
the error is:

./ffmpeg -hwaccel auto -hwaccel auto -init_hw_device opencl:0.2 -filter_hw_device opencl0 -v verbose -filter_complex '[0:0]format=yuv420p,hwupload[a] , [0:4]format=yuv420p,hwupload[b], [a][b]gopromax_opencl, hwdownload,format=yuv420p' -i input.360 -c:v libx264 out.mp4
ffmpeg version N-103773-g6cf2cee5b4 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04)
configuration: --enable-opencl
libavutil 57. 6.100 / 57. 6.100
libavcodec 59. 9.100 / 59. 9.100
libavformat 59. 5.100 / 59. 5.100
libavdevice 59. 0.101 / 59. 0.101
libavfilter 8. 9.100 / 8. 9.100
libswscale 6. 1.100 / 6. 1.100
libswresample 4. 0.100 / 4. 0.100
[AVHWDeviceContext @ 0x55df175575c0] Failed to get number of OpenCL platforms: -1001.
Device creation failed: -19.
Failed to set value 'opencl:0.2' for option 'init_hw_device': No such device
Error parsing global options: No such device

@gmat
Copy link
Author

gmat commented Mar 21, 2022

You know it isn't the proper place to get support here ? Maybe better on discord https://discord.com/channels/883679724335923241/883685764913827860

You can use one opencl device. With clinfo -l you can list your opencl platforms devices and precise which one you will use by changing value of -init_hw_device maybe opencl:0.0 or opencl:1.0 as clinfo -d p:d (device number d from platform number p) returns information.

But you should maybe start by let ffmpeg use your default device :

./ffmpeg -hwaccel opencl -v verbose -filter_complex '[0:0]format=yuv420p,hwupload[a] , [0:5]format=yuv420p,hwupload[b], [a][b]gopromax_opencl, hwdownload,format=yuv420p' -i IN.360 -c:v libx264 -map_metadata 0 -map 0:3 OUT.mp4`

@gmat
Copy link
Author

gmat commented Mar 21, 2022 via email

@soheer
Copy link

soheer commented Mar 22, 2022

after implementing goproMax-ffmpeg-v5 we tried the default command(./ffmpeg -hwaccel opencl -v verbose -filter_complex '[0:0]format=yuv420p,hwupload[a] , [0:5]format=yuv420p,hwupload[b], [a][b]gopromax_opencl, hwdownload,format=yuv420p' -i IN.360 -c:v libx264 -map_metadata 0 -map 0:3 OUT.mp4)

the output was "Unknown encoder 'libx264'" so we change it into codec h264. A new error appears:

Matched encoder 'h264_v4l2m2m' for codec 'h264'.
[AVHWDeviceContext @ 0x558b99166580] 0.0: NVIDIA CUDA / NVIDIA GeForce GTX 1080 Ti
[AVHWDeviceContext @ 0x558b99166580] 0.1: NVIDIA CUDA / NVIDIA GeForce GTX 1060 6GB
[AVHWDeviceContext @ 0x558b99166580] More than one matching device found.
Device creation failed: -19.
[hevc @ 0x558b99163c40] No device available for decoder: device type opencl needed for codec hevc.
Stream mapping:
Stream #0:0 (hevc) -> format:default
Stream #0:5 (hevc) -> format:default
format:default -> Stream #0:0 (h264_v4l2m2m)
Stream #0:3 -> #0:1 (copy)
Device setup failed for decoder on input stream #0:0 : No such device
[AVIOContext @ 0x558b991d6b40] Statistics: 0 bytes written, 0 seeks, 0 writeouts
[AVIOContext @ 0x558b9915b340] Statistics: 606983 bytes read, 4 seeks

we searched for it but we didn't find anything.

@gmat
Copy link
Author

gmat commented Mar 22, 2022

for libx264 you should add --enable-libx264 option to your ./configure. On ubuntu be sure to have the libx264-dev installed sudo apt install libx264-dev.

Your ./configure should be more longer to get more codec enable. It could be

./configure  --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-fontconfig --enable-frei0r --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libaom --enable-libdav1d --enable-libass --enable-libbluray --enable-libcdio --enable-libdrm --enable-libjack --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmp3lame --enable-nvenc --enable-openal --enable-opencl --enable-opengl --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librsvg --enable-libsrt --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvidstab --enable-version3 --enable-vapoursynth --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg --enable-libzvbi --enable-avfilter --enable-libmodplug --enable-postproc --enable-pthreads --enable-gpl --disable-debug --disable-stripping

Next on compile errors, install the package -dev missing as you will done for libx264.

@soheer
Copy link

soheer commented Mar 22, 2022

we enabled all your suggested libraries the codec issue solved but the error remains the same.

[AVHWDeviceContext @ 0x55e66bfc3980] 0.0: NVIDIA CUDA / NVIDIA GeForce GTX 1080 Ti
[AVHWDeviceContext @ 0x55e66bfc3980] 0.1: NVIDIA CUDA / NVIDIA GeForce GTX 1060 6GB
[AVHWDeviceContext @ 0x55e66bfc3980] More than one matching device found.
Device creation failed: -19.
[hevc @ 0x55e66c01ea00] No device available for decoder: device type opencl needed for codec hevc.
Stream mapping:
Stream #0:0 (hevc) -> format:default
Stream #0:5 (hevc) -> format:default
format:default -> Stream #0:0 (libx264)
Stream #0:3 -> #0:1 (copy)
Device setup failed for decoder on input stream #0:0 : No such device
[AVIOContext @ 0x55e66c004fc0] Statistics: 0 bytes written, 0 seeks, 0 writeouts
[AVIOContext @ 0x55e66bfbb400] Statistics: 606983 bytes read, 4 seeks

(we have 2 GPUs GeForce GTX 1080 Ti and GeForce GTX 1060 6GB)

@gmat
Copy link
Author

gmat commented Mar 22, 2022

to many choise @soheer clinfo -d 0:0 should confirm the availability for your GTX 1080 as opencl device, and clinfo -d 0:1 the gtx 1060 opencl. Check that first.

You should try the conversion by precise which one to use, -init_hw_device opencl:0.0 for the gtx 1080 for example

./ffmpeg -hwaccel opencl -init_hw_device opencl:0.0 -filter_hw_device opencl0   -v verbose -filter_complex '[0:0]format=yuv420p,hwupload[a] , [0:5]format=yuv420p,hwupload[b], [a][b]gopromax_opencl, hwdownload,format=yuv420p' -i IN.360 -c:v libx264 -map_metadata 0 -map 0:3 OUT.mp4

@soheer
Copy link

soheer commented Mar 23, 2022

thanks for your help,

we complete the conversion process, but there is a huge difference between video sizes
original video size = 121.8 MB
converted size = 37.8 MB codec 264
converted size = 7.3 MB codec 265
conversion using gopro quick app codec 264 video size = 115.5 MB which is the closest size to the original one

what should we alter in the command to maintain data and resolution as the app conversion method?

thanks a lot.

@gmat
Copy link
Author

gmat commented Mar 23, 2022

You compare sizes of the files. You should expect that compression algorithms applied will decrease file size output.

ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 YOURFILE should return 4096x1344
4096*1344 = 5505024 ~ 5.6K resolution promise by gopro.

Verify the output resolution obtained. Mainly check the "human eye seen quality" and maybe the software reader compatibility to chose your output format.

@soheer
Copy link

soheer commented Mar 23, 2022

The output of the ffprobe command on the converted video : 5376x2688
The output of the ffprobe command on the converted video using app : 4096x2048
we tried scale to set the width and height but it raise an error due to the filter defined in the command

./ffmpeg -hwaccel opencl -init_hw_device opencl:0.0 -filter_hw_device opencl0 -v verbose -filter_complex '[0:0]format=yuv420p,hwupload[a] , [0:5]format=yuv420p,hwupload[b], [a][b]gopromax_opencl, hwdownload,format=yuv420p' -i IN.360 -c:v libx264 -map_metadata 0 -map 0:3 OUT.mp4

how to get result similar to the app?

@gmat
Copy link
Author

gmat commented Mar 23, 2022

you can scale after the transformation. https://ottverse.com/change-resolution-resize-scale-video-using-ffmpeg/

ffmpeg -i input.mp4 -vf scale=4096x2048 -preset slow -crf 18 output.mp4

@soheer
Copy link

soheer commented Mar 24, 2022

Hello,

We noticed that after the initial conversion the video looses audio feature`

`./ffmpeg -hwaccel opencl -init_hw_device opencl:0.0 -filter_hw_device opencl0 -v verbose -filter_complex '[0:0]format=yuv420p,hwupload[a] , [0:5]format=yuv420p,hwupload[b], [a][b]gopromax_opencl, hwdownload,format=yuv420p' -i IN.360 -c:v libx264 -map_metadata 0 -map 0:3 OUT.mp4

How can we keep audio feature?

Thanks a lot

@gmat
Copy link
Author

gmat commented Mar 24, 2022

with ffprobe you will see that audio is available in 2 streams

$ ffprobe -loglevel error -select_streams a -show_streams -show_entries stream=index,codec_name:tags=:disposition= -of csv myvideo.360 
stream,1,aac
stream,6,pcm_s32le

If you want to keep the aac audio you can add -map 0:1 -c:a copy to copy the audio stream 1 in your output

ffmpeg -hwaccel opencl -init_hw_device opencl:0.0 -filter_hw_device opencl0 -v verbose -filter_complex '[0:0]format=yuv420p,hwupload[a] , [0:5]format=yuv420p,hwupload[b], [a][b]gopromax_opencl, hwdownload,format=yuv420p' -i myvideo.360 -c:v libx264 -map 0:1 -c:a copy -map_metadata 0 -map 0:3 out.mp4

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

Successfully merging this pull request may close these issues.

2 participants