Re: [FFmpeg-devel] [PATCH] avcodec/nvenc: Add support for H.265 encoding

2015-03-26 Thread Ali KIZIL
Philip Langdale  overt.org> writes:

> 
> On 2015-03-26 04:30, Ali KIZIL wrote:
> > 
> > It works fine now Phil. One more comment:
> > 
> > I have a GTX 980. It can encode upto 30-33 fps for 4K 60fps YUV Raw
> > input file using nvenc_h265 avcodec with FFmpeg. First a side, It 
> > looked
> > to me like lack of performance of card. However; after I split the 
> > video
> > with crop filter into 2:
> > 
> > /opt/ffmpeghw/bin/ffmpeg -video_size 3840x2160 -framerate 50 -i
> > /Projects/YUV/soccer.yuv -vcodec nvenc_h265 -an -filter:v
> > "crop=in_w:in_h/2:0:0" -r 50 -g 50 -preset hp -f hevc top.hevc
> > 
> > /opt/ffmpeghw/bin/ffmpeg -video_size 3840x2160 -framerate 50 -i
> > /Projects/YUV/soccer.yuv -vcodec nvenc_h265 -an -filter:v
> > "crop=in_w:in_h/2:0:in_h/2" -r 50 -g 50 -preset hp -f hevc 
bottom.hevc
> > 
> > When I run them at the same time, both can be encoded with 50 fps. I
> > tried to joing output files with padding but FFmpeg needs re-
encoding
> > and it makes no sense.
> > 
> > Do you have any comment or idea to use full performance of the card 
> > over
> > a single ffmpeg nvenc_h265 instance ?
> > 
> > Additional note: GTX cards can suport up to 2 HEVC encoding at the 
same
> > time (as limitation.).
> 
> I honestly don't know. The hardware performance may not scale linearly 
> with
> frame size, so you might see a disproportionate slowdown past a 
certain 
> size,
> perhaps reflecting the need to use multiple buffers, etc.
> 
> Do you see any evidence that you're CPU bound? That might happen if 
our 
> buffer
> management is too inefficient, but I'd be surprised.
> 
> --phil
> 

CPU is fine. I have 2 x Intel(R) Xeon(R) CPU E5-2640 v2 @ 2.00GHz on 
server and Mem Total 49413456 kB, MemFree: 32030320 kB. So, mem is not 
an issue also. Here is top output on run:

top - 23:39:18 up 1 day, 21 min,  2 users,  load average: 0.08, 0.03, 
0.05
Tasks: 371 total,   3 running, 368 sleeping,   0 stopped,   0 zombie
%Cpu0  :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu1  :  0.0 us,  0.3 sy,  0.0 ni, 99.7 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu2  :  0.3 us,  0.0 sy,  0.0 ni, 99.7 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu3  :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu4  :  0.0 us,  0.3 sy,  0.0 ni, 99.7 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu5  :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu6  :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu7  :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu8  :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu9  :  0.0 us,  0.3 sy,  0.0 ni, 99.7 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu10 :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu11 :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu12 :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu13 :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu14 :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu15 :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu16 : 29.1 us, 20.3 sy,  0.0 ni, 50.7 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu17 :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu18 :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu19 :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu20 :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu21 :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu22 :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu23 :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu24 :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu25 :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu26 :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu27 :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu28 :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu29 :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu30 :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
%Cpu31 :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  
0.0 st
KiB Mem:  49413456 total, 19607392 used, 29806064 free,   106188 buffers
KiB Swap: 50282492 total,0 used, 50282492 free. 16826488 cached 
Mem

  PID USER  PR  NIVIRTRESSHR S  %CPU %MEM TIME+ 
COMMAND
 9563 root  20   0 70.432g 2.003g 1.948g R  49.2  4.3   0:08.02 
ffmpeg
  735 root  20   0   0  0  0 S   0.3  0.0   5:49.83 
blackmagic
 9600 root  20   0   22240   1844   1112 R   0.3  0.0   0:00.02 top
  

Re: [FFmpeg-devel] [PATCH] avcodec/nvenc: Add support for H.265 encoding

2015-03-26 Thread Philip Langdale

On 2015-03-26 04:30, Ali KIZIL wrote:


It works fine now Phil. One more comment:

I have a GTX 980. It can encode upto 30-33 fps for 4K 60fps YUV Raw
input file using nvenc_h265 avcodec with FFmpeg. First a side, It 
looked
to me like lack of performance of card. However; after I split the 
video

with crop filter into 2:

/opt/ffmpeghw/bin/ffmpeg -video_size 3840x2160 -framerate 50 -i
/Projects/YUV/soccer.yuv -vcodec nvenc_h265 -an -filter:v
"crop=in_w:in_h/2:0:0" -r 50 -g 50 -preset hp -f hevc top.hevc

/opt/ffmpeghw/bin/ffmpeg -video_size 3840x2160 -framerate 50 -i
/Projects/YUV/soccer.yuv -vcodec nvenc_h265 -an -filter:v
"crop=in_w:in_h/2:0:in_h/2" -r 50 -g 50 -preset hp -f hevc bottom.hevc

When I run them at the same time, both can be encoded with 50 fps. I
tried to joing output files with padding but FFmpeg needs re-encoding
and it makes no sense.

Do you have any comment or idea to use full performance of the card 
over

a single ffmpeg nvenc_h265 instance ?

Additional note: GTX cards can suport up to 2 HEVC encoding at the same
time (as limitation.).


I honestly don't know. The hardware performance may not scale linearly 
with
frame size, so you might see a disproportionate slowdown past a certain 
size,

perhaps reflecting the need to use multiple buffers, etc.

Do you see any evidence that you're CPU bound? That might happen if our 
buffer

management is too inefficient, but I'd be surprised.

--phil
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/nvenc: Add support for H.265 encoding

2015-03-26 Thread Ali KIZIL
Philip Langdale  overt.org> writes:

> 
> On Wed, 25 Mar 2015 21:52:54 + (UTC)
> Ali KIZIL  gmail.com> wrote:
> 
> > 
> > The update broken the general usage:
> > 
> > ./ffmpeg -loglevel info -re -i /root/bunny.mp4 -vcodec nvenc -preset
> > hp -fflags +genpts -vb 24000k -minrate 24000k -maxrate 24000k
> > -bufsize 48000k -muxrate 26000k -cbr 1 -2pass 0 -r 50 -g 100 -
pix_fmt
> > yuv420p - acodec aac -strict -2 -ac 2 -ar 48000 -ab 256k
> > -flush_packets 0 - packetsize 188 -y -f mpegts out.ts
> > 
> > ./ffmpeg -loglevel info -re -i /root/bunny.mp4 -vcodec nvenc_h265 -
> > preset hp -fflags +genpts -vb 24000k -minrate 24000k -maxrate 24000k 
-
> > bufsize 48000k -muxrate 26000k -cbr 1 -2pass 0 -r 50 -g 100 -pix_fmt 
> > yuv420p -acodec aac -strict -2 -ac 2 -ar 48000 -ab 256k
> > -flush_packets 0 -packetsize 188 -y -f mpegts out.ts
> > 
> > FFmpeg stucks, does not work for both. 
> > 
> > Before with nvenc work working fine with above commands. It looks
> > like - g parameter, -muxrate, -flush_packtes stuck FFmpeg with this
> > update. 
> > 
> > Below line works:
> > 
> > ./ffmpeg -loglevel verbose -i /root/bunny.mp4 -vcodec nvenc_h265
> > -preset hp -r 50  -y -f mpegts out.ts
> 
> Yes - it's because I tried to share the class instance between the two
> encoders, which doesn't work. I'm about to push a fix. Thanks for the
> heads up.
> 
> --phil
> 

It works fine now Phil. One more comment:

I have a GTX 980. It can encode upto 30-33 fps for 4K 60fps YUV Raw 
input file using nvenc_h265 avcodec with FFmpeg. First a side, It looked 
to me like lack of performance of card. However; after I split the video 
with crop filter into 2:

/opt/ffmpeghw/bin/ffmpeg -video_size 3840x2160 -framerate 50 -i 
/Projects/YUV/soccer.yuv -vcodec nvenc_h265 -an -filter:v 
"crop=in_w:in_h/2:0:0" -r 50 -g 50 -preset hp -f hevc top.hevc

/opt/ffmpeghw/bin/ffmpeg -video_size 3840x2160 -framerate 50 -i 
/Projects/YUV/soccer.yuv -vcodec nvenc_h265 -an -filter:v 
"crop=in_w:in_h/2:0:in_h/2" -r 50 -g 50 -preset hp -f hevc bottom.hevc

When I run them at the same time, both can be encoded with 50 fps. I 
tried to joing output files with padding but FFmpeg needs re-encoding 
and it makes no sense.

Do you have any comment or idea to use full performance of the card over 
a single ffmpeg nvenc_h265 instance ?

Additional note: GTX cards can suport up to 2 HEVC encoding at the same 
time (as limitation.). 



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/nvenc: Add support for H.265 encoding

2015-03-25 Thread Philip Langdale
On Wed, 25 Mar 2015 21:52:54 + (UTC)
Ali KIZIL  wrote:

> 
> The update broken the general usage:
> 
> ./ffmpeg -loglevel info -re -i /root/bunny.mp4 -vcodec nvenc -preset
> hp -fflags +genpts -vb 24000k -minrate 24000k -maxrate 24000k
> -bufsize 48000k -muxrate 26000k -cbr 1 -2pass 0 -r 50 -g 100 -pix_fmt
> yuv420p - acodec aac -strict -2 -ac 2 -ar 48000 -ab 256k
> -flush_packets 0 - packetsize 188 -y -f mpegts out.ts
> 
> ./ffmpeg -loglevel info -re -i /root/bunny.mp4 -vcodec nvenc_h265 -
> preset hp -fflags +genpts -vb 24000k -minrate 24000k -maxrate 24000k -
> bufsize 48000k -muxrate 26000k -cbr 1 -2pass 0 -r 50 -g 100 -pix_fmt 
> yuv420p -acodec aac -strict -2 -ac 2 -ar 48000 -ab 256k
> -flush_packets 0 -packetsize 188 -y -f mpegts out.ts
> 
> FFmpeg stucks, does not work for both. 
> 
> Before with nvenc work working fine with above commands. It looks
> like - g parameter, -muxrate, -flush_packtes stuck FFmpeg with this
> update. 
> 
> Below line works:
> 
> ./ffmpeg -loglevel verbose -i /root/bunny.mp4 -vcodec nvenc_h265
> -preset hp -r 50  -y -f mpegts out.ts

Yes - it's because I tried to share the class instance between the two
encoders, which doesn't work. I'm about to push a fix. Thanks for the
heads up.

--phil
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/nvenc: Add support for H.265 encoding

2015-03-25 Thread Michael Niedermayer
On Mon, Mar 23, 2015 at 09:41:25PM -0700, Philip Langdale wrote:
> Sufficiently new nvenc hardware (GM20x or later) has support for H.265
> encoding. This works the same as the H.264 encoder except the
> codec parameters are different.
> 
> Due to the fact that common codec parameters are not shareable, there's
> quite a bit of conditional logic you'd wish we could do without, but
> such is life.
> 
> Note that this feature requires the 5.0 SDK or newer to compile. I'm not
> sure what we gain from supporting the older SDKs, so I'm inclined to
> make this unconditional and remove the < 5 support that currently exists.
> 
> Signed-off-by: Philip Langdale 

theres a comment on github about this:
see:
https://github.com/FFmpeg/FFmpeg/commit/21175d8586d368f5f0b2ed0edda22f8f1c108330#commitcomment-10400533

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The worst form of inequality is to try to make unequal things equal.
-- Aristotle


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/nvenc: Add support for H.265 encoding

2015-03-25 Thread Ali KIZIL
Philip Langdale  overt.org> writes:

> 
> On Tue, 24 Mar 2015 09:54:13 +0100
> Timo Rothenpieler  rothenpieler.org> wrote:
> 
> > Yes, I did exactly that in my implementation:
> > 
> > https://github.com/BtbN/FFmpeg/commits/nvenc
> > 
> > The code i wrote there is completely untested(Except that h264 still 
> > works), because i don't have any compatible hardware, so the one you 
> > tested is clearly the one that should be prefered.
> > 
> > Dropping SDK <5 support is fine with me, as long as it's not
> > backported to 2.6. The primary gain from supporting the old SDK is
> > that it works with much older nvidia driver versions.
> > 
> > I'll submit the patch that drops the old API support, so you can
> > rebase your patch on top of it.
> > 
> > Looks good to merge otherwise.
> > 
> 
> I've taken your logic to check the SM version - I had been
> wondering how old hardware should be detected and excluded.
> 
> I've also noticed that the profile handling code is completely broken 
-
> you can't set a profile using -profile:v - it appears we're handling
> this in an incorrect way - but I'm not sure what correct is. libx264
> has its own profile option which appears to be necessary but then I
> don't understand what sets avctx->profile.
> 
> Anyway, that's a separate problem we can solve independently of h.265.
> 
> Thanks!
> 
> --phil
> 

The update broken the general usage:

./ffmpeg -loglevel info -re -i /root/bunny.mp4 -vcodec nvenc -preset hp 
-fflags +genpts -vb 24000k -minrate 24000k -maxrate 24000k -bufsize 
48000k -muxrate 26000k -cbr 1 -2pass 0 -r 50 -g 100 -pix_fmt yuv420p -
acodec aac -strict -2 -ac 2 -ar 48000 -ab 256k -flush_packets 0 -
packetsize 188 -y -f mpegts out.ts

./ffmpeg -loglevel info -re -i /root/bunny.mp4 -vcodec nvenc_h265 -
preset hp -fflags +genpts -vb 24000k -minrate 24000k -maxrate 24000k -
bufsize 48000k -muxrate 26000k -cbr 1 -2pass 0 -r 50 -g 100 -pix_fmt 
yuv420p -acodec aac -strict -2 -ac 2 -ar 48000 -ab 256k -flush_packets 0 
-packetsize 188 -y -f mpegts out.ts

FFmpeg stucks, does not work for both. 

Before with nvenc work working fine with above commands. It looks like -
g parameter, -muxrate, -flush_packtes stuck FFmpeg with this update. 

Below line works:

./ffmpeg -loglevel verbose -i /root/bunny.mp4 -vcodec nvenc_h265 -preset 
hp -r 50  -y -f mpegts out.ts




___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/nvenc: Add support for H.265 encoding

2015-03-24 Thread Philip Langdale
On Tue, 24 Mar 2015 09:54:13 +0100
Timo Rothenpieler  wrote:

> Yes, I did exactly that in my implementation:
> 
> https://github.com/BtbN/FFmpeg/commits/nvenc
> 
> The code i wrote there is completely untested(Except that h264 still 
> works), because i don't have any compatible hardware, so the one you 
> tested is clearly the one that should be prefered.
> 
> Dropping SDK <5 support is fine with me, as long as it's not
> backported to 2.6. The primary gain from supporting the old SDK is
> that it works with much older nvidia driver versions.
> 
> I'll submit the patch that drops the old API support, so you can
> rebase your patch on top of it.
> 
> Looks good to merge otherwise.
> 

I've taken your logic to check the SM version - I had been
wondering how old hardware should be detected and excluded.

I've also noticed that the profile handling code is completely broken -
you can't set a profile using -profile:v - it appears we're handling
this in an incorrect way - but I'm not sure what correct is. libx264
has its own profile option which appears to be necessary but then I
don't understand what sets avctx->profile.

Anyway, that's a separate problem we can solve independently of h.265.

Thanks!

--phil
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/nvenc: Add support for H.265 encoding

2015-03-24 Thread Timo Rothenpieler

Am 24.03.2015 um 05:41 schrieb Philip Langdale:

Sufficiently new nvenc hardware (GM20x or later) has support for H.265
encoding. This works the same as the H.264 encoder except the
codec parameters are different.

Due to the fact that common codec parameters are not shareable, there's
quite a bit of conditional logic you'd wish we could do without, but
such is life.

Note that this feature requires the 5.0 SDK or newer to compile. I'm not
sure what we gain from supporting the older SDKs, so I'm inclined to
make this unconditional and remove the < 5 support that currently exists.


Yes, I did exactly that in my implementation:

https://github.com/BtbN/FFmpeg/commits/nvenc

The code i wrote there is completely untested(Except that h264 still 
works), because i don't have any compatible hardware, so the one you 
tested is clearly the one that should be prefered.


Dropping SDK <5 support is fine with me, as long as it's not backported 
to 2.6. The primary gain from supporting the old SDK is that it works 
with much older nvidia driver versions.


I'll submit the patch that drops the old API support, so you can rebase 
your patch on top of it.


Looks good to merge otherwise.



signature.asc
Description: OpenPGP digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel