daniilidis-group / ffmpeg_image_transport

image transport that uses libavcodec for compression
Apache License 2.0
42 stars 13 forks source link

Bad encoding/decoding #2

Closed alberto1995 closed 3 years ago

alberto1995 commented 3 years ago

Hello,

I have installed ffmpeg_image_transport and ffmpeg_image_transport_msg, compiled everything from source (also ffmpeg) and works. But when I try to watch the video with rqt_image_view this is the result:

Schermata da 2021-06-17 17-18-28

Any ideas about the reason?

Thank you,

Alberto

berndpfrommer commented 3 years ago

I haven't seen this particular case, sorry. Are there any error messages on the encoder/decoder side printed to the console? Can you rosbag record the ffmpeg topic? Does the bag provide any data? What size are you images? Can you enable ROS debug logging to see what codec is being used?

alberto1995 commented 3 years ago

I don't get any kind of error from both the encoder and the decoder part. I have recorded a small rosbag with image_raw and ffmpeg topics, here you can download it. The bag is not empty, as shown with rosbag info. Images are 720x540, the video format of the camera is COLOR_8. The codec used is hevc_nvenc, but I have also tried others with the same result.

Do you have any suggestions?

Thank you,

Alberto

berndpfrommer commented 3 years ago

I was able to reproduce the problem from the back. I have the same issue as you. Could it be that the encoder cannot handle the odd size? Can you make the camera produce a more conventional image size (VGA, 720p, HD)?

On Fri, Jun 18, 2021 at 7:08 AM alberto1995 @.***> wrote:

I don't get any kind of error from both the encoder and the decoder part. I have recorded a small rosbag with image_raw and ffmpeg topics, here https://unipg-my.sharepoint.com/:u:/g/personal/alberto_dionigi_studenti_unipg_it/ESMgOGylnaFGofxHqDAiRbsBe42X3X2FWE2dOFx2VyhReg?e=flULja you can download it. The bag is not empty, as shown with rosbag info. Images are 720x540, the video format of the camera is COLOR_8. The codec used is hevc_nvenc, but I have also tried others with the same result.

Do you have any suggestions?

Thank you,

Alberto

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/daniilidis-group/ffmpeg_image_transport/issues/2#issuecomment-863958339, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPLK2VAZIKVI4KAIPX57RLTTMSJLANCNFSM4634ZGRQ .

alberto1995 commented 3 years ago

I have tried to change the image resolution and now it works. There is an easy fix to make it works with any image resolution?

berndpfrommer commented 3 years ago

Sorry but I'm really not an expert on Codecs etc. I learned what I had to in order to make it work for the camera resolutions that I needed. But my guess would be that the issue could have to do with the encoder being hardware accelerated. I know some hardware accelerators support only a small number of resolutions, but for nvenc I cannot find a reference to any such restrictions. Question: can you try working with the base ffmpeg tool to encode and decode an image stream of 720x540? Does that work? If not, does it work with e.g. standard HD format? What if you don't use nvenc, but libx264?