David Parks
David Parks

Reputation: 32051

Understanding ffmpeg input stream information

When running ffmpeg I get the following input/output/stream statements. I need to understand the details here.

$ ffmpeg -y -nostdin -f v4l2 -framerate 30 -video_size 1920x1080 -c:v mjpeg -i /dev/video1 -c:v copy /tmp/v1.mov

Input #0, video4linux2,v4l2, from '/dev/video1':
  Duration: N/A, start: 762195.237801, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 1920x1080, -5 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc

Output #0, mov, to '/tmp/v1.mov':
  Metadata:
    encoder         : Lavf56.40.101
    Stream #0:0: Video: mjpeg (jpeg / 0x6765706A), yuvj422p, 1920x1080, q=2-31, -5 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc

Stream mapping:
  Stream #0:0 -> #0:0 (copy)
frame= 1685 fps= 30 q=-1.0 Lsize=  212483kB time=00:00:56.08 bitrate=31036.6kbits/s    

I want to connect 2 USB cameras over a USB 3.0 hub. My cameras are USB 2.0 cameras. Running 2 cameras at low resolution or framerate works, but at high resolution/framerate, I run out of USB bandwidth.

Does Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown) means that ffmpeg is receiving both the compresses mjpeg stream and and uncompressed yuv stream? If this is the case it explains the bandwidth issue. I ask because I can see that the compressed bitrate is only 31 Mbit in the Stream mapping section.

My question would then become, can I force the camera to only stream the compressed mjpeg stream?

p.s. I know I can plug the cameras into separate USB ports, but I only have 3 ports and need to record 6 cameras, so I need at least 2 cameras per USB (3.0) hub.

Upvotes: 3

Views: 2386

Answers (1)

Gyan
Gyan

Reputation: 92928

In Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), mjpeg is the codec, yuvj422p is the pixel format of the uncompressed stream that ffmpeg will decode the input to, pc indicates that the entire bit depth is used to signal color i.e. 0 = black and 255 = white. The next three values indicate the color space properties. I believe the order is primaries, space, and transfer characteristics (or gamma function).

So, you are not ingesting two streams at once.

Upvotes: 5

Related Questions