Using ffmpeg or ffprobe to get the pixel bit depth of a video
Asked Answered
R

1

6

Is it possible to use ffprobe or ffmpeg to figure out the bit depth of a video file? I specifically want to know how many bits per channel (bpc) my video is. 8 is typical, but some fancier codecs can use higher bit depths, and I'm not sure how to obtain this information using ffprobe, or if it's even possible. Specifically, I have videos encoded using the AVC-Intra Class 100 1080p 59.94 fps codec, but I'm not sure if ffprobe can obtain the bit depth from that kind of file or not. If so, how would you do this?

Rector answered 1/7, 2019 at 3:37 Comment(2)
see superuser.com/questions/553552/how-to-determine-aac-bit-depth for some pointersKristoferkristoffer
@Offbeatmammal, that's the audio bit depth, not the pixel bit depth.Rector
M
9

you can use pix_fmt in many cases for more info, but for straight bitdepth, use bits_per_raw_sample:

ffprobe -loglevel panic \
    -show_entries stream=bits_per_raw_sample \
    -select_streams v \
    myvideo.mp4

( -loglevel panic to turn off the header stderr stuff).

Morphogenesis answered 2/7, 2019 at 11:37 Comment(5)
When I attempt to run this: ffprobe -loglevel panic -show_entries stream=bits_per_raw_sample testinput.mp4 I only get the following as output: ` [STREAM] [/STREAM] ` I'm still not sure why it's not telling me the bit depth.Rector
Try just ffprobe -show_streams -show_format testinput.mp4 and see if the bit depth is buried in the output somewhere. If it is, see what it's called.Morphogenesis
It seems that it doesn't appear anywhere in the output. pastebin.com/raw/Qj87JSJ0Rector
Hmm. It may be that your 2015 build was before they added that. Mine is 2016 (one of the zeranoe builds: version N-78385-g855d9d2). It shows bit depth after bit rate and just before nb_frames.Morphogenesis
The commit that added it was in 2014. It might have taken a while to get to the stable release, though: github.com/eVRydayVR/ffmpeg-unwarpvr/commit/…Morphogenesis

© 2022 - 2024 — McMap. All rights reserved.