FFMPEG: how to save the camera input stream to a file with a SAME codec?

I have a camera-like device that creates a video stream and transfers it to my Windows-based machine via a USB port.

Using the command:

ffmpeg -y -f vfwcap -i list

I see that (as expected) FFmpeg finds the input stream as stream # 0.

Using the command:

ffmpeg -y -f vfwcap -r 25 -i 0 c:\out.mp4

I can successfully save the input stream to a file.

From the log I see:

Stream No. 0: 0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 240x320, 25 tbr, 1k tbn, 25 tbc Pixel format not specified, yuv422p for the selected H.264 encoding.

So my input format is transcoded to yuv422p.

My question is:

  • How can I make FFmpeg save the input video stream to out.mp4 WITHOUT transcoding - actually, to copy the input stream to the output file as close as possible to the same format?
+4
1

ffmpeg out.mp4

. rawvideo vfwcap, MP4 rawvideo. :

  • .
  • rawvideo .
  • (, , ).

.

ffmpeg -f vfwcap -i 0 -codec:v copy rawvideo.nut
  • rawvideo .

rawvideo,

, , rawvideo .

ffmpeg -f vfwcap -i 0 -codec:v copy rawvideo.nut
ffmpeg -i rawvideo.nut -codec:v libx264 -crf 23 -preset medium -pix_fmt yuv420p -movflags +faststart output.mp4

huffyuv:

ffmpeg -f vfwcap -i 0 -codec:v huffyuv lossless.mkv

H.264:

ffmpeg -f vfwcap -i 0 -codec:v libx264 -qp 0 lossless.mp4
  • , , rawvideo.
  • , rawvideo.
+4

All Articles