microsoft/Azure-Kinect-Sensor-SDK

RGB resolution change of saved .mkv file

tamaskaracsony opened this issue · 0 comments

Is your feature request related to a problem? Please describe.

4k video is not playing back in the viewer, thus it would be needed to be converted down to a lower resolution after recording.

Describe the solution you'd like

Open a recorded video and change the resolution afterward e.g.: 4k to 1444P or 1080P and save it as a new file

Describe alternatives you've considered

  • Solve the bug in the 4k video replay in Azure Kinect Viewer

  • change resolution of the 4k video with ffmpeg:

    @echo off
    
    set input_file=input.mkv
    set output_file=output_file_1080p.mkv
    set resolution=1080P
    
    if "%1" == "-r" (
      set resolution=%2
      shift
      shift
    )
    
    if "%1" == "-i" (
      set input_file=%2
      shift
      shift
    )
    
    if "%1" == "-o" (
      set output_file=%2
      shift
      shift
    ) else (
      set output_file=%input_file:.mkv=_%resolution%.mkv
    )
    
    if "%resolution%" == "1440P" (
      set width=2560
      set height=1440
    ) else if "%resolution%" == "2160P" (
      set width=3840
      set height=2160
    ) else if "%resolution%" == "1080P" (
      set width=1920
      set height=1080
    ) else if "%resolution%" == "720P" (
      set width=1280
      set height=720
    ) else (
      echo Invalid resolution: %resolution%. Use 2160P, 1440P, 1080P, or 720P.
      goto end
    )
    
    ffmpeg -i %input_file% -map 0:v:0 -c:v:0 mjpeg -q:v:0 0 -filter:v:0 "scale=%width%:%height%" -map_metadata 0 -map_chapters 0 -c:a copy -map 0:v:1 -allow_raw_vfw 1 -c:v:1 copy -map 0:v:2 -allow_raw_vfw 1 -c:v:2 copy -map 0:3 -c:3 copy -map 0:a? %output_file%
    
    :end
    

Additional context