ffmpegvideo-encodingvideo-conversion

FFMPEG cannot encode .MP4 to usable .Y4M RAW video: "Operation not permitted"


I am running ffmpeg version 4.2.2 on macOS Sierra and I cannot decode a RAW video.

First I create the .Y4M video:

ffmpeg -y -i inputfolder/GH012088.MP4 temp_raw_video.Y4M

Then I try to input it to ffmpeg:

ffmpeg -i temp_raw_video.Y4M 

However I get the following error in the terminal: temp_raw_video.Y4M: Operation not permitted

I have checked the permissions for the 'temp_raw_video.Y4M' file and I have both read and write permissions.

I have tried the above with .MOV videos from an iPhone and it works fine.

The problem seems to be with the .MP4 videos I am trying to convert. These videos were taken with a GoPro camera.

What is going on here? Please see the GH012088.MP4 file info below:

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb9b6809400] Using non-standard frame rate 29/1
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'inputfolder/GH012088.MP4':
  Metadata:
    major_brand     : mp41
    minor_version   : 538120216
    compatible_brands: mp41
    creation_time   : 2019-12-28T14:12:04.000000Z
    firmware        : HD7.01.01.61.00
  Duration: 00:00:40.47, start: 0.000000, bitrate: 60267 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 3840x2160 [SAR 1:1 DAR 16:9], 60015 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2019-12-28T14:12:04.000000Z
      handler_name    : GoPro AVC  
      encoder         : GoPro AVC encoder
      timecode        : 14:40:34:06
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
    Metadata:
      creation_time   : 2019-12-28T14:12:04.000000Z
      handler_name    : GoPro AAC  
      timecode        : 14:40:34:06
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2019-12-28T14:12:04.000000Z
      handler_name    : GoPro TCD  
      timecode        : 14:40:34:06
    Stream #0:3(eng): Data: bin_data (gpmd / 0x646D7067), 37 kb/s (default)
    Metadata:
      creation_time   : 2019-12-28T14:12:04.000000Z
      handler_name    : GoPro MET  
    Stream #0:4(eng): Data: none (fdsc / 0x63736466), 10 kb/s (default)
    Metadata:
      creation_time   : 2019-12-28T14:12:04.000000Z
      handler_name    : GoPro SOS 

Here is the output log for creating the .Y4M:

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa9da802200] Using non-standard frame rate 29/1
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'inputfolder/GH012088.MP4':
  Metadata:
    major_brand     : mp41
    minor_version   : 538120216
    compatible_brands: mp41
    creation_time   : 2019-12-28T14:12:04.000000Z
    firmware        : HD7.01.01.61.00
  Duration: 00:00:40.47, start: 0.000000, bitrate: 60267 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 3840x2160 [SAR 1:1 DAR 16:9], 60015 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2019-12-28T14:12:04.000000Z
      handler_name    : GoPro AVC  
      encoder         : GoPro AVC encoder
      timecode        : 14:40:34:06
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
    Metadata:
      creation_time   : 2019-12-28T14:12:04.000000Z
      handler_name    : GoPro AAC  
      timecode        : 14:40:34:06
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2019-12-28T14:12:04.000000Z
      handler_name    : GoPro TCD  
      timecode        : 14:40:34:06
    Stream #0:3(eng): Data: bin_data (gpmd / 0x646D7067), 37 kb/s (default)
    Metadata:
      creation_time   : 2019-12-28T14:12:04.000000Z
      handler_name    : GoPro MET  
    Stream #0:4(eng): Data: none (fdsc / 0x63736466), 10 kb/s (default)
    Metadata:
      creation_time   : 2019-12-28T14:12:04.000000Z
      handler_name    : GoPro SOS  
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
Output #0, yuv4mpegpipe, to 'temp_raw_video.Y4M':
  Metadata:
    major_brand     : mp41
    minor_version   : 538120216
    compatible_brands: mp41
    firmware        : HD7.01.01.61.00
    encoder         : Lavf58.29.100
    Stream #0:0(eng): Video: wrapped_avframe, yuvj420p, 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc (default)
    Metadata:
      creation_time   : 2019-12-28T14:12:04.000000Z
      handler_name    : GoPro AVC  
      timecode        : 14:40:34:06
      encoder         : Lavc58.54.100 wrapped_avframe
frame=   43 fps=0.0 q=-0.0 size=  522240kB time=00:00:01.43 bitrate=2981801.3kbiframe=   92 fps= 90 q=-0.0 size= 1117696kB time=00:00:03.06 bitrate=2982723.8kbiframe=  144 fps= 95 q=-0.0 size= 1749504kB time=00:00:04.80 bitrate=2982837.3kbiframe=  190 fps= 94 q=-0.0 size= 2308352kB time=00:00:06.33 bitrate=2982809.6kbiframe=  241 fps= 95 q=-0.0 size= 2928128kB time=00:00:08.04 bitrate=2982978.5kbiframe=  287 fps= 94 q=-0.0 size= 3486976kB time=00:00:09.57 bitrate=2982937.8kbiframe=  336 fps= 95 q=-0.0 size= 4082176kB time=00:00:11.21 bitrate=2982837.3kbiframe=  388 fps= 96 q=-0.0 size= 4713984kB time=00:00:12.94 bitrate=2982864.2kbiframe=  436 fps= 96 q=-0.0 size= 5297152kB time=00:00:14.54 bitrate=frame= 1213 fps= 95 q=-0.0 Lsize=14737957kB time=00:00:40.47 bitrate=2983002.4kbits/s speed=3.19x      
video:635kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2321095.250000%

Solution

  • Apparently, the pixel format yuvj420p is throwing a spanner. I will debug it later.

    The header is overflowing the limit assumed by the demuxer. Patched in git master.

    For now, use,

    ffmpeg -y -i inputfolder/GH012088.MP4 -pix_fmt yuv420p temp_raw_video.Y4M