Hi,Erik, about your image problem, I just had a very similar looking issue today while working on an unrelated experiment. My issue was that I misaligned bytes to pixels when copying from one frame to the other. (taking bytes in one and pushing to pixels in the other)
Are you working at byte or pixel level to create the combined image ?(I think we don't need to get down to pixel level at this point, we may create a wide bitmap in advance, get a Graphics object from it and call DrawImage on it to paint the current frames on it.)
Let me know if that could be remotely related to what you experienced.On a related note, if you feel that you are sort of stuck in the dual export function and want to try something else for a change, there is another function that you might be interested in. Currently there is the "Paused Video" function: you save a video with long pauses on key images. The idea of the new function would be to create a video with slow motion happening around the key images, (the rest at normal speed.) I wrote a little paragraph about it on the wiki. (http://www.kinovea.org/wiki/doku.php?id=codevideoexport)
The code can probably be common with the "Paused Video" a lot, to the point where the frames are duplicated to create the slow motion or pause. We need to compute which frames need to be duplicated and how many times. (In a first version, we would just duplicate the frames to create the slow motion effect, then in a future version we may call Aforge Morph filter or use a more advanced interpolation algorithm). However, we'll need to know in advance if a particular image is "around" a key image.
Let me know what you think. Thanks, joan. Le 09/02/2010 21:53, Joan a écrit :
Hi, I saw that before... I don't remember the context though.At which step this image is ? Is it the frame after encoding and before pushing to the file ? FFMpeg and .NET do not use the same pixel format, so you may get this kind of result depending on when you check, but the resulting video may still be good.Is it the new state of the image after you passed it to the encoder ?We need to clone the image entirely, and not using the .NET Clone method because it just clones the wrapper object, I used the Aforge Clone to get a full copy.Also, try with both videos in analysis mode first (frames already extracted to memory as bitmaps).How do you get the images passed to a VideoFile object ? I'm curious :-)Maybe you can commit the work in progress to the personal branch and I could look at it and try to understand what is happening.Thanks, joan. Le 09/02/2010 20:26, Erik Larsson a écrit :Hi!, I have problem with the video encoding.I've attached an image of the dual export. If I lock at the bitmap images that I "send" to the VideoFileWriter they are correct. But after encoding it more or less foo bar.Any ideas? /Erik2010/2/2 Erik Larsson <karl.erik.larsson@xxxxxxxxx <mailto:karl.erik.larsson@xxxxxxxxx>>When I stared to work with this I had problem with exporting the video. After a while I realized that the video aspect ratio was a problem. When I realized that my coding time was up :-( I will start looking a bit on some sort of helper function/class for combining images. You are right that frame rate and video size need to me taken into concern, but thats not rocket science too solve that. GUI: I did the GUI just like you sad, putting the export buttons to the right in the common-controls. Maybe the GUI should be changed a bit because it's starting to get very many button. Why not just make one export-drop-down-button. When clicking at it a export menu will show. /Erik 2010/2/2 <joan@xxxxxxxxxxx <mailto:joan@xxxxxxxxxxx>> On Tue, 02 Feb 2010 13:31:52 +0100, <joan@xxxxxxxxxxx <mailto:joan@xxxxxxxxxxx>> wrote: The tricky parts would be : 1 - keeping the user's synchronisation point, so the final video is exactly what he was looking at. I don't know how we can do this since currently each screen has its own VideoFile object and doesn't know about the other one. The saving will probably have to be piloted from the ScreenManager itself. What was your approach to retrieve the other video images? 2 - what do we do of key image data? I think we shouldn't provide the option of multiplexing the .kva XML data into the file. Exporting to dual video is much like exporting with variable duration on key images and other special export. The output will probably be used as-is, and not as a working file. So basically, for a start at least, we may burn the drawings on the frames definitely. When the user will click the button for this new Dual Save export, he will directly be forwarded to the save file dialog. Oh, and the videos could also have different dimensions and different image aspect ratios. To solve this issue, we could use the biggest image size as the target size and adapt the smaller one to fit its half of the image, keeping ratio. So if we have one video 640×480 (4:3) and the other is 720×576 (5:4), the first one would have to be stretched into 720×540, and will have black stripes on the sides. All in all, we should probably have a helper function that takes two images and give back a single combined image. This way we can directly use this function for the simple combined snapshot feature. For the case of video that have different frame rate, we'll have to choose the frame rate of one the two. (and the synchronisation engine should provide the right corresponding image for each position).