pencil icon indicating copy to clipboard operation
pencil copied to clipboard

Movie export removes last frame on exported video

Open Jose-Moreno opened this issue 5 years ago • 8 comments

Issue Summary

This issue was reported on facebook showcasing the problem. It's simple. Every video exported by Pencil2D, is dropping the last frame for some reason.

Expected Results

Pencil2D should not add or remove frames during import or export. On productions where shots are measured in frames if every clip were to be exported one frame short, the final video edit would have a considerable amount of time capped off. Perhaps for simple videos it may be unnoticeable, but for bigger projects this should not happen at all.

Steps to reproduce

  1. Create a file with 10 adjacent keyframes. Draw on them to make it easier for you to see what's missing.
  2. Export a movie. I tested with both MP4 and AVI
  3. Save for reference and create a new file.
  4. Import the movie by using the File > Import > Movie Video option (this is just for convenience, you can use a video player with absolute frame display and no frame dropping like quicktime player or irfanview with iv_player plugin)
  5. Notice now that you have the last frame missing.

System Information

  • Pencil2D Version: Nightly Build Nov 24 2020 (The original report came from release build)

commit: 889f226aaf65ac2b4da00cb3f355b6b29fd5d571 date: 2020-11-24_17:31:44

Operating System: Windows 10 (10.0) CPU Architecture: x86_64 Qt Version: 5.12.10

Jose-Moreno avatar Dec 19 '20 02:12 Jose-Moreno

I've just tested it on Ubuntu 20.4 Here it was the first frame that was missing?! Both for mp4 and avi

davidlamhauge avatar Dec 20 '20 10:12 davidlamhauge

Tested with mp4 and avi with a 24 frame file at 24 fps on Ubunutu 20.10. Both the first and last frames were definitely there. The last frame doesn't play for some reason if you set the video to loop in VLC, but it does show up if you only play it once. And if I convert the files to an image sequence I can see all 24 frame output. This is probably just an issue with your video players. If you could share an example video of an export with missing frames I could take a closer look at them to confirm this.

Importing these mp4 and avi videos also resulted in all frames as expected, however they did not immediately show up correctly because of some frame caching issue.

scribblemaniac avatar Dec 21 '20 06:12 scribblemaniac

I've just tested it again. It was like yesterday. First drawing was missing. However, if i changed layer from bitmap to vector, it suddenly appeared again, so it was a caching issue of some kind. Very odd.

davidlamhauge avatar Dec 21 '20 07:12 davidlamhauge

@scribblemaniac In my case It's not an issue with video players. I imported the video into Pencil2D directly and the last frame was missing. So did the user that brought this topic.

Please read the reproduction steps as it is indicated that you can import the video directly into Pencil2D to avoid the video player discussion (as I predicted this could be dismissed because of that), however I also described that I used an additional video player that does not drop frames to verify as well and in both player and Pencil2D the last frame was lost.

I'll share the example video if that's something you need, but importing the video using the repro steps literally loads 9 keyframes instead of 10 keyframes. It's not a caching issue either.

If anything it could be a Windows only issue, since both the original user and myself were using windows and you guys are using Ubuntu.

Jose-Moreno avatar Dec 21 '20 19:12 Jose-Moreno

Please read the reproduction steps as it is indicated that you can import the video directly into Pencil2D to avoid the video player discussion (as I predicted this could be dismissed because of that), however I also described that I used an additional video player that does not drop frames to verify as well and in both player and Pencil2D the last frame was lost.

I did follow the reproduction steps too and it has the correct number of frames. It could be platform specific. My guess is that it's a rounding issue and it only happens with certain fps and total frame numbers. Yes please send me a example video, and the project that produced it too.

scribblemaniac avatar Dec 21 '20 19:12 scribblemaniac

@scribblemaniac Alrighty. Here's a zip file with:

  • Test PCLX file used to export the movie
  • Test exported movie from the file
  • Video showcasing the issue on my machine

Last_KeyFrame_Missing_Samples.zip

It could be platform specific. My guess is that it's a rounding issue and it only happens with certain fps and total frame numbers

This is probably what's happening. Windows attacking our blind spot. Business as usual 😂 and I'm currently using 30 FPS and a resolution of 2048 x 1080. Otherwise everything else is default 😭

Jose-Moreno avatar Dec 21 '20 19:12 Jose-Moreno

I have confirmed that the last frame is missing from your exported video, but also that I can export this project and get a video with the correct number of frames. This suggests we are dealing with some platform-specific Windows issues.

scribblemaniac avatar Dec 21 '20 20:12 scribblemaniac

We tested a bit more with scribblemaniac. Thinking it could be an issue with FFMPEG windows builds I downloaded the static ffmpeg-20201216-32586a42da from this site https://ottverse.com/ffmpeg-builds/ which supposedly has the same configuration as the old zeranoe builds we used to use.

The result was exactly the same. Missing 10th key frame after export. I also exported an image sequence and I got all the required 10 images from the sample file.

While we still can't rule out that the Windows FFMPEG version is not flawed, it could also be the result of a missing flag specific for windows or even a typo in the windows specific code for the movie exporter. I'll update this thread after we run more tests.

Thanks to David and Scribblemaniac for the assistance investigating and narrowing down this issue 😄

Jose-Moreno avatar Dec 21 '20 21:12 Jose-Moreno