SciKit-Surgery / cmicHACKS2

:school_satchel: > 🔩 Hacking Real-time AI workflows for Surgery 🔧
https://scikit-surgery.github.io/cmicHACKS2/
1 stars 0 forks source link

`ffmpeg` error with incorrect parameters (e.g., width or height) #28

Closed mxochicale closed 12 months ago

mxochicale commented 1 year ago

🐛Bug

I think we need to resize image to convert them to video? Otherwise, we get this errors

ffmpeg -framerate 1 -pattern_type glob -i 'Kvasir-SEG/images/ck*.jpg' -c:v libx264 out720x576.mp4

Press [q] to stop, [?] for help
[libx264 @ 0x5593e14e27c0] height not divisible by 2 (622x529)
Error initializing output stream 0:0 -- Error while opening encoder for output stream 
#0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!
mxochicale commented 12 months ago

Resolved with crop=trunc(iw/2)*2:trunc(ih/2)*2"

ffmpeg -framerate 30 -pattern_type glob -i 'Kvasir-SEG/selected-ck2bxknhjvs1x0794iogrq49k-512x-512x-05-frames/*.jpg' -c:v libx264 -vf "crop=trunc(iw/2)*2:trunc(ih/2)*2" out512x512-selected-ck2bxknhjvs1x0794iogrq49k-05-frames.mp4

More info here https://github.com/SciKit-Surgery/cmicHACKS2/tree/main/data/polyp-dataset