[ffmpeg] v8.6.0/8.6.1 - MagickImageCollection partially retrieves frames of certain mp4 videos
See original GitHub issueDescription
On Magick.NET version 8.6.0 and 8.6.1, loading an mp4 in a MagickImageCollection only returns a partial amount of frames and fails to properly reproduce all frames from the source video(s) on certain mp4 files.
Steps to Reproduce
Ensure ffmpeg 4.4.1 exists in the PATH
env variable and rename the attached mp4 to ryu.mp4
if not already named:
- Create a new dotnet console app targeting .NET 6 using
dotnet new console
- Add Magick.NET-Q16-x64 v8.6.1 NuGet package
- Paste the following code into Program.cs
- Build using
dotnet build -c Release -r win-x64
- Copy the
ryu.mp4
tobin\Release\net6.0\win-x64
- Run the executable from the
bin\Release\net6.0\win-x64
directory
using (var imgCol = new MagickImageCollection("ryu.mp4"))
{
Console.WriteLine("Total frames: " + imgCol.Count);
await imgCol.WriteAsync("ryu1.mp4");
await imgCol.WriteAsync("ryu1.gif");
}
using (var imgCol = new MagickImageCollection("ryu1.mp4"))
{
Console.WriteLine("Total frames: " + imgCol.Count);
}
using (var imgCol = new MagickImageCollection("ryu1.gif"))
{
Console.WriteLine("Total frames: " + imgCol.Count);
}
https://user-images.githubusercontent.com/4016293/149682455-8ad5a0bc-6de5-4e68-aa66-fe273d4a1a45.mp4
The output on 8.6.1 should be:
Total frames: 5
Total frames: 5
Total frames: 5
On 8.5.0, the output should be:
Total frames: 119
Total frames: 119
Total frames: 119
BONUS targeting arm64
Use the same steps to build as above, but with the following modifications:
- Use
Magick.NET-Q16-arm64
- Build using
dotnet build -c Release -r win-arm64
- Copy the
ryu.mp4
tobin\Release\net6.0\win-arm64
- Run the executable from the
bin\Release\net6.0\win-arm64
directory
8.6.1 on arm64 (Magick.NET-Q16-arm64) returns:
Total frames: 1
Total frames: 1
Total frames: 1
0.2022.113.2048 returns:
Total frames: 119
Total frames: 119
Total frames: 119
System Configuration
- Magick.NET version: 8.6.1
- Environment (Operating system, version and so on): Windows 11 Arm64 22533, .NET 6.0 (x64 compiled app).
- Additional information:
- Using FFMPEG 4.4.1 from https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-4.4.1-full_build.7z.
- FFMPEG 4.4.1 Arm64 built from vcpkg (attached, but can be built with the command below):
-
.\vcpkg.exe install ffmpeg[ffmpeg,fdk-aac,fontconfig,freetype,fribidi,iconv,ilbc,lzma,mp3lame,modplug,opencl,openjpeg,openssl,opus,sdl2,snappy,soxr,speex,theora,vorbis,vpx,webp]:arm64-windows-static
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I hope I understand your question correctly but instead of having a picture for each frame you name have a picture that is valid for an “AnimationDelay”. That means that if a frame doesn’t change each frame it will be valid for “AnimationDelay”.
Because we now use
webp
instead ofpam
as the format when reading the frames of the fle. The number of frames is changed because the animation delay is now set. You can see that when you print the following:In earlier versions this value was
0
.