Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reassembling mp4 = slowest version. Wrong frame rate? #1178

Open
Nigrimmist opened this issue Apr 17, 2022 · 2 comments
Open

Reassembling mp4 = slowest version. Wrong frame rate? #1178

Nigrimmist opened this issue Apr 17, 2022 · 2 comments

Comments

@Nigrimmist
Copy link

Magick.NET version

Magick.NET-Q8-AnyCPU (11.1.0)

Environment (Operating system, version and so on)

Windows 10 x64, ubuntu

Description

Trying to understand the reason of changing speed of output mp4 during just "read file->get frames->reassemble to new mp4".
Partially, this issue relative to #1102.

So the main issue for me is in different speed in output mp4 and i can't understand how it may be fixed from my side.

original mp4 : https://user-images.githubusercontent.com/1579535/163726073-02a4deed-604e-4ade-913a-fc6f6d684e95.mp4

reassembled version with composing : https://user-images.githubusercontent.com/1579535/163726081-2412720a-1aa0-4667-9049-6aa7cd468251.mp4

reassembled version without any additional actions : https://user-images.githubusercontent.com/1579535/163726125-d576c698-f1d0-4e9e-b72a-0c175ae2ab69.mp4

Steps to Reproduce

I prepared ready-to-run code on github repo to reproduce it : https://github.com/Nigrimmist/MagickFfmpegBugSample (mp4 file included)

Sample code : https://github.com/Nigrimmist/MagickFfmpegBugSample/blob/master/ConsoleApp/Program.cs

I prepared two segments of code, one with using Compose previous frame, one without.

My code execution result is :

Original file (cat.mp4) details (focus on duration) :

Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/iso2/avc1/mp41)
File size : 122 KiB
Duration : 6 s 50 ms
Overall bit rate : 166 kb/s
Writing application : Lavf58.20.100

Output file with composing frames (super slow) :

Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/iso2/avc1/mp41)
File size : 127 KiB
Duration : 23 s 800 ms
Overall bit rate : 43.6 kb/s
Writing application : Lavf59.20.101

Output file without any additional actions during reassembling :

Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/iso2/avc1/mp41)
File size : 82.4 KiB
Duration : 9 s 640 ms
Overall bit rate : 70.0 kb/s
Writing application : Lavf59.20.101

Additional file info properties you can find here : https://pastebin.com/RCHKuVYc. All data got from https://mediaarea.net/'s free/open source soft.

So maybe you have any receipt how it may be "reassembled" without loosing initial speed? Thanks!

@dlemstra
Copy link
Owner

Thanks for the sample so I can read what you are trying to do. It seems that you are modifying the content of each frame. You probably want to use VideoReadDefines and set the IntermediateFormat to Pam which means that frames will no longer have a duration.

@Nigrimmist
Copy link
Author

Nigrimmist commented Apr 18, 2022

You probably want to use VideoReadDefines and set the IntermediateFormat to Pam which means that frames will no longer have a duration.

I tried, but this mp4 was made from gif and it contains delays between frames, so rendering without delays is not an option. The result is - more faster mp4, than original (4.5s vs 6.5s for sample mp4).

It seems that you are modifying the content of each frame.

I have two cases in code, one with changing and second one without (you can see isWithFullFrames param) - so both results are slower than original.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants