Hi folks - can anyone shed light on this?
We’re putting together an nvEnc encoding pipeline which attempts to reproduce the method in GeForce Experience for screen-capture to a local mp4 mpeg file which is playable cross-platform.
We’re seeing that nvEnc is only outputting RAW H264. We’re trying to solve this problem programmatically without the need for any additional separate libraries (such as ffmpeg), so we’re currently looking at Microsoft Media Foundation classes.
Seems to me to be a serious limitation on nvEnc, and I was wondering if anyone has had any experience in how to finalise the video output as part of the output pipeline so the file that actually lands on disk is playable.
Thanks!
Marc
Hi there @MarcVRML and welcome back to the NVIDIA forums!
There are a ton of reasons why the Video Codec does not include any “packaging” calls, mainly the fact that NVENC/NVDEC aims to be a low level programming API. And since ffmpeg already does a really good job at wrapping the encoded bitstream in whatever container you want, no need to reinvent the wheel.
But that is a different discussion and does not help your immediate case.
As hinted above, MP4 or any other file format is only a container specifying how to decode the data within. You can actually already play such .h264 files with tools like VLC.
Since you already set up all the metadata when encoding through NVENC you should be able to create the right header information from that and pack it up, even without the MS Media Foundation classes. Some programming required of course.
The ffmpeg call to do this could be as easy as
ffmpeg -r 30 -i video_in.h264 -vcodec copy video_out.mp4
where “30” is simply the framerate. This is in effect just a copy operation.
Maybe this give you some ideas already, I know it is not quite the answer you are looking for.
Thanks!
Hi Markus and thanks for the reply.
We’re specifically looking to implement an internal codepath to output the file directly to a playable mp4, just as GeForce Experience does. It’s a cleaner route to the end result, although I do take your point and appreciate the out of the box thinking on this.
Best,
Marc
1 Like