Answers.Body: <p>You may not actually need baseline profile, but only a compatible pixel format i.e. YUV 4:2:0 as opposed to YUV 4:4:4 that ffmpeg converts gdigrab's RGB frames to.</p>
  <p>Add <code>-pix_fmt yuv420p</code>. For baseline profile, also add <code>-profile:v baseline</code>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-12-08T14:27:33.157Z
Answers.Text: `-pix_fmt yuv420` added just after `libx264` did the trick.  No longer have black screen with sound for Plex on Roku.  When I type `ffmpeg -pix_fmts` I find a whole list of these options...research for another day.  Thanks.   I didn't try the `-profile:v baseline` suggestion.  Another day.
Answers.UserDisplayName: Dave Gutz
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-12-07T18:27:30.903Z
Answers.LastActivityDate: 2023-12-07T18:27:30.903Z
Answers.UserDisplayName: Gyan
Body: <p>It all begins with Plex and appears to end at ffmpeg as the easiest possible solution.  I love ffmpeg!  I use Plex running on Linux to stream over home network to a Roku.  I've used this for years until recently as I'll describe below.  I have a temporary workaround using Chromecast to bypass this issue.</p>
  <p><strong>Some videos don't play.</strong> There are two differences between the ones that play and the ones that don'that (<strong>sound but black screen</strong>).  I list these below.  Another possibility not listed is that Roku / Plex / Ubuntu have some kind of interaction (bug).  Maybe the Roku device is old and unsupported?  I listed my config way below.</p>
  <ol>
  <li>ffmpeg used to generate mkv / mp4 for the ones that don't play (sound but black screen).   Handbrake and WinxDVD used to generate mkv / m4a for the ones that do play.  My ffmpeg command is:</li>
  </ol>
  <p><code>**ffmpeg -threads 4 -f gdigrab -probesize 42M -thread_queue_size 1024 -i desktop -f dshow -thread_queue_size 1024 -i audio=&quot;CABLE Output (VB-Audio Virtual Cable)&quot; -vf scale=720:404 -vcodec libx264 -crf 28 -t   6.0 -y  &quot;C:/Users/daveg/Documents/Recordings\trial4_raw.mp4&quot;**</code></p>
  <ol start="2">
  <li>Video file properties show <strong>codec H.264 High 4:4:4</strong> for the ones that don't play (sound but black screen). and <strong>H.264 Constrained Baseline Profile</strong> for the ones that do play.</li>
  </ol>
  <p><strong>Does somebody know how to configure ffmpeg to generate H.264 Constrained Baseline Profile?</strong> That seems like my next logical step. I tried various crf values only to produce grainy results still with High 4:4:4 nature.</p>
  <p>Plex 1.32.8.7639 running on Ubuntu 22.04.1</p>
  <p>Roku 3920X s/w 12.5.0 build 4178-91</p>
  <p>ffmpeg 4.4.2 running on Ubuntu 22.04.1</p>
  
Tags: <ffmpeg><video><encoding><video-quality>
Title: ffmpeg Config to Produce H.264 Constrained Baseline Profile
UserDisplayName: Dave Gutz
ThreadText: # ffmpeg Config to Produce H.264 Constrained Baseline Profile
  
  (Asked by: username_0 on 2023-12-07)
  
  It all begins with Plex and appears to end at ffmpeg as the easiest possible solution. I love ffmpeg! I use Plex running on Linux to stream over home network to a Roku. I've used this for years until recently as I'll describe below. I have a temporary workaround using Chromecast to bypass this issue.
  
  **Some videos don't play.** There are two differences between the ones that play and the ones that don'that (**sound but black screen**). I list these below. Another possibility not listed is that Roku / Plex / Ubuntu have some kind of interaction (bug). Maybe the Roku device is old and unsupported? I listed my config way below.
  
  1. ffmpeg used to generate mkv / mp4 for the ones that don't play (sound but black screen). Handbrake and WinxDVD used to generate mkv / m4a for the ones that do play. My ffmpeg command is:
  
  `**ffmpeg -threads 4 -f gdigrab -probesize 42M -thread_queue_size 1024 -i desktop -f dshow -thread_queue_size 1024 -i audio="CABLE Output (VB-Audio Virtual Cable)" -vf scale=720:404 -vcodec libx264 -crf 28 -t 6.0 -y "C:/Users/daveg/Documents/Recordings\trial4_raw.mp4"**`
  
  2. Video file properties show **codec H.264 High 4:4:4** for the ones that don't play (sound but black screen). and **H.264 Constrained Baseline Profile** for the ones that do play.
  
  **Does somebody know how to configure ffmpeg to generate H.264 Constrained Baseline Profile?** That seems like my next logical step. I tried various crf values only to produce grainy results still with High 4:4:4 nature.
  
  Plex 1.32.8.7639 running on Ubuntu 22.04.1
  
  Roku 3920X s/w 12.5.0 build 4178-91
  
  ffmpeg 4.4.2 running on Ubuntu 22.04.1
  
  **Tags:** ffmpeg, video, encoding, video-quality
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-12-07. Score: 0 | Accepted answer
  
  You may not actually need baseline profile, but only a compatible pixel format i.e. YUV 4:2:0 as opposed to YUV 4:4:4 that ffmpeg converts gdigrab's RGB frames to.
  
  Add `-pix_fmt yuv420p`. For baseline profile, also add `-profile:v baseline`.
  
  > **Comments:**
  > **username_0**: `-pix_fmt yuv420` added just after `libx264` did the trick.  No longer have black screen with sound for Plex on Roku.  When I type `ffmpeg -pix_fmts` I find a whole list of these options...research for another day.  Thanks.   I didn't try the `-profile:v baseline` suggestion.  Another day.  
  
  ---
  
  