Body: <p>I wanted to comment on a thread that already exists on this topic in general, but I just signed up to SO and have not earned my contribution credits yet! If anyone has advice on how to better handle that in the future, I am all ears!!</p>
  <p>None-the-less, here is that thread:</p>
  <p><a href="https://stackoverflow.com/questions/69029439/a-good-way-to-detect-alpha-channel-in-a-video-using-ffmpeg-ffprobe/69030041#69030041?newreg=ba5899a955914c74a99a2e8b4ce3d12c">https://stackoverflow.com/questions/69029439/a-good-way-to-detect-alpha-channel-in-a-video-using-ffmpeg-ffprobe/69030041#69030041?newreg=ba5899a955914c74a99a2e8b4ce3d12c</a></p>
  <p>I tried both the answers listed in that post to detect the presence of an alpha channel in a PR4444 video file.</p>
  <p>For Gyan's answer, I get the following pixel format from any PR4444 file (regardless if encoded with alpha or no alpha), when running part 1:</p>
  <p>yuva444p12le</p>
  <p>As you will see in Gyan's notes, even if a FFprobe returns an &quot;a&quot; in the return string (for the call for pixel format), that does not equate to the presence of an alpha channel. Hence their note for the subsequent (part 2) call...</p>
  <p>I then plugged that into the part 2 of Gyan's answer, but that produced an empty from FFmpeg, and a message providing valid arguments to pair with grep. It seems as though -oP is not a valid arg for grep? Because it wasn't listed in the returned list of options. This is the template I used (pulled verbatim from Gyan's posted solution):</p>
  <p>ffprobe -v 0 -show_entries pixel_format=name:flags=alpha -of compact=p=0 | grep &quot;$PIX_FMT|&quot; | grep -oP &quot;(?&lt;=alpha=)\d&quot;</p>
  <p>Where $PIX_FMT is to be replaced with yuva444p121e (per Gyan's instructions).</p>
  <p>I then tried Benji's solution for part 2, but that just returns the following:</p>
  <p>pix_fmt=yuva444p12le</p>
  <p>Of course, this isn't any more useful than part 1...</p>
  <p>I suspect Gyan is on the right track as he mentions part 2 should produce a boolean result for the presence of an alpha channel. However, either I am misunderstanding the syntax of his template, or something has changed in FFprobe since. There is so limited information out there for this specific task. Hoping someone with more experience and knowledge can help shed some light for me??</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-12-10T03:49:27.963Z
Comments.Text: Your version of grep may not have PCRE enabled, which is required for `P` portion of `-oP`. In any case, if `a` comes right after `yuv` ot `rgb`, alpha is present.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-12-10T04:47:41.733Z
Comments.Text: Interesting... I encoded the file myself in After Effects and selected the RGB/Millions of Colors option in the render settings (Instead of RGBA/Millions of Colors+). Then, I brought the rendered file back into After Effects and there is no visible alpha channel present. I added a "Set Channels" effect to the footage and turned off RGB channels (left alpha channel alone). The result is a full black frame. Perhaps PR4444 just always returns yuva from the FFprobe library used for pixel format? Or perhaps PR4444 always encodes with allotment for alpha data, even if it is all zeros?
Comments.UserDisplayName: user43134
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-12-10T05:08:15.833Z
Comments.Text: It could be the behaviour of the Adobe encoder. The ffmpeg decoder won't report alpha if the component isn't present. The presence of the channel is distinct from its contents (whether all zeros or not).
Comments.UserDisplayName: Gyan
Tags: <ffmpeg><ffprobe>
Title: Using FFmpeg to detect alpha channel in PR4444 file
UserDisplayName: user43134
ThreadText: # Using FFmpeg to detect alpha channel in PR4444 file
  
  (Asked by: username_0 on 2023-12-10)
  
  I wanted to comment on a thread that already exists on this topic in general, but I just signed up to SO and have not earned my contribution credits yet! If anyone has advice on how to better handle that in the future, I am all ears!!
  
  None-the-less, here is that thread:
  
  <https://stackoverflow.com/questions/69029439/a-good-way-to-detect-alpha-channel-in-a-video-using-ffmpeg-ffprobe/69030041#69030041?newreg=ba5899a955914c74a99a2e8b4ce3d12c>
  
  I tried both the answers listed in that post to detect the presence of an alpha channel in a PR4444 video file.
  
  For username_1's answer, I get the following pixel format from any PR4444 file (regardless if encoded with alpha or no alpha), when running part 1:
  
  yuva444p12le
  
  As you will see in username_1's notes, even if a FFprobe returns an "a" in the return string (for the call for pixel format), that does not equate to the presence of an alpha channel. Hence their note for the subsequent (part 2) call...
  
  I then plugged that into the part 2 of username_1's answer, but that produced an empty from FFmpeg, and a message providing valid arguments to pair with grep. It seems as though -oP is not a valid arg for grep? Because it wasn't listed in the returned list of options. This is the template I used (pulled verbatim from username_1's posted solution):
  
  ffprobe -v 0 -show\_entries pixel\_format=name:flags=alpha -of compact=p=0 | grep "$PIX\_FMT|" | grep -oP "(?<=alpha=)\d"
  
  Where $PIX\_FMT is to be replaced with yuva444p121e (per username_1's instructions).
  
  I then tried Benji's solution for part 2, but that just returns the following:
  
  pix\_fmt=yuva444p12le
  
  Of course, this isn't any more useful than part 1...
  
  I suspect username_1 is on the right track as he mentions part 2 should produce a boolean result for the presence of an alpha channel. However, either I am misunderstanding the syntax of his template, or something has changed in FFprobe since. There is so limited information out there for this specific task. Hoping someone with more experience and knowledge can help shed some light for me??
  
  **Tags:** ffmpeg, ffprobe
  
  > **Comments:**
  > **username_1**: Your version of grep may not have PCRE enabled, which is required for `P` portion of `-oP`. In any case, if `a` comes right after `yuv` ot `rgb`, alpha is present.  
  > **username_0**: Interesting... I encoded the file myself in After Effects and selected the RGB/Millions of Colors option in the render settings (Instead of RGBA/Millions of Colors+). Then, I brought the rendered file back into After Effects and there is no visible alpha channel present. I added a "Set Channels" effect to the footage and turned off RGB channels (left alpha channel alone). The result is a full black frame. Perhaps PR4444 just always returns yuva from the FFprobe library used for pixel format? Or perhaps PR4444 always encodes with allotment for alpha data, even if it is all zeros?  
  > **username_1**: It could be the behaviour of the Adobe encoder. The ffmpeg decoder won't report alpha if the component isn't present. The presence of the channel is distinct from its contents (whether all zeros or not).  
  
  ---
  
  ## 0 answers
  
  