[FFmpeg-user] Transcode video problem with h264_nvenc

Gabor Alsecz alseczg at gmail.com
Wed Oct 19 14:39:00 EEST 2016


On Wed, Oct 19, 2016 at 1:17 PM, Moritz Barsnick <barsnick at gmx.net> wrote:

> On Wed, Oct 19, 2016 at 11:46:33 +0200, Gabor Alsecz wrote:
> > ffmpeg -i perspective1440.mp4 -c:v h264_nvenc -profile:v high -vf
> > format=nv12 -qp 0 -f h264 - > perspective1440_out_nvenc.mp4
> [...]
> > So far this seems fine, the process executed, video file created. But
> when
> > tried to play with any video player it does nothing.
>
> Probably because you created a raw H.264 stream ("-f h264"), but put it
> in a file named *.mp4. Some players will thereby certainly expect an
> MP4 container (due to the extension). Smarter ones will check the
> content... E.g. MPlayer copes fine in my quick tests, VLC not.
>

Yes this is exactly what Sven has been also written and now i got it.
Thanks!


>
> If you are intending to create an H.264 stream in an MP4 container,
> either use "-f mp4 -", or just use "perspective1440_out_nvenc.mp4" as
> the output file name (and no forced format), instead of '-' and piping.
>

Tried with "-f flv" (idea by Svan) and that case video playback also works
fine. I didn't yet tried with "-f mp4" but guessing it would work fine as
well.


>
> > *While the ffprobe of the original input media is:*
>
> Why are you comparing input and output (with "while")? You converted
> from one to the other, so you can expect them to be different.
> Especially as you told ffmpeg exactly what to make of the output (and
> it did just that). ;-)
>

Right, i have used wrong wording here, sorry.


>
> Gabor, I just noticed you are neither tellung us your expectations, not
> what you think went wrong. If your expectation was for the output H.264
> stream to have the colorspace nv12 (were you?), I don't know why the
> conversion process tells you it is creating that, but the ffprobe of
> the resulting file sees yuv420p.


> P.S.: please note that "-qp 0" isn't being used, as ffmpeg is telling
> you. And it's probably smarter to use "-pix_fmt" than the "format"
> filter to force an output colorspace. But as I wrote, I have no idea
> what you're trying to achieve, and which part of the result you don't
> like.)
>

Got it, thanks for your hints!
What i really try to achieve here to find a good command line option or a
very similar one i can implement in my code where feeding FFmpeg process's
stdout with raw byte data from code which encodes and stream to Youtube
than.


>
> Cheers,
> Moritz


More information about the ffmpeg-user mailing list