Using Hardware Accelerated Encoder Produce Bigger File

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Using Hardware Accelerated Encoder Produce Bigger File

Ali Shirvani
Hi all,
I encoded a raw YUV video once with h264_vaapi and once with libx264 codec.
The output of h264_vaapi is about 4.8 MB, while the output of libx264 is
1.1 MB.

Here is the commands:
ffmpeg -loglevel trace -vaapi_device /dev/dri/renderD128 -video_size
1920x1080 -i raw_1080.yuv -vf 'format=nv12,hwupload' -vcodec h264_vaapi
out_h264_vaapi.mp4

ffmpeg -loglevel trace  -video_size 1920x1080 -i raw_1080.yuv  -vcodec
libx264  out_libx264.mp4

Is this variation in output size normal? or should I tune some settings?

Regards,
Ali
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Using Hardware Accelerated Encoder Produce Bigger File

Moritz Barsnick
On Tue, Sep 11, 2018 at 16:38:37 +0430, Ali Shirvani wrote:
> Is this variation in output size normal? or should I tune some settings?

Yes, it's normal - different encoders use different default settings.

Yes, you should tune your settings.

If you want to achieve similar size, use the "-b:v" (video bitrate)
command line parameter. Yet quality may differ significantly, depending
on the effort and the encoding methods used by the encoder. (Even at
somewhat constant quality, you can vary the size of the libx264
encoding significantly by using different "-preset" options.)

If you want to achieve identical quality, you need to fiddle with the
available options. libx264 offers "-crf" for its (default) variable
bitrate encoding (also for fixed). Other H.264 encoders probably use
other options (such as "-q:v", but its impact may differ depending on
encoder) and may even default to constant bitrate. Check in the manual
or with:

$ ffmpeg -h encoder=encoder_name

Cheers,
Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Using Hardware Accelerated Encoder Produce Bigger File

Brainiarc7
Also, related.

Is there a way to determine encoder defaults?

Does ffmpeg have such an option to print out encoder defaults?

On Tue, Sep 11, 2018, 16:02 Moritz Barsnick <[hidden email]> wrote:

> On Tue, Sep 11, 2018 at 16:38:37 +0430, Ali Shirvani wrote:
> > Is this variation in output size normal? or should I tune some settings?
>
> Yes, it's normal - different encoders use different default settings.
>
> Yes, you should tune your settings.
>
> If you want to achieve similar size, use the "-b:v" (video bitrate)
> command line parameter. Yet quality may differ significantly, depending
> on the effort and the encoding methods used by the encoder. (Even at
> somewhat constant quality, you can vary the size of the libx264
> encoding significantly by using different "-preset" options.)
>
> If you want to achieve identical quality, you need to fiddle with the
> available options. libx264 offers "-crf" for its (default) variable
> bitrate encoding (also for fixed). Other H.264 encoders probably use
> other options (such as "-q:v", but its impact may differ depending on
> encoder) and may even default to constant bitrate. Check in the manual
> or with:
>
> $ ffmpeg -h encoder=encoder_name
>
> Cheers,
> Moritz
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Using Hardware Accelerated Encoder Produce Bigger File

Ali Shirvani
In reply to this post by Moritz Barsnick
Hi Moritz,

Thanks for your helpful reply. I change the encoders settings and the file
size now similar.

Cheers,
Ali

On Tue, Sep 11, 2018 at 5:32 PM Moritz Barsnick <[hidden email]> wrote:

> On Tue, Sep 11, 2018 at 16:38:37 +0430, Ali Shirvani wrote:
> > Is this variation in output size normal? or should I tune some settings?
>
> Yes, it's normal - different encoders use different default settings.
>
> Yes, you should tune your settings.
>
> If you want to achieve similar size, use the "-b:v" (video bitrate)
> command line parameter. Yet quality may differ significantly, depending
> on the effort and the encoding methods used by the encoder. (Even at
> somewhat constant quality, you can vary the size of the libx264
> encoding significantly by using different "-preset" options.)
>
> If you want to achieve identical quality, you need to fiddle with the
> available options. libx264 offers "-crf" for its (default) variable
> bitrate encoding (also for fixed). Other H.264 encoders probably use
> other options (such as "-q:v", but its impact may differ depending on
> encoder) and may even default to constant bitrate. Check in the manual
> or with:
>
> $ ffmpeg -h encoder=encoder_name
>
> Cheers,
> Moritz
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".