[GH-ISSUE #107] Error when using x264 encoder #96

Closed
opened 2026-02-26 08:45:18 +03:00 by kerem · 7 comments
Owner

Originally created by @Roemer on GitHub (Mar 15, 2017).
Original GitHub issue: https://github.com/NickeManarin/ScreenToGif/issues/107

I tried using the x264 VFW encoder (https://sourceforge.net/projects/x264vfw/) and when encoding with it, I get the following error:

Win32Exception
BadFormat

at ScreenToGif.FileWriters.AviWriter..ctor(String path, Int32 frameRate, Int32 width, Int32 height, UInt32 quality)
at ScreenToGif.Windows.Other.Encoder.Encode(List`1 listFrames, Int32 id, Parameters param, CancellationTokenSource tokenSource)

Originally created by @Roemer on GitHub (Mar 15, 2017). Original GitHub issue: https://github.com/NickeManarin/ScreenToGif/issues/107 I tried using the x264 VFW encoder (https://sourceforge.net/projects/x264vfw/) and when encoding with it, I get the following error: **Win32Exception** **BadFormat** > at ScreenToGif.FileWriters.AviWriter..ctor(String path, Int32 frameRate, Int32 width, Int32 height, UInt32 quality) > at ScreenToGif.Windows.Other.Encoder.Encode(List`1 listFrames, Int32 id, Parameters param, CancellationTokenSource tokenSource)
kerem 2026-02-26 08:45:18 +03:00
Author
Owner

@NickeManarin commented on GitHub (Mar 15, 2017):

I downloaded, installed (checked both x86 and x64) and saved the video successfully.

Btw, I have 64 bits system.

From what I understand, an assembly specifically built for x86 and running in a 64-bit operating system can only load libraries built for x86 or a BadImageFormatException will be thrown. In a 64-bit OS, an assembly built for Any CPU or x64 will throw the same exception when trying to load an x86 library.
Source

<!-- gh-comment-id:286720461 --> @NickeManarin commented on GitHub (Mar 15, 2017): I downloaded, installed (checked both x86 and x64) and saved the video successfully. Btw, I have 64 bits system. > From what I understand, an assembly specifically built for x86 and running in a 64-bit operating system can only load libraries built for x86 or a BadImageFormatException will be thrown. In a 64-bit OS, an assembly built for Any CPU or x64 will throw the same exception when trying to load an x86 library. [Source](http://stackoverflow.com/a/2728678/1735672)
Author
Owner

@koppor commented on GitHub (Apr 26, 2017):

I found this page when googling for "bei ScreenToGif.Windows.Other.Encoder.Encode(List1 listFrames, Int32 id, Parameters param, CancellationTokenSource tokenSource)". Possibly unrelated, because I am using ffmpeg installed via choco install ffmpeg.

grafik

Also Win10, 64bit

<!-- gh-comment-id:297273482 --> @koppor commented on GitHub (Apr 26, 2017): I found this page when googling for "bei ScreenToGif.Windows.Other.Encoder.Encode(List1 listFrames, Int32 id, Parameters param, CancellationTokenSource tokenSource)". Possibly unrelated, because I am using ffmpeg installed via `choco install ffmpeg`. ![grafik](https://cloud.githubusercontent.com/assets/1366654/25423396/d702ceee-2a64-11e7-9caf-ac419c142b39.png) Also Win10, 64bit
Author
Owner

@NickeManarin commented on GitHub (Apr 26, 2017):

@koppor Can you copy and paste here the text from the other window that opens if you click on "Ausnahme" (top-right corner)?

With the next version of ScreenToGif, encoding with FFmpeg should be easier, I replaced the default "Extra" parameter with a more common set of parameters.

<!-- gh-comment-id:297415053 --> @NickeManarin commented on GitHub (Apr 26, 2017): @koppor Can you copy and paste here the text from the other window that opens if you click on "Ausnahme" (top-right corner)? With the next version of ScreenToGif, encoding with FFmpeg should be easier, I replaced the default "Extra" parameter with a more common set of parameters.
Author
Owner

@AlexFielder commented on GitHub (Jun 29, 2017):

Hi @NickeManarin I'm not sure if you have changed the settings from when @koppor replied but I too am getting a similar error with a chocolatey-installed version of ffmpeg:

at ScreenToGif.Windows.Other.Encoder.Encode(List1 listFrames, Int32 id, Parameters param, CancellationTokenSource tokenSource)

ffmpeg version 3.3.2 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 7.1.0 (GCC)
configuration:
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
Input #0, concat, from 'C:\Users\Alex.Fielder\AppData\Local\Temp\ScreenToGif\Recording\2017-06-29 16-22-55\Encode 2017-06-29 05-10-39\concat.txt':
Duration: 00:00:51.46, start: 0.000000, bitrate: 14 kb/s
Stream #0:0: Video: png, rgba(pc), 1936x1015 [SAR 3779:3779 DAR 1936:1015], 25 tbr, 25 tbn, 25 tbc
Unknown encoder 'libx264'`

My (unchanged from default) extras being thus:

-c:v libx264 -pix_fmt yuv420p -vf "pad=width={W}:height={H}:x=0:y=0:color=black"

<!-- gh-comment-id:312017162 --> @AlexFielder commented on GitHub (Jun 29, 2017): Hi @NickeManarin I'm not sure if you have changed the settings from when @koppor replied but I too am getting a similar error with a chocolatey-installed version of ffmpeg: ` at ScreenToGif.Windows.Other.Encoder.Encode(List`1 listFrames, Int32 id, Parameters param, CancellationTokenSource tokenSource) ffmpeg version 3.3.2 Copyright (c) 2000-2017 the FFmpeg developers built with gcc 7.1.0 (GCC) configuration: libavutil 55. 58.100 / 55. 58.100 libavcodec 57. 89.100 / 57. 89.100 libavformat 57. 71.100 / 57. 71.100 libavdevice 57. 6.100 / 57. 6.100 libavfilter 6. 82.100 / 6. 82.100 libswscale 4. 6.100 / 4. 6.100 libswresample 2. 7.100 / 2. 7.100 Input #0, concat, from 'C:\Users\Alex.Fielder\AppData\Local\Temp\ScreenToGif\Recording\2017-06-29 16-22-55\Encode 2017-06-29 05-10-39\concat.txt': Duration: 00:00:51.46, start: 0.000000, bitrate: 14 kb/s Stream #0:0: Video: png, rgba(pc), 1936x1015 [SAR 3779:3779 DAR 1936:1015], 25 tbr, 25 tbn, 25 tbc Unknown encoder 'libx264'` My (unchanged from default) extras being thus: `-c:v libx264 -pix_fmt yuv420p -vf "pad=width={W}:height={H}:x=0:y=0:color=black"`
Author
Owner

@NickeManarin commented on GitHub (Dec 24, 2017):

Ok, let's analyze this:

@Roemer Can you tell me which version of the x264 VFW encoder did you install? I installed both 32bits and 64 bits and it was working.

@koppor Your post was a little bit unrelated indeed. This issue ticket is related to the System encoder and not the FFmpeg encoder. Anyway, with version 2.11 of ScreenToGif, can you save as a video successfully?

@AlexFielder I did change something from that older release to the one that you used, one of the changes involved the addition of the "Extras" field where these new parameters were added. Do you remember if the FFmpeg version that you had was compiled with the flag --enable-libx264?

<!-- gh-comment-id:353798961 --> @NickeManarin commented on GitHub (Dec 24, 2017): Ok, let's analyze this: @Roemer Can you tell me which version of the **x264 VFW encoder** did you install? I installed both 32bits and 64 bits and it was working. @koppor Your post was a little bit unrelated indeed. This issue ticket is related to the **System** encoder and not the **FFmpeg** encoder. Anyway, with version 2.11 of ScreenToGif, can you save as a video successfully? @AlexFielder I did change something from that older release to the one that you used, one of the changes involved the addition of the "Extras" field where these new parameters were added. Do you remember if the FFmpeg version that you had was compiled with the flag **--enable-libx264**?
Author
Owner

@dogancelik commented on GitHub (Nov 22, 2018):

Edit: I updated to version 2.14.1

It works now but you need to click "Configure" in the system dialog and set a filename

So after you press OK, you get two files: One created by ScreenToGif and one by VFW encoder.

ScreenToGif creates a 3 KB file, it looks like this

The VFW encoder file creates a separate video file in that dialog you specify.
Output mode: VFW did not work for me.

<!-- gh-comment-id:440907250 --> @dogancelik commented on GitHub (Nov 22, 2018): ### Edit: I updated to version 2.14.1 **It works now** but you need to click "Configure" in the system dialog and [set a filename](https://user-images.githubusercontent.com/486818/48881515-e270a080-ee26-11e8-9f56-a97030be77af.PNG) So after you press OK, you get two files: One created by ScreenToGif and one by VFW encoder. ScreenToGif creates a 3 KB file, [it looks like this](https://user-images.githubusercontent.com/486818/48881620-72164f00-ee27-11e8-9228-99f0290fd335.png) The VFW encoder file creates a separate video file in that dialog you specify. **Output mode: VFW did not work for me.**
Author
Owner

@NickeManarin commented on GitHub (Mar 3, 2020):

Closing this due to inactivity.

<!-- gh-comment-id:594121878 --> @NickeManarin commented on GitHub (Mar 3, 2020): Closing this due to inactivity.
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#96
No description provided.