forked from forks/ffprobe-wasm
Calculate nb_frames for MKV using duration and fps.
This commit is contained in:
@@ -178,15 +178,14 @@ FramesResponse get_frames(int offset) {
|
||||
if (video_stream_index == -1) {
|
||||
video_stream_index = i;
|
||||
nb_frames = pFormatContext->streams[i]->nb_frames;
|
||||
|
||||
// Calculate the nb_frames for MKV/WebM if nb_frames is 0.
|
||||
if (nb_frames == 0) {
|
||||
nb_frames = (pFormatContext->duration / 1000000) * pFormatContext->streams[i]->avg_frame_rate.num;
|
||||
}
|
||||
pCodec = pLocalCodec;
|
||||
pCodecParameters = pLocalCodecParameters;
|
||||
}
|
||||
|
||||
printf("Video Codec: resolution %d x %d\n",
|
||||
pLocalCodecParameters->width, pLocalCodecParameters->height);
|
||||
} else if (pLocalCodecParameters->codec_type == AVMEDIA_TYPE_AUDIO) {
|
||||
printf("Audio Codec: %d channels, sample rate %d\n",
|
||||
pLocalCodecParameters->channels, pLocalCodecParameters->sample_rate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
2
www/package-lock.json
generated
2
www/package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ffprobe-wasm",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.1",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ffprobe-wasm",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.1",
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build",
|
||||
|
||||
Reference in New Issue
Block a user