Running Matlab R2011b under Linux, I am generating a video using the VideoWriter. My code goes something like this:
h_fig = figure();
set(h_fig, 'Visible', 'on')
set(h_fig, 'Position', [300,200,898,720]);
h_axs = axes('Parent', h_fig);
set(h_axs,'nextplot','replacechildren');
vidObj = VideoWriter('leadfollow3.avi');
...
for i = 1:n
h_axs_a = subplot(3,2,[1 2]);
plot(h_axs_a, x, a_mag_lead, x, a_mag_follow, 'r');
...
The plot is composed of several subplots. The first subplot renders fine, but for the rest, the axes background remains grey instead of white. What's worse, for certain frames it switches to white, leading to annoying flicker in the video (see example video here). Individual plots outside the video writer loop don't display this artifact. What might be the best strategy to troubleshoot this?
Edit: after I got a chance to try this code on Windows, it seems that the problem is restricted to Linux. Nonetheless, I would still very much like to know a possible solution, since I do not have regular access to Windows boxes where I could do my computations.
cat *.jpg > out.mjpeg
- Then you can use ffmpeg to convert it to what you want. Same story as @Memming, but I had better luck with ffmpeg starting with the mjpeg than trying to pass it crazy arguments. – alexplanation