添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. Visit Stack Exchange

Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.

Sign up to join this community

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Hi I'm trying to transcode a hevc stream to h264 using ffmpeg

$ ffmpeg -c:v hevc_v4l2m2m -i video.mkv -c:v h264_v4l2m2m -c:a aac out.mp4

I want to ffmpeg to explicitly decode the input hevc video using hevc_v4l2m2m API, and later encode the video to h264 codec using h264_v4l2m2m API.

However when I do this, ffmpeg throws the following error:

[hevc_v4l2m2m @ 0x556a56fcb0] Could not find a valid device
[hevc_v4l2m2m @ 0x556a56fcb0] can't configure decoder
Stream mapping: Stream #0:0 -> #0:0 (hevc (hevc_v4l2m2m) -> h264 (h264_v4l2m2m))
Stream #0:1 -> #0:1 (copy) Error while opening decoder for input stream #0:0 : Invalid argument

Any pointers on what I'm doing wrong?

@SaaranshGarg I get this error [hevc_v4l2m2m @ 0x556a56fcb0] Could not find a valid device [hevc_v4l2m2m @ 0x556a56fcb0] can't configure decoder Stream mapping: Stream #0:0 -> #0:0 (hevc (hevc_v4l2m2m) -> h264 (h264_v4l2m2m)) Stream #0:1 -> #0:1 (copy) Error while opening decoder for input stream #0:0 : Invalid argument – user89978 Mar 13, 2022 at 9:57 Are you using Raspberry Pi 4 ? I don't have experience with FFmpeg on Raspberry Pi, but it looks hevc_v4l2m2m is not a decoder. For getting a list of all FFmpeg decoders execute: ffmpeg -decoders. – Rotem Mar 13, 2022 at 11:50 @Rotem Yes I'm using raspberry pi 4. hevc_v4l2m2m is present on list of decoders pi@rpi4:~ $ ffmpeg -decoders | grep hevc V..... hevc_v4l2m2m V4L2 mem2mem HEVC decoder wrapper (codec hevc) – user89978 Mar 13, 2022 at 11:52 Are you sure that all streams are encoded in h265? Also check that your device supports h265 decoding in both hard and software. You might want to try ffmpeg -i video.mkv -c:v h264_v4l2m2m -c:a copy out.mp4 to check if h264 hardware encoding is possible. You could could always resort to software de-/encoding with ffmpeg -i video.mkv -c:v libx264 -c:a copy out.mkv – mashuptwice Mar 14, 2022 at 3:39

Are you sure that all streams are encoded in h265? Also check that your device supports h265 decoding in both hard and software. You might want to try

ffmpeg  -i video.mkv -c:v h264_v4l2m2m -c:a copy out.mp4

to check if h264 hardware encoding is possible. You could could always resort to software de-/encoding with

ffmpeg -i video.mkv -c:v libx264 -c:a copy out.mkv