0

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':
  Metadata:
    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)
    Metadata:
      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?

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

Your Answer

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

Browse other questions tagged or ask your own question.