Export Failure on with hardware encoder on Mac

Hi,

I have used Shotcut successfully for a longer period of time on my Intel-based Mac mini. Now I want to transfer usage to my Macbook Air M1 with significantly more horsepower. But exports keep failing on the newer machine.

Down below you can find what the log of the failed export says. What I have tried already:

  • Started Shotcut from scratch on the Macbook
  • Copied the whole prefs folder (“‘/Users/vs/Library/Application Support/Meltytech/Shotcut’”) to the new machine
  • varied formats, resolutions, filters etc. I typically use something likes this:

All to no avail. Any Export fails. I even tried to save the playlist, open it on the old Mac and tried exporting. This works, but I want to use the Macbook Air for exports, which fails so far.

This is what the failed export log says. Anyone who fluently speaks “Shotcut Log”? Any hint would be greatly appreciated. Thanks!

Regards, Joe

[h264 @ 0x12d922e20] Reinit context to 1280x720, pix_fmt: yuv420p
[h264 @ 0x12d8d0740] Reinit context to 1280x720, pix_fmt: yuv420p
[h264 @ 0x12d8d6950] Reinit context to 1280x720, pix_fmt: yuv420p
[producer avformat] audio: total_streams 1 max_stream 0 total_channels 2 max_channels 2
[AVIOContext @ 0x12d91db40] Statistics: 378175 bytes read, 3 seeks
[chain avformat-novalidate] /Volumes/IOMEGA Image/zMovies/test_v15#_1,441.mp4
checking VFR: pkt.duration 1500
[aac @ 0x10c80fcc0] Could not update timestamps for skipped samples.
[h264 @ 0x11c8be6c0] Reinit context to 1280x720, pix_fmt: yuv420p
[in @ 0x600003155810] w:1920 h:1080 pixfmt:yuyv422 tb:1/25 fr:25/1 sar:1/1 csp:unknown range:unknown
[hue @ 0x600003155970] H_expr:(null) h_deg_expr:0 s_expr:1.11 b_expr:-0.1
[scale @ 0x600003155a20] w:1920 h:1080 flags:‘bicubic+accurate_rnd+full_chroma_int+full_chroma_inp’ interl:0
[auto_scale_0 @ 0x600003155b80] w:iw h:ih flags:‘bicubic+accurate_rnd+full_chroma_int+full_chroma_inp’ interl:0
[out @ 0x6000031558c0] auto-inserting filter ‘auto_scale_0’ between the filter ‘pad’ and the filter ‘out’
[auto_scale_1 @ 0x600003155c30] w:iw h:ih flags:‘bicubic+accurate_rnd+full_chroma_int+full_chroma_inp’ interl:0
[hue @ 0x600003155970] auto-inserting filter ‘auto_scale_1’ between the filter ‘in’ and the filter ‘hue’
[auto_scale_1 @ 0x600003155c30] w:1920 h:1080 fmt:yuyv422 csp:unknown range:unknown sar:1/1 → w:1920 h:1080 fmt:yuv422p csp:unknown range:unknown sar:1/1 flags:0x00046004
[auto_scale_1 @ 0x600003155c30] [framesync @ 0x12d8e5f78] Selected 1/25 time base
[auto_scale_1 @ 0x600003155c30] [framesync @ 0x12d8e5f78] Sync level 1
[scale @ 0x600003155a20] w:1920 h:1080 fmt:yuv422p csp:unknown range:unknown sar:1/1 → w:1920 h:1080 fmt:yuv422p csp:unknown range:unknown sar:1/1 flags:(null)
[scale @ 0x600003155a20] [framesync @ 0x12d8e4238] Selected 1/25 time base
[scale @ 0x600003155a20] [framesync @ 0x12d8e4238] Sync level 1
[pad @ 0x600003155ad0] w:1920 h:1080 → w:1920 h:1080 x:0 y:0 color:0x000000FF
[auto_scale_0 @ 0x600003155b80] w:1920 h:1080 fmt:yuv422p csp:unknown range:unknown sar:1/1 → w:1920 h:1080 fmt:yuyv422 csp:unknown range:unknown sar:1/1 flags:0x00046004
[auto_scale_0 @ 0x600003155b80] [framesync @ 0x12d8e58f8] Selected 1/25 time base
[auto_scale_0 @ 0x600003155b80] [framesync @ 0x12d8e58f8] Sync level 1
[in @ 0x600003155810] Changing video frame properties on the fly is not supported by all filters.
[in @ 0x600003155810] filter context - w: 1920 h: 1080 fmt: 1 csp: unknown range: unknown, incoming frame - w: 1920 h: 1080 fmt: 1 csp: bt709 range: unknown pts_time: 0
[auto_scale_1 @ 0x600003155c30] w:1920 h:1080 fmt:yuyv422 csp:unknown range:unknown sar:1/1 → w:1920 h:1080 fmt:yuv422p csp:unknown range:unknown sar:1/1 flags:0x00046004
[auto_scale_1 @ 0x600003155c30] [framesync @ 0x12d8e5f78] Sync level 1
[auto_scale_1 @ 0x600003155c30] w:1920 h:1080 fmt:yuyv422 csp:unknown range:unknown sar:1/1 → w:1920 h:1080 fmt:yuv422p csp:unknown range:unknown sar:1/1 flags:0x00046004
[auto_scale_1 @ 0x600003155c30] [framesync @ 0x12d8e5f78] Sync level 1
[auto_scale_1 @ 0x600003155c30] w:1920 h:1080 fmt:yuyv422 csp:bt709 range:unknown sar:1/1 → w:1920 h:1080 fmt:yuv422p csp:unknown range:unknown sar:1/1 flags:0x00046004
[auto_scale_1 @ 0x600003155c30] [framesync @ 0x12d8e5f78] Sync level 1
[h264_videotoolbox @ 0x11c8b7c00] Color range not set for nv12. Using MPEG range.
[mp4 @ 0x11c8b7530] pts (512) < dts (1024) in stream 0
[consumer avformat] error writing video frame: -22
[mp4 @ 0x11c8b7530] Starting second pass: moving the moov atom to the beginning of the file
[AVIOContext @ 0x12c60dcd0] Statistics: 72963 bytes read, 0 seeks
[aac @ 0x11c8b8410] Qavg: 48019.586
[aac @ 0x11c8b8410] 2 frames left in the queue on closing
[AVIOContext @ 0x12d906340] Statistics: 147422 bytes written, 4 seeks, 5 writeouts
[AVIOContext @ 0x12d8e2360] Statistics: 1557823 bytes read, 39 seeks
[AVIOContext @ 0x12d8cc960] Statistics: 5326143 bytes read, 145 seeks
Failed with exit code 1

Looks like a problem with hardware encoding. What happens if hardware encoding is turned off?

There is a known bug with the H.264 hardware encoder on some Macs or macOS versions. Either use HEVC with hardware encoder or turn off hardware encoder. The software H.264 encoder is efficient enough that there is really no need to use hardware acceleration.

I’m encountering the same problem with the H.264 hardware encoder not functioning properly on macOS 15. Interestingly, OBS Studio faced a similar issue with screen recording but managed to resolve it in a recent update.

Has anyone found a workaround or fix to enable hardware-accelerated H.264 encoding on macOS 15 for Shotcut? Thanks in advance!

Hi, first of all, thanks to everyone who responded so far. Some more info:

  • I turned off HW encoding for tests. Same result, unfortunately
  • The problem shows up like this: Export starts, and stops more or less immediately at 4 Seconds/6%
  • The resulting file plays for half a second and then stops; input file has 12 MB, output file has 77K.

I also deleted everything around the app files and library files and started with a newly installed Shotcut 25.05.11. Doesn’t have any positive impact.

The log of the failed export reads like this:
[h264 @ 0x155f3a350] Reinit context to 1280x720, pix_fmt: yuv420p
[h264 @ 0x155b568c0] Reinit context to 1280x720, pix_fmt: yuv420p
[h264 @ 0x155f3bfe0] Reinit context to 1280x720, pix_fmt: yuv420p
[producer avformat] audio: total_streams 1 max_stream 0 total_channels 2 max_channels 2
[AVIOContext @ 0x155f38690] Statistics: 133167 bytes read, 1 seeks
[chain avformat-novalidate] /Users/vs/Documents/test.mp4
checking VFR: pkt.duration 1001
[aac @ 0x155f8c9a0] Could not update timestamps for skipped samples.
[h264 @ 0x155f398e0] Reinit context to 1280x720, pix_fmt: yuv420p
[h264_videotoolbox @ 0x155f381f0] Color range not set for nv12. Using MPEG range.
[mp4 @ 0x155f37c10] pts (512) < dts (1024) in stream 0
[consumer avformat] error writing video frame: -22
[mp4 @ 0x155f37c10] Starting second pass: moving the moov atom to the beginning of the file
[AVIOContext @ 0x155a512f0] Statistics: 75124 bytes read, 0 seeks
[aac @ 0x155f38b40] Qavg: 46496.555
[aac @ 0x155f38b40] 2 frames left in the queue on closing
[AVIOContext @ 0x155b5af60] Statistics: 151742 bytes written, 4 seeks, 5 writeouts

Any hint greatly welcome. Thanks again.
Regards, Joe

Your log shows that it is still using the hardware encoder. h264_videotoolbox is the hardware H.264 encoder; the software encoder is libx264. Sometimes, after you turn it off you need to click the Reset button inside the Export panel, or you can restart Shotcut.

I found that the root cause of this problem is simple: Export > Codecs > B frames must be 0. I made a fix for the next version to set this automatically for you. As a workaround simply change it manually.