<p>You can use ffmpeg (and grep) to do this.</p>
<p>Run</p>
<p><code>ffmpeg -i H264file -c copy -bsf:v trace_headers -f null - 2&gt;&amp;1 | grep first_mb_in_slice</code></p>
<p>This should print out lines of the form</p>
<pre><code>[trace_headers @ 000002087b24c3c0] 8   first_mb_in_slice                     1 = 0
[trace_headers @ 000002087b24c3c0] 8   first_mb_in_slice     00000000101000001 = 320
[trace_headers @ 000002087b24c3c0] 8   first_mb_in_slice   0000000001010000001 = 640
</code></pre>
<p>If each frame is a single slice then ALL lines will have value 0 (<code>1 = 0</code>) for <code>first_mb_in_slice</code>. A non-zero value indicates sliced encoding.</p>

CC BY-SA 4.0
2022-04-13T06:11:49.173Z
Thank you. This is helpful and does workout.
Bivas
CC BY-SA 4.0
2022-04-12T04:50:29.193Z
2022-04-13T04:28:59.243Z
2022-04-13T04:28:59.243Z
Gyan
<p>I'm a software tester and I need to test a certain requirement for a vehicle camera that I'm not sure on how to test.
As in the title it's to verify that each frame is encoded with a single slice. This is done for more efficient encoding.</p>
<p>AVTP/h264, configured with high profile, to have only I-frames, progressively encoded.</p>
<p>I'm not that knowledgeable with imaging and video streaming, so any help would be appreciated.</p>

<ffmpeg><encoding><video-quality><streaming><h.264>
How do I verify that the H264 video stream is encoded with a single slice per frame?
Bivas
# How do I verify that the H264 video stream is encoded with a single slice per frame?

(Asked by: username_0 on 2022-04-11)

I'm a software tester and I need to test a certain requirement for a vehicle camera that I'm not sure on how to test.
As in the title it's to verify that each frame is encoded with a single slice. This is done for more efficient encoding.

AVTP/h264, configured with high profile, to have only I-frames, progressively encoded.

I'm not that knowledgeable with imaging and video streaming, so any help would be appreciated.

**Tags:** ffmpeg, encoding, video-quality, streaming, h.264


---

## 1 answers

### Answer by username_1 on 2022-04-12. Score: 0 | Accepted answer

You can use ffmpeg (and grep) to do this.
Run
ffmpeg -i H264file -c copy -bsf:v trace_headers -f null - 2>&1 | grep first_mb_in_slice
This should print out lines of the form
[trace_headers @ 000002087b24c3c0] 8   first_mb_in_slice                     1 = 0
[trace_headers @ 000002087b24c3c0] 8   first_mb_in_slice     00000000101000001 = 320
[trace_headers @ 000002087b24c3c0] 8   first_mb_in_slice   0000000001010000001 = 640

If each frame is a single slice then ALL lines will have value 0 (1 = 0) for first_mb_in_slice. A non-zero value indicates sliced encoding.

> **Comments:**
> **username_0**: Thank you. This is helpful and does workout.  

---

