TPESystem/Media/VideoThumbnail: Difference between revisions
Jump to navigation
Jump to search
| Line 18: | Line 18: | ||
== Possible Solutions == | == Possible Solutions == | ||
<UL> | |||
<LI><b>Use existing APIs or move some implementations to JS</b><br> | |||
For item#1.1~1.2, they could be solved by using a JavaScript module to parse video file and find the time of proper key-frame to seek it. This is under discussion in Bug#971645[https://bugzilla.mozilla.org/show_bug.cgi?id=971645]. <br> | |||
For item#1.3, there seems no existing way to inform gecko not init audio part. <br> | |||
For item#2, createImageBitmap() should be able to reduce the memory usage. <br> | |||
<LI><b>Introduce a new API, mozCreateThumbnail(double time, unsigned long width, unsigned long height) </b> <br> | |||
For item#1.1~1.3, with some modifications in MediaDecoderReader and MediaDecoderStateMachine in gecko could fix those problems. Application can also use the javascript parser module to find a proper time and set it via "time" parameter, or let gecko find a proper frame. <br> | |||
For item#2, memory usage could be reduced in gecko implementations by setting "width" and "height". <br> | |||
</UL> | |||
Revision as of 10:18, 19 February 2014
This page is intended to have an overall summary of discussions in Bug#942078[1] and webapi mailing list[2].
Background
Currently video thumbnail generation is not a good method and there are some room to improve as described below.
- Seek to 1/10th of the duration
- 1/10th may not be a good choice
A better way is to pick the biggest frame of the first 10 key frames as Android does. That frame should contain much information. - Sometimes seeking takes time
Current seeking is a precise way which means it decodes from the closest key-frame to the requested seek frame. If the frame at 1/10 duration is far from key frame, it takes longer. - Seek also applies to audio
Video thumbnail has nothing to do with audio. Need to find a way to avoid audio process.
- 1/10th may not be a good choice
- Use Canvas to draw image and save it as a jpeg file
There is a full-size memory allocation used in Canvas to hold a decoded frame.
Possible Solutions
- Use existing APIs or move some implementations to JS
For item#1.1~1.2, they could be solved by using a JavaScript module to parse video file and find the time of proper key-frame to seek it. This is under discussion in Bug#971645[3].
For item#1.3, there seems no existing way to inform gecko not init audio part.
For item#2, createImageBitmap() should be able to reduce the memory usage.
- Introduce a new API, mozCreateThumbnail(double time, unsigned long width, unsigned long height)
For item#1.1~1.3, with some modifications in MediaDecoderReader and MediaDecoderStateMachine in gecko could fix those problems. Application can also use the javascript parser module to find a proper time and set it via "time" parameter, or let gecko find a proper frame.
For item#2, memory usage could be reduced in gecko implementations by setting "width" and "height".