0

I have a video, that when checked with ffmpeg/ffprobe shows a horizontal aspect ratio.

ffprobe.exe my_video.mp4 -show_streams -of json

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'my_video.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf60.16.100
  Duration: 00:06:50.04, start: 0.000000, bitrate: 15240 kb/s
  Stream #0:0[0x1](und): Audio: mp3 (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 192 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Video: hevc (Main) (hev1 / 0x31766568), yuvj420p(pc, bt709), 3072x1728, 15044 kb/s, 25 fps, 25 tbr, 90k tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
    "streams": [
        {
            "index": 0,
            "codec_name": "mp3",
            "codec_long_name": "MP3 (MPEG audio layer 3)",
            "codec_type": "audio",
            // ...
        },
        {
            "index": 1,
            "codec_name": "hevc",
            "codec_long_name": "H.265 / HEVC (High Efficiency Video Coding)",
            "profile": "Main",
            "codec_type": "video",
            "codec_tag_string": "hev1",
            "codec_tag": "0x31766568",
            "width": 3072,                  <-----------
            "height": 1728,                 <-----------
            "coded_width": 3072,
            "coded_height": 1728,
            //...
        }
    ]
}

But the frames are in fact vertical:

ffprobe.exe my_video.mp4 -show_frames -of json

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'my_video.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf60.16.100
  Duration: 00:06:50.04, start: 0.000000, bitrate: 15240 kb/s
  Stream #0:0[0x1](und): Audio: mp3 (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 192 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Video: hevc (Main) (hev1 / 0x31766568), yuvj420p(pc, bt709), 3072x1728, 15044 kb/s, 25 fps, 25 tbr, 90k tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
    "frames": [
        {
            "media_type": "video",
            "stream_index": 1,
            "key_frame": 1,
            "pts": 0,
            "pts_time": "0.000000",
            "pkt_dts": 0,
            "pkt_dts_time": "0.000000",
            "best_effort_timestamp": 0,
            "best_effort_timestamp_time": "0.000000",
            "pkt_duration": 3600,
            "pkt_duration_time": "0.040000",
            "duration": 3600,
            "duration_time": "0.040000",
            "pkt_pos": "44",
            "pkt_size": "577224",
            "width": 1728,                              <------------------
            "height": 3072,                             <------------------
            "pix_fmt": "yuvj420p",
            "pict_type": "I",
            "coded_picture_number": 0,
            "display_picture_number": 0,
            "interlaced_frame": 0,
            "top_field_first": 0,
            "repeat_pict": 0,
            "color_range": "pc",
            "color_space": "bt709",
            "color_primaries": "bt709",
            "color_transfer": "bt709",
            "chroma_location": "left",
            "side_data_list": [
                {
                    "side_data_type": "Mastering display metadata",
                    "red_x": "3000/50000",
                    "red_y": "16500/50000",
                    "green_x": "15000/50000",
                    "green_y": "7500/50000",
                    "blue_x": "32000/50000",
                    "blue_y": "30000/50000",
                    "white_point_x": "15635/50000",
                    "white_point_y": "16450/50000",
                    "min_luminance": "0/10000",
                    "max_luminance": "0/10000"
                }
            ]
        },
        ...

How can I fix the streams metadata (using FFmpeg) to have vertical aspect ratio without reencoding the video?


Edit 1: When the video stream is extracted, e.g. with ffmpeg -i my_video.mp4 -c copy my_video.265, the frames appear to be horizontal (i.e. ffprobe.exe my_video.265 -show_frames -of json shows width: 3072 and height: 1728) but the stream is corrupted and playback shows green frames with decoding artifacts.

4
  • What is the output after converting to "raw" H.265? ffmpeg -i my_video.mp4 -c copy my_video.265
    – Rotem
    Commented Jun 19 at 16:10
  • @Rotem I udpdated the question with the answer
    – sthlm58
    Commented Jun 19 at 16:17
  • I meant to ask, what is the output of ffprobe.exe my_video.265 -show_streams -of json and ffprobe.exe my_video.265 -show_frames -of json ?
    – Rotem
    Commented Jun 19 at 18:34
  • @Rotem When the video stream is extracted, e.g. with ffmpeg -i my_video.mp4 -c copy my_video.265, the frames appear to be horizontal (i.e. ffprobe.exe my_video.265 -show_frames -of json shows width: 3072 and height: 1728) but the stream is corrupted and playback shows green frames with decoding artifacts.
    – sthlm58
    Commented Jun 20 at 7:31

0

You must log in to answer this question.

Browse other questions tagged .