I'm using ffmpeg to create screencasts. The command looks like this:

ffmpeg -f x11grab -framerate 30 \
    $(xwininfo | gawk 'match($0, /-geometry ([0-9]+x[0-9]+).([0-9]+).([0-9]+)/, a)\
      { print "-video_size " a[1] " -i +" a[2] "," a[3] }') \
    screencast$(date +%H%M%S).mp4

When I import those into Camtasia for editing, I get a video of the correct dimensions, but it shows only blackness. I've found that I can make the import work if I re-encode the screencasts with handbrake.

HandBrakeCLI -i screencast101253.mp4 -o screencast101253.m4v

This is what ffprobe says this about the videos that handbrake creates:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'screencast101253.m4v':
    major_brand     : mp42
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 2020-12-04T17:54:49.000000Z
    title           : screencast102753
    encoder         : HandBrake 1.2.2 2019022400
  Duration: 00:01:43.93, start: 0.000000, bitrate: 81 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1256x1080 [SAR 270:347 DAR 314:347], 77 kb/s, 30 fps, 30 tbr, 90k tbn, 180k tbc (default)
      creation_time   : 2020-12-04T17:54:49.000000Z
      handler_name    : VideoHandler

My question is: how can I change the ffmpeg command so that it produces a Camtasia-compatible video in the first place--so that I don't have to wait on handbrake?

  • 1
    Need to see ffprobe for the ffmpeg created file, but probably as simple as adding -pix_fmt yuv420p
    – Gyan
    Dec 5, 2020 at 4:59

1 Answer 1


@Gyan is correct. add -pix_fmt yuv420p

I was in the exact situation @MatrixManAtYrService described and the video imported into Camtasia Studio correctly after converting with -pix_fmt yuv420p

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.