Shift in lines when creating videos using VideoWriter
古いコメントを表示
I'm using VideoReader to read a mp4 video, insert a few shapes and annotations, then use VideoWriter to write a new video file. The script was working fine with matlab 2023a on an intel macbook pro. After I switch to matlab 2023b on a macbook with m3 chip, the script stop working. The video geneerated shows weird shift in lines below:

I did notice if I change the file type for VideoWriter from 'MPEG-4' to 'Uncompressed AVI", it can work. But the file size is gigantic.
Can someone help please? Thank you so much!
回答 (4 件)
Amsal
2024 年 9 月 16 日
2 投票
Ensuring that the video frame dimensions (width and height) were multiples of 8 fixed the issue for me.
2 件のコメント
Zheng
2024 年 9 月 16 日
Allison Ho
2024 年 9 月 17 日
Thanks so much for commenting this, fixed my issues. I just had to make sure that the video dimensions were integer numbers and then my video rendered correctly.
Joseph Slivka
2024 年 5 月 10 日
1 投票
I was also experiencing the same problem in r2023b running on macbook pro apple silicon. I fixed it randomly by adding text to the figure, even if it is just a blank string.
text(0.99*ax.XLim(2),0.99*ax.YLim(1),'','HorizontalAlignment','right','VerticalAlignment','bottom','FontSize',40,'FontName','Arial')
I believe all the options are unnecessary but just citing exactly what I did. Maybe this will help provide a temporary solution.
Walter Roberson
2024 年 3 月 13 日
0 投票
This is a known problem in R2023b for the Apple Silicon
Possibly it only happens when you only write a single frame to the movie; I am not sure about that.
2 件のコメント
Zheng
2024 年 3 月 16 日
Walter Roberson
2024 年 3 月 16 日
Sorry, I have no information as to when the problem will be solved.
亦可
2025 年 3 月 11 日
0 投票
This issue also happens on my Apple silicon Macbook when the figure size is larger than the screen. It seems like when the figure is too large, it get compressed in size and results in the distortion.
TO FIX IT, chosing an appropriate size within the screen works for me.
1 件のコメント
亦可
2025 年 3 月 11 日
or just turn off the resize function of the figure by
set(gcf,"Units","centimeters","Position",[5,5,25,40], 'Resize', 'off')
カテゴリ
ヘルプ センター および File Exchange で Audio and Video Data についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!