alfg/ffprobe-wasm

rotation attribute is missing

Closed this issue · 6 comments

Hi,

Thank you for the awesome wasm file. I have tested it but it does not have rotation attribute. Rotation mean if the video is rotated by 90 degrees etc.

Is it possible to add rotation parameter as well.?

alfg commented

Hey @xoraingroup, can you provide an example of this parameter and a sample video I can test this on?

Yes, I guess its coming in tags of video stream and side_data_list. Check below for json output of video with rotation value.

$ ffprobe -v quiet -print_format json -show_format -show_streams 180-rotation.mp4
{
    "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_tag_string": "avc1",
            "codec_tag": "0x31637661",
            "width": 1920,
            "height": 1080,
            "coded_width": 1920,
            "coded_height": 1080,
            "closed_captions": 0,
            "has_b_frames": 0,
            "sample_aspect_ratio": "1:1",
            "display_aspect_ratio": "16:9",
            "pix_fmt": "yuv420p",
            "level": 40,
            "color_range": "tv",
            "color_space": "bt709",
            "color_transfer": "bt709",
            "color_primaries": "bt709",
            "refs": 1,
            "is_avc": "true",
            "nal_length_size": "4",
            "r_frame_rate": "179/6",
            "avg_frame_rate": "46260000/1552147",
            "time_base": "1/90000",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 1551110,
            "duration": "17.234556",
            "bit_rate": "16924035",
            "bits_per_raw_sample": "8",
            "nb_frames": "514",
            "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": {
                "rotate": "180",
                "creation_time": "2018-06-05T21:51:49.000000Z",
                "language": "eng",
                "handler_name": "VideoHandle",
                "vendor_id": "[0][0][0][0]"
            },
            "side_data_list": [
                {
                    "side_data_type": "Display Matrix",
                    "displaymatrix": "\n00000000:       -65536           0           0\n00000001:            0      -65536           0\n00000002:            0           0  1073741824\n",
                    "rotation": -180
                }
            ]
        },
        {
            "index": 1,
            "codec_name": "aac",
            "codec_long_name": "AAC (Advanced Audio Coding)",
            "profile": "LC",
            "codec_type": "audio",
            "codec_tag_string": "mp4a",
            "codec_tag": "0x6134706d",
            "sample_fmt": "fltp",
            "sample_rate": "48000",
            "channels": 2,
            "channel_layout": "stereo",
            "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": 839679,
            "duration": "17.493312",
            "bit_rate": "192112",
            "nb_frames": "820",
            "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": {
                "creation_time": "2018-06-05T21:51:49.000000Z",
                "language": "eng",
                "handler_name": "SoundHandle",
                "vendor_id": "[0][0][0][0]"
            }
        }
    ],
    "format": {
        "filename": "180-rotation.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": "17.493000",
        "size": "37690210",
        "bit_rate": "17236704",
        "probe_score": 100,
        "tags": {
            "major_brand": "mp42",
            "minor_version": "0",
            "compatible_brands": "isommp42",
            "creation_time": "2018-06-05T21:51:49.000000Z",
            "location": "+60.2172+024.6460/",
            "location-eng": "+60.2172+024.6460/",
            "com.android.version": "8.0.0"
        }
    }
}

Also if you put a video with rotation like 90 degree or 180 degress in following website, you will be able to see rotation value like

image

https://mediainfo.js.org/

alfg commented

Thanks for the example @xoraingroup. I'll work on metadata parsing to include those tags on the next build.

alfg commented

@xoraingroup Latest update on https://ffprobe-wasm.netlify.app/ now supports stream tags.

Capture

Super amazing work and thank you. :)

You can announce it in your github documentation as well. Thank you, closing it for now.