Skip to content

Instantly share code, notes, and snippets.

@daz
Created June 2, 2025 10:05
Show Gist options
  • Save daz/fe7fd07634dea58a0d8c799847ee3cc2 to your computer and use it in GitHub Desktop.
Save daz/fe7fd07634dea58a0d8c799847ee3cc2 to your computer and use it in GitHub Desktop.
djifix Mini 4 Pro H.265 30fps

Good file:

ffprobe -i DJI_20250602113903_0003_D.MP4                                                                                                                           

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'DJI_20250602113903_0003_D.MP4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    creation_time   : 2025-06-02T01:39:03.000000Z
    encoder         : DJI Mini4 Pro
  Duration: 00:05:25.49, start: 0.000000, bitrate: 92439 kb/s
  Stream #0:0[0x1](und): Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, bt709), 3840x2160, 89940 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)
      Metadata:
        creation_time   : 2025-06-02T01:39:03.000000Z
        handler_name    : VideoHandler
        vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Data: none (djmd / 0x646D6A64), 73 kb/s
      Metadata:
        creation_time   : 2025-06-02T01:39:03.000000Z
        handler_name    : DJI meta
  Stream #0:2[0x3](und): Data: none (dbgi / 0x69676264), 2378 kb/s
      Metadata:
        creation_time   : 2025-06-02T01:39:03.000000Z
        handler_name    : DJI dbgi
  Stream #0:3[0x0]: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 1280x720 [SAR 1:1 DAR 16:9], 90k tbr, 90k tbn (attached pic)

djifix version 2025-04-10

~/bin/djifix DJI_20250602114429_0004_D.MP4

Through trial and error of all options, select 60fps H.265 even though it's 29.97, because 30fps option didn't work:

If the video format was H.265, 2160(x3840)p(UHD-1), 60fps: Type 3, then the "Return" key.

This only opens in VLC and plays at 2x:

ffmpeg -i DJI_20250602114429_0004_D-repaired3.h264 -c copy DJI_20250602114429_0004_D-repaired3.MP4

So need to do:

ffmpeg -r 60 -i DJI_20250602114429_0004_D-repaired3.h264 \
  -filter:v "setpts=2*PTS" \
  -c:v hevc_videotoolbox -b:v 90M -r 29.97 -pix_fmt yuv420p \
  -tag:v hvc1 -movflags +faststart \
  DJI_20250602114429_0004_D-repaired3_fixed.MP4

Which does this:

  • Force fps and then filter to play at native 29.97fps
  • 90M bitrate option copied from ffprobe of a good file
  • -tag, movflags for Quicktime

Or with libx265 instead of videotoolbox:

ffmpeg -r 60 -i DJI_20250602114429_0004_D-repaired3.h264 \
  -filter:v "setpts=2*PTS" \
  -c:v libx265 -b:v 90M -r 29.97 \
  -tag:v hvc1 -movflags +faststart \
  DJI_20250602114429_0004_D-repaired3_fixed_libx265.MP4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment