Closed PierreInnodura closed 6 months ago
Not sure what's going wrong here. You can try setting the parameters with something like this in your launch file:
parameters=[{
'ffmpeg_image_transport.encoding': 'hevc_nvenc',
'ffmpeg_image_transport.profile': 'main',
'ffmpeg_image_transport.preset': 'll',
'ffmpeg_image_transport.gop': 15,
}]
but I doubt it'll make much of a difference. The parameters appear to be set correctly, the plugin is logging, so it's installed and found as well.
For some reason when the node is started through the launch file, the ffmpeg library it's using there cannot find the hevc_nvenc encoder, whereas when you run from the command line, it can find it. I suspect it has to do with the difference in launch environments.
Try this: use strace -f <your command here> >& /tmp/foo.txt
to run from the command line and to run with the launch file. This will produce a huge amount of output since strace logs every system call. Now search the foo.txt
file for anything related to ffmpeg_image_transport
, libav and other interesting stuff. You may be able to see where it opens nvenc related stuff (successful run). You should also see what version of libavcodec (aka ffmpeg) is being used. Does it come from the same location? Compare the output from the two runs. What are the differences? Does libavcodec open the same files in both cases?
Oh, and please don't post screenshots. They are not easy to search, don't display well on e.g. my phone etc. Cut-and-paste the output and enclose with triple backquote. Thanks!
Thank you for your detailed, response but in fact my first mistake was to search for the nvenc codec but it's not available on Jetson platform. So I had to compile ffmpeg from source following this tutorial to add the Jetson twin of hevc_nvenc (hevc_nvmpi).
When configuring ffmpeg before compilation I had to enable shared libraries otherwise the compilation of this package wasn't working:
./configure --enable-nvmpi --disable-static --enable-shared
I have a xavier agx and got NVMPI working with a custom build ffmpeg library. But since you had an Orin and said it works when you run from the command line I figured they added nvenc support for Jetson. Apparently not so. So did you get everything to work? BTW IIRC there are some issues when encoding more than two images (stereo cam!). I think it segfaults on me because nvmpi could only run one stream.
So on my side I run two video stream (1920x1080 with I420 pixel format) with h264_nvmpi, both of them are running on the nvenc chipset which is running at full speed apparently. Everything seems to run perfectly so I'm very pleased of the result. Thank you for your amazing work !
It would be nice to add support to change the parameters of the nvmpi codec because its AVcontext seems different from the nvenc, I was only able to change the profile of the codec for now with this package, and I tried to change manually the default value of the codec before compilation since I'm not a C expert, but it didn't work unfortunately.
I'm very busy with other things at the moment, but please open a new issue and describe in more detail what you want to have supported, and I'll look at it. I should also document the NVMPI stuff for the jetson.
I have a xavier agx and got NVMPI working with a custom build ffmpeg library. I should also document the NVMPI stuff for the jetson.
@berndpfrommer any chance you'll have some time soon to document it? I'd love to know how you did it. It's not exactly my setup but still will be useful
I have a xavier agx and got NVMPI working with a custom build ffmpeg library. I should also document the NVMPI stuff for the jetson.
@berndpfrommer any chance you'll have some time soon to document it? I'd love to know how you did it. It's not exactly my setup but still will be useful
Done
Hello,
I try to republish a image topic with this package on a Jeston Orin AGX.
Everything works well in command line:![image](https://github.com/ros-misc-utilities/ffmpeg_image_transport/assets/157045413/6cd1547f-5206-4bd6-8293-b0dcc359e8aa)
But when trying to do the same with a launch file it fails and gives this output:![image](https://github.com/ros-misc-utilities/ffmpeg_image_transport/assets/157045413/384f7f07-36bf-470e-b4bc-659b99c87d71)
My launch file:![image](https://github.com/ros-misc-utilities/ffmpeg_image_transport/assets/157045413/61d13576-f1e7-4f85-a46b-ae5844c313eb)
Everything works fine with libx264, but when trying to set hw accelerated encoder it fails.
Could you help me on this topic ?
Thank you.