What are these ".raw" files that v4l2-ctl saves streams to?

https://en.wikipedia.org/wiki/Video4Linux

I recently bought

The goal is to help mom and dad to digitize old VHS, VHS-C, Mini DV and audio cassette tapes. The above expansion cards will arrive sometime next week and meanwhile, I have been doing some research on ffmpeg and v4l2-ctl. It's absolutely amazing how much you can do - or could do - with ffmpeg if you had about two-three lifetimes to learn. 🤣

Anyway, using a cheap HDMI to USB video capture dongle, I have successfully captured some video with v4l2-ctl -d /dev/video0 --stream-mmap --stream-to=video.raw --stream-count=100 and then converted it using ffmpeg -i video.raw video.mkv.

I am really interested in what this .raw file is, but all I could find was this, which seems to pertain to raw image files, rather than what v4l2-ctl outputs.

I tried to do some Ctrl+f searches on Video for Linux API, but this was far beyond what I was able to comprehend. On the other hand, the manual is far too "shallow" and doesn't explain much. Do you have any recommendations on what to read in order to understand a little bit more about the inner workings without having to take a PhD in how Linux does video? Why are these .raw files so big? What is the difference between them and the standard containers (.mkv, .mpeg, .avi etc.)?

Also, a huge bonus if you can find the time and will to point out any rookie mistakes in the digitizing project itself.

18 points · 7 comments · view on lemmy.world

7 Comments

amlor@piefed.social · 4 pts · 10d (1 reply)

Have you tried throwing file and/or mediainfo commands at those files?

akunohana@piefed.blahaj.zone · 3 pts · 10d

I completely forgot about file and didn't know of mediainfo. I'll try! 😁

apparia@discuss.tchncs.de · 4 pts · 10d

I'm no expert but I believe ffmpeg will be using the rawvideo decoder to read that file. If it appears to work I guess the stream output by v4l2-ctl happens to match up closely enough with the default parameters listed in that doc, you may want to work out what it is and double check compatibility though.

The difference from a regular container is that it's uncompressed (hence the size) and can't include any metadata (hence the need to specify parameters manually). v4l2-ctl writing in this format means it doesn't need to worry about compressing and encoding the video on-the-fly, which would complicate the implementation and might not always be feasible in real-time.

If you wanted to avoid the intermediate file you should be able to pipe v4l2-ctl directly into ffmpeg.

non_burglar@lemmy.world · 2 pts · 8d

Raw files are uncompressed color and luminance channels, audio, and time codes. Photographers often want the raw data to post-process themselves before any editing.

The fact that your device produces these is usually sign of decent quality.

TrollAccount69@lemmy.ml · 2 pts · 10d

The person who said file and mediainfo put you on the right track. You’ll figure it out.

The video tapes do a somewhat decent job of correcting their own instability but cassette players need to be adjusted for wow and flutter as well as head azimuth. Make sure you’re using a player that supports the tape type and noise reduction scheme as well.

E: you may need to fiddlefuck around to get good capture from that star tech card. Or maybe it’s fine to you.

BOFH666@lemmy.world · 1 pts · 10d (1 reply)

What does v4l2-ctl -d /dev/video0 --all tell you?

akunohana@piefed.blahaj.zone · 3 pts · 10d

Uhm, well, my analog capture cards haven't arrived yet and I have put away the little dongle, so I won't be able to answer that today/tonight. 🙏