Closed yaruchyo closed 1 year ago
At some point I was able to use it without GPU, but I have considerably modified the code since to work efficiently with the GPU, so it may no longer work without it. Having that said, here a few questions:
If you build ffmpeg yourself, leave out the compile options for nvidia hardware acceleration.
@berndpfrommer thanks for the response!
ffmpeg version 4.2.4-1ubuntu0.1
and installed it via apt-get
ldd /usr/bin/ffmpeg | grep cuda
I have just libicudata.so.66 => /lib/x86_64-linux-gnu/libicudata.so.66
OK, so I guess what is happening is this: the ffmpeg image transport asks the ffmpeg image library to create an encoder with the codec "hevc_nvenc", which is the default codec. Then ffmpeg tries to open libcuda and you get the error. But you can set the encoder configuration on startup via a ROS parameter.
Try setting the ros parameter by adding the argument "_encoder:=libx264" when you start the republish node. It may actually just work.
For reference here are the configurable ros parameters:
https://github.com/daniilidis-group/ffmpeg_image_transport/blob/master/cfg/EncoderDyn.cfg
I still have this error message
I tried to change all codec in EncoderDyn.cfg
file as well as manually run
rosrun image_transport republish raw in:=/kitti/camera_color_left/image_raw_crop ffmpeg out:=/kitti/camera_color_right/image_raw_crop_ffmpeg _encoder:=libx264
I also deleted all lines with other codec options except the libx264 all across the repository.
so by using grep -r _nvenc *
I just have
src/ffmpeg_image_transport/docs/compile_ffmpeg.md: [hevc_nvenc @ 0x7fc67c03a580] Cannot load libnvidia-encode.so.1
src/ffmpeg_image_transport/docs/compile_ffmpeg.md: [hevc_nvenc @ 0x7fc67c03a580] The minimum required Nvidia driver for nvenc is 418.30 or newer
src/ffmpeg_image_transport/src/ffmpeg_encoder.cpp: // check with e.g.: ffmpeg -h encoder=h264_nvenc -pix_fmts
Small remark. I can run the following script without any errors ffmpeg -i test.mp4 -c:v libx264 -preset ultrafast -x265-params lossless=1 OUTPUT.mkv
delete your build and devel directories and build again, just to be sure. printf encoder name in the c++ source as close as you can to the point where it bombs out.
On Wed, Nov 3, 2021, 9:11 PM yaruchyo @.***> wrote:
I still have this error message I tried to change all codec in EncoderDyn.cfg file as well as manually run rosrun image_transport republish raw in:=/kitti/camera_color_left/image_raw_crop ffmpeg out:=/kitti/camera_color_right/image_raw_crop_ffmpeg _encoder:=libx264
I also deleted all lines with other codec options except the libx264 all across the repository. so by using grep -r _nvenc * I just have
src/ffmpeg_image_transport/docs/compile_ffmpeg.md: [hevc_nvenc @ 0x7fc67c03a580] Cannot load libnvidia-encode.so.1 src/ffmpeg_image_transport/docs/compile_ffmpeg.md: [hevc_nvenc @ 0x7fc67c03a580] The minimum required Nvidia driver for nvenc is 418.30 or newer src/ffmpeg_image_transport/src/ffmpeg_encoder.cpp: // check with e.g.: ffmpeg -h encoder=h264_nvenc -pix_fmts
Small remark. I can run the following script without any errors ffmpeg -i test.mp4 -c:v libx264 -preset ultrafast -x265-params lossless=1 OUTPUT.mkv
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/daniilidis-group/ffmpeg_image_transport/issues/6#issuecomment-960353998, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPLK2QZQCNTGSL77YTJPGDUKHMULANCNFSM5HJ2LMPQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Thanks a lot!! I have deleted the whole repo and cloned it again as well as changed the codec in cfg file to "libx264" before build and it works great!
The only issue I have now is by decoding. I have this error message which relates to the cuda again
[h264 @ 0x558bf7918900] Invalid setup for format cuda: missing configuration.
[ERROR] [1636031894.525194514]: Failed to get HW surface format.
[h264 @ 0x558bf7918900] decode_slice_header error
[h264 @ 0x558bf7918900] no frame!
the commands I execute are:
encoder:
rosrun image_transport republish raw in:=/kitti/camera_color_left/image_raw_crop ffmpeg out:=/kitti/camera_color_left/img_ffmpeg
decoder:
rosrun image_transport republish ffmpeg in:=/kitti/camera_color_left/img_ffmpeg raw out:=/kitti/camera_color_right/test
UPD:
I changed ffmpeg_decoder.cpp
from const std::string hwAcc("cuda");
to const std::string hwAcc("vaapi");
and that works great now!
Thanks for support!
Just pushed a new version to master that should work on non-GPU machines. I also updated the README to explain how you can force the encoding and decoding.
My machine has a GPU so I can not do a complete test. Could you please test?
The encoder part looks much better and works great.
With the decoder part I still have an error without changing the ffmpeg_decoder.cpp
file in line 145.
Of course the value hwAcc("cuda")
can be parameterized.
As I know the following parameters are acceptable:
vdpau
cuda
vaapi
- CPUdrm
- msg: decoder libx264 does not support hw accel: drmopencl
I'd like to get the exception handling to work better, i.e. if it doesn't find cuda, it should drop down to unaccelerated.
Somehow that's not working. Could you find out what is returned by av_hwdevice_find_type_by_name()
on line 70 of ffmpeg_decoder.cpp
?
enum AVHWDeviceType type = av_hwdevice_find_type_by_name(name.c_str());
I was assuming that will return AV_HWDEVICE_TYPE_NONE
and it would log an error?
No update on this one for a while, will be closed due to non-activity.
Hi, I saw in the description that nvidia hardware could accelerate the processes. I'm running without GPU and
ffmpeg -i ./test.mp4 output.webm
works fine, but If I want to userosrun image_transport republish raw in:=/kitti/camera_color_right/image_raw_crop ffmpeg out:=/kitti/camera_color_right/image_raw_crop/ffmpeg
I get this error message.
Is it possible to use the script without CUDA kernels?