[GH-ISSUE #637] Crash when trying to save a video using the system encoder #519

Closed
opened 2026-02-26 09:31:44 +03:00 by kerem · 6 comments
Owner

Originally created by @Swandog on GitHub (Apr 13, 2020).
Original GitHub issue: https://github.com/NickeManarin/ScreenToGif/issues/637

Hi. I was trying to save a recording as video using the system encoder, and ScreenToGif crashed almost immediately, and made a 0 byte AVI file.

Based on another issue I read, I went searching through the Windows Events, and I believe this is the crash event:

- <System>
  <Provider Name=".NET Runtime" /> 
  <EventID Qualifiers="0">1026</EventID> 
  <Level>2</Level> 
  <Task>0</Task> 
  <Keywords>0x80000000000000</Keywords> 
  <TimeCreated SystemTime="2020-04-13T20:53:57.894348600Z" /> 
  <EventRecordID>12312</EventRecordID> 
  <Channel>Application</Channel> 
  <Computer>DESKTOP-CDANMI9</Computer> 
  <Security /> 
  </System>
- <EventData>
  <Data>Application: ScreenToGif.exe Framework Version: v4.0.30319 
    Description: The process was terminated due to an unhandled exception. 

    Exception Info: System.AccessViolationException 
        at ScreenToGif.ImageUtil.Video.AviWriter.AVISaveOptions(IntPtr, UInt32, Int32, IntPtr[], IntPtr[]) 
        at ScreenToGif.ImageUtil.Video.AviWriter..ctor(System.String, Int32, Int32, Int32, UInt32) 
        at ScreenToGif.Windows.Other.Encoder+<Encode>d__24.MoveNext() 
        at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[[ScreenToGif.Windows.Other.Encoder+<Encode>d__24, ScreenToGif, Version=2.23.1.0, Culture=neutral, PublicKeyToken=null]](<Encode>d__24 ByRef) 
        at ScreenToGif.Windows.Other.Encoder.Encode(System.Collections.Generic.List`1<ScreenToGif.Model.FrameInfo>, Int32, ScreenToGif.Util.Parameters, System.Threading.CancellationTokenSource) 
        at ScreenToGif.Windows.Other.Encoder+<>c__DisplayClass13_0.<InternalAddItem>b__0() 
        at System.Threading.Tasks.Task.Execute() 
        at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) 
        at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) 
        at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef) 
        at System.Threading.Tasks.Task.ExecuteEntry(Boolean) 
        at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) 
        at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) 
        at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) 
        at System.Threading.ThreadHelper.ThreadStart(System.Object)</Data> 
  </EventData>
  </Event>

I originally created the project in 2.17.1 (the Portable version), and I saw this issue. I tried downloading 2.23.1 (again, the Portable version), and saw the same problem.

Saving via gif works okay. I haven't tried ffmpeg because I don't have it installed, yet.

Let me know what I can do to help. I'm a programmer myself, but I've never worked in .NET and rarely on Windows, so I'll be new to this.

Originally created by @Swandog on GitHub (Apr 13, 2020). Original GitHub issue: https://github.com/NickeManarin/ScreenToGif/issues/637 Hi. I was trying to save a recording as video using the system encoder, and ScreenToGif crashed almost immediately, and made a 0 byte AVI file. Based on another issue I read, I went searching through the Windows Events, and I believe this is the crash event: ```- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"> - <System> <Provider Name=".NET Runtime" /> <EventID Qualifiers="0">1026</EventID> <Level>2</Level> <Task>0</Task> <Keywords>0x80000000000000</Keywords> <TimeCreated SystemTime="2020-04-13T20:53:57.894348600Z" /> <EventRecordID>12312</EventRecordID> <Channel>Application</Channel> <Computer>DESKTOP-CDANMI9</Computer> <Security /> </System> - <EventData> <Data>Application: ScreenToGif.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.AccessViolationException at ScreenToGif.ImageUtil.Video.AviWriter.AVISaveOptions(IntPtr, UInt32, Int32, IntPtr[], IntPtr[]) at ScreenToGif.ImageUtil.Video.AviWriter..ctor(System.String, Int32, Int32, Int32, UInt32) at ScreenToGif.Windows.Other.Encoder+<Encode>d__24.MoveNext() at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[[ScreenToGif.Windows.Other.Encoder+<Encode>d__24, ScreenToGif, Version=2.23.1.0, Culture=neutral, PublicKeyToken=null]](<Encode>d__24 ByRef) at ScreenToGif.Windows.Other.Encoder.Encode(System.Collections.Generic.List`1<ScreenToGif.Model.FrameInfo>, Int32, ScreenToGif.Util.Parameters, System.Threading.CancellationTokenSource) at ScreenToGif.Windows.Other.Encoder+<>c__DisplayClass13_0.<InternalAddItem>b__0() at System.Threading.Tasks.Task.Execute() at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef) at System.Threading.Tasks.Task.ExecuteEntry(Boolean) at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at System.Threading.ThreadHelper.ThreadStart(System.Object)</Data> </EventData> </Event> ``` I originally created the project in 2.17.1 (the Portable version), and I saw this issue. I tried downloading 2.23.1 (again, the Portable version), and saw the same problem. Saving via gif works okay. I haven't tried ffmpeg because I don't have it installed, yet. Let me know what I can do to help. I'm a programmer myself, but I've never worked in .NET and rarely on Windows, so I'll be new to this.
kerem 2026-02-26 09:31:44 +03:00
Author
Owner

@NickeManarin commented on GitHub (Apr 13, 2020):

So, the built in AVI encoder is not reliable depending of the compressor used.

When saving, a "Choose your compressor" UI should appear. Do you remember which one did you pick?

Anyway, FFmpeg is the way to go.
You can download it via Options > Extras.

<!-- gh-comment-id:613097752 --> @NickeManarin commented on GitHub (Apr 13, 2020): So, the built in AVI encoder is not reliable depending of the compressor used. When saving, a "Choose your compressor" UI should appear. Do you remember which one did you pick? Anyway, FFmpeg is the way to go. You can download it via Options > Extras.
Author
Owner

@Swandog commented on GitHub (Apr 13, 2020):

Yeah, I just tried FFmpeg and it worked great.

I didn't see a "Choose your compressor" option. When I click to save the AVI, I see an entry show up in the "Encoding" window with a status of 0%, and then all windows crash. Is there supposed to be a pop-up window at that point?

Anyway, FFmpeg is sufficient for me so this is not something you need to care about, just thought it might be useful.

<!-- gh-comment-id:613099059 --> @Swandog commented on GitHub (Apr 13, 2020): Yeah, I just tried FFmpeg and it worked great. I didn't see a "Choose your compressor" option. When I click to save the AVI, I see an entry show up in the "Encoding" window with a status of 0%, and then all windows crash. Is there supposed to be a pop-up window at that point? Anyway, FFmpeg is sufficient for me so this is not something you need to care about, just thought it might be useful.
Author
Owner

@NickeManarin commented on GitHub (Apr 13, 2020):

Ah, it crashed before the window.

I'm going to try to fix this anyway, the entire app should not close like that.

<!-- gh-comment-id:613099906 --> @NickeManarin commented on GitHub (Apr 13, 2020): Ah, it crashed before the window. I'm going to try to fix this anyway, the entire app should not close like that.
Author
Owner

@NickeManarin commented on GitHub (Apr 13, 2020):

Just to check, a recording created with the new version has the same result while saving with the built in encoder? (a crash)

<!-- gh-comment-id:613100371 --> @NickeManarin commented on GitHub (Apr 13, 2020): Just to check, a recording created with the new version has the same result while saving with the built in encoder? (a crash)
Author
Owner

@Swandog commented on GitHub (Apr 13, 2020):

Yeah. I just tried creating a new recording using 2.23.1 Portable, and I got the same result.

(I gotta go do some work but I'll check back on this later tonight. Let me know what else I can do)

<!-- gh-comment-id:613101945 --> @Swandog commented on GitHub (Apr 13, 2020): Yeah. I just tried creating a new recording using 2.23.1 Portable, and I got the same result. (I gotta go do some work but I'll check back on this later tonight. Let me know what else I can do)
Author
Owner

@NickeManarin commented on GitHub (Apr 21, 2021):

The system's AVI encoder was removed from v2.28.

It's recommended to export as MP4, WEBM or MKV using FFmpeg instead.

<!-- gh-comment-id:823771321 --> @NickeManarin commented on GitHub (Apr 21, 2021): The system's AVI encoder was removed from v2.28. It's recommended to export as MP4, WEBM or MKV using FFmpeg instead.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ScreenToGif#519
No description provided.