Probing a webm video returns no duration information

I’m trying to probe a WebM video and I get no duration information back on either the audio or video streams. The rest of the expected information appears to be there.

Example video: https://playmonash-development.s3.ap-southeast-2.amazonaws.com/videos/dc37c43c-0256-40c4-82f2-4f9d3448aa6f.webm

Hey @shealan,

Yes I just checked on https://probe.video but it appears the video doesn’t include any metadata. Where did the clip originate?

I converted it to an MP4 and this attached all the relevant metadata:

{
    "success": true,
    "message": "ok",
    "response": {
        "metadata": {
            "streams": [
                {
                    "index": 0,
                    "codec_name": "h264",
                    "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
                    "profile": "High",
                    "codec_type": "video",
                    "codec_time_base": "1/48",
                    "codec_tag_string": "avc1",
                    "codec_tag": "0x31637661",
                    "width": 1920,
                    "height": 1080,
                    "coded_width": 1920,
                    "coded_height": 1088,
                    "closed_captions": 0,
                    "has_b_frames": 2,
                    "sample_aspect_ratio": "1:1",
                    "display_aspect_ratio": "16:9",
                    "pix_fmt": "yuv420p",
                    "level": 40,
                    "color_range": "tv",
                    "color_space": "bt709",
                    "color_transfer": "iec61966-2-1",
                    "color_primaries": "bt709",
                    "chroma_location": "left",
                    "refs": 1,
                    "is_avc": "true",
                    "nal_length_size": "4",
                    "r_frame_rate": "24/1",
                    "avg_frame_rate": "24/1",
                    "time_base": "1/12288",
                    "start_pts": 0,
                    "start_time": "0.000000",
                    "duration_ts": 40448,
                    "duration": "3.291667",
                    "bit_rate": "2057435",
                    "bits_per_raw_sample": "8",
                    "nb_frames": "79",
                    "disposition": {
                        "default": 1,
                        "dub": 0,
                        "original": 0,
                        "comment": 0,
                        "lyrics": 0,
                        "karaoke": 0,
                        "forced": 0,
                        "hearing_impaired": 0,
                        "visual_impaired": 0,
                        "clean_effects": 0,
                        "attached_pic": 0,
                        "timed_thumbnails": 0
                    },
                    "tags": {
                        "language": "eng",
                        "handler_name": "VideoHandler"
                    }
                },
                {
                    "index": 1,
                    "codec_name": "aac",
                    "codec_long_name": "AAC (Advanced Audio Coding)",
                    "profile": "LC",
                    "codec_type": "audio",
                    "codec_time_base": "1/48000",
                    "codec_tag_string": "mp4a",
                    "codec_tag": "0x6134706d",
                    "sample_fmt": "fltp",
                    "sample_rate": "48000",
                    "channels": 1,
                    "channel_layout": "mono",
                    "bits_per_sample": 0,
                    "r_frame_rate": "0/0",
                    "avg_frame_rate": "0/0",
                    "time_base": "1/48000",
                    "start_pts": 0,
                    "start_time": "0.000000",
                    "duration_ts": 155520,
                    "duration": "3.240000",
                    "bit_rate": "69713",
                    "max_bit_rate": "69713",
                    "nb_frames": "153",
                    "disposition": {
                        "default": 1,
                        "dub": 0,
                        "original": 0,
                        "comment": 0,
                        "lyrics": 0,
                        "karaoke": 0,
                        "forced": 0,
                        "hearing_impaired": 0,
                        "visual_impaired": 0,
                        "clean_effects": 0,
                        "attached_pic": 0,
                        "timed_thumbnails": 0
                    },
                    "tags": {
                        "language": "eng",
                        "handler_name": "SoundHandler"
                    }
                }
            ],
            "chapters": [],
            "format": {
                "filename": "https://shotstack-content.s3.amazonaws.com/support/shealan.mp4",
                "nb_streams": 2,
                "nb_programs": 0,
                "format_name": "mov,mp4,m4a,3gp,3g2,mj2",
                "format_long_name": "QuickTime / MOV",
                "start_time": "0.000000",
                "duration": "3.292000",
                "size": "878705",
                "bit_rate": "2135370",
                "probe_score": 100,
                "tags": {
                    "major_brand": "isom",
                    "minor_version": "512",
                    "compatible_brands": "isomiso2avc1mp41",
                    "encoder": "Lavf59.16.100"
                }
            }
        }
    }
}

I wish I knew about that site before I sat for 15mins installing ffmpeg using brew to confirm the same thing! Bookmarking for the future. haha

The clip is recorded in the browser using the webcam and saved as a blob. Then uploaded to my s3 bucket. The clip plays fine in the browser but you’re right, seems to be missing some metadata. Very strange.

I guess it isn’t really a bug with Shotstack so I guess we can mark this as solved, but if you have any ideas on why that might be happening I’d love to know.

I’m solving the problem by getting the duration from the blob in the browser and submitting that to my API as well, which is passed on to Shockstack. Not ideal but a workaround for now so I can hit my deadline on this project.

1 Like

Missing metadata can be a pretty common problem. Especially if you’re working with UGC type material.

On the roadmap is an ingestion service that will add any missing metadata like this. So in the future that should mean you would have no need for any workarounds like the one you need to go through right now.

It may not help you with this project, but hopefully the next one you’re on this will be one item you won’t have to think about.

Is this useful? fix-webm-duration - npm - I haven’t tried it, but it looks like it applies the metadata to the blob, in the browser, I presume before it is uploaded.

Also, the first answer here suggests you can “repackage” as a webm file through ffmpeg and it will add the metatdata: ffmpeg - How to determine webm duration using ffprobe - Stack Overflow.