Request for pointers on how to figure out the spec for transcoding profile for output video from ffmpeg

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

Request for pointers on how to figure out the spec for transcoding profile for output video from ffmpeg

Aameer Rafiq Wani
Hi Guys,
We are using ffmpeg for transcoding which then feeds the output to bento4
for packaging. What I am trying to understand is the exact spec for
transcoding. Following command is what we are using:

ffmpeg -i $INPUT_VIDEO_FILE -codec:v libx264 -x264opts
"keyint=24:min-keyint=24:no-scenecut" -profile:v baseline -level 4.0 -vf
"scale=-2:1080" /mnt/s3_temp/$SERVER_NAME/$PROJECT_ID/videos/$VIDEO_ID/
"ffmpeg_output"/$VIDEO_ID"_burned_1080_.mp4" && echo "1080 version:" >>
encoding_logs.log

I went through some docs but I am not sure if I was able to comprehend it
in its entirety. I am have a some hard time to figure out the details of
it. I was hoping that one of you would be able to point me in the right
direction. What I want to know is what the transcoding profile in above
command is? so that we can optimize it as some of our users were
complaining about slower download times for offline drm content (for full
list of sample commands we use for drm including bento4's packaging please
check - https://gitlab.com/snippets/1869512). I tried to search around from
docs and google for say what exactly libx264 does and what -x264opts does
but wasn't able to put it together in a comprehensible way. For what I can
tell is that I am using x264 default presets by using x264opts (I am aware
that in future only x264-params will supported) I saw something here (
https://sites.google.com/site/linuxencoding/x264-ffmpeg-mapping), Is this
the profile I am using in the above command? Could someone please confirm?
or point me in right direction of getting full transcoding profile for  the
above command.

Would really appreciate any comments.

Thanks,
Aameer
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://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: Request for pointers on how to figure out the spec for transcoding profile for output video from ffmpeg

Moritz Barsnick
On Mon, Jul 01, 2019 at 17:54:08 +0530, Aameer Rafiq Wani wrote:
> I went through some docs but I am not sure if I was able to comprehend it
> in its entirety. I am have a some hard time to figure out the details of
> it.

Some of it depends on how ffmpeg's integration of x264 works, and some
of it on how x264 internally maps the profiles and levels to actual
encoding options. These may even differ from version to version.

The default encoding quality, for example, is chosen by ffmpeg, and
it's CRF 23. The parameters for each profile are chosen by libx264, as
far as I am aware.

> What I want to know is what the transcoding profile in above command
> is?

Unfortunately, even with increased verbosity, libx264 doesn't give us a
message with the encoding details. But it does put those details into
the actual H.264 stream.

What you can do is to pipe a bit of the raw video to a filter and look
at the string libx264 inserts:

$ ffmpeg -i $INPUT_VIDEO_FILE -codec:v libx264 \
  -x264opts "keyint=24:min-keyint=24:no-scenecut" \
  -profile:v baseline -level 4.0 -vf "scale=-2:1080" \
  -t 1 -f rawvideo - | strings | grep x264

(Or you can look at the actual resulting file, after your conversion.)
And you get something like this:

x264 - core 148 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=0 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=24 keyint_min=13 scenecut=0 intra_refresh=0 rc_lookahead=24 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00

(Note that, in this case, it doesn't seem to accept your min-keyint: it
tunes it to something else. Your other specific options to have an
effect though.)

That output should contain all the details. It doesn't mean you should
tweak those encoding defaults yourself. ;-) Unless you know really
really well what you are doing.

Cheers,
Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://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: Request for pointers on how to figure out the spec for transcoding profile for output video from ffmpeg

Carl Eugen Hoyos-2
Am Mo., 1. Juli 2019 um 14:53 Uhr schrieb Moritz Barsnick <[hidden email]>:

> The default encoding quality, for example, is chosen by ffmpeg, and
> it's CRF 23.

That's not how I remember it and I cannot find "23" in libavcodec/libx264.c

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://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: Request for pointers on how to figure out the spec for transcoding profile for output video from ffmpeg

Aameer Rafiq Wani
Hi Guys,
Thanks for your response guys. Based on the suggestions here. I went
through the logs and am sharing it here. I hope with this someone would be
able to help me in figuring out the transcoding profile. Any comments on
this would be greatly appreciated.
Thanks,
Aameer

On Mon, Jul 1, 2019 at 6:32 PM Carl Eugen Hoyos <[hidden email]> wrote:

> Am Mo., 1. Juli 2019 um 14:53 Uhr schrieb Moritz Barsnick <
> [hidden email]>:
>
> > The default encoding quality, for example, is chosen by ffmpeg, and
> > it's CRF 23.
>
> That's not how I remember it and I cannot find "23" in libavcodec/libx264.c
>
> Carl Eugen
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

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

encoding_logs35040_1080.log (139K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Request for pointers on how to figure out the spec for transcoding profile for output video from ffmpeg

christian-2
In reply to this post by Aameer Rafiq Wani
Eure E-Mail zu sehen mein Herz auf’s Wärmste erfreut, allerdings Du gefunden hast nur mein Auto-Replier.

Ein Kunde er wirklich sein mag. Aber trotzdem… große Arbeit ich befürchte durch seine E-Mail. Deshalb in Urlaub fahren ich werde von 05.07.2019 bis 22.07.2019. Denn Vorsicht du walten lassen musst. Stress ein Pfad zur Dunklen Seite er ist. Ehre das Leben, indem du lebst, Padawan.

Antworten nach meiner Rückkehr, ich werde.

Dein Meister in meiner Abwesenheit sein soll:

Morris Schwarz
[hidden email]




_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://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: Request for pointers on how to figure out the spec for transcoding profile for output video from ffmpeg

Moritz Barsnick
In reply to this post by Aameer Rafiq Wani
On Fri, Jul 05, 2019 at 19:46:15 +0530, Aameer Rafiq Wani wrote:
> Thanks for your response guys. Based on the suggestions here. I went
> through the logs and am sharing it here. I hope with this someone would be
> able to help me in figuring out the transcoding profile. Any comments on
> this would be greatly appreciated.

So what's the question? I gave you a suggestion on how to figure out
the "profile". Did you try it?

Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://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: Request for pointers on how to figure out the spec for transcoding profile for output video from ffmpeg

Aameer Rafiq Wani
Hi guys,

Thanks a lot for your responses. Based on the suggestions here I was able
to figure out what libx264 uses, but I would like to go a step further and
attempt to grasp basic understanding of how changing these values could
impact the output. Please forgive me if the question sounds too basic. The
output/logs I shared do tell what the bitrate results for each frame of
output video but I still can't comprehend how would I go about, say,
decreasing the bitrate without highly impacting the video quality. My
question here I guess is:

Would anyone of you tweak the code for further optimization (reduce output
sixe without major impact on quality). if yes, please do elaborate. That I
believe might give me some more insights.

Thanks
Aameer

On Sun, Jul 7, 2019, 7:31 AM Moritz Barsnick <[hidden email]> wrote:

> On Fri, Jul 05, 2019 at 19:46:15 +0530, Aameer Rafiq Wani wrote:
> > Thanks for your response guys. Based on the suggestions here. I went
> > through the logs and am sharing it here. I hope with this someone would
> be
> > able to help me in figuring out the transcoding profile. Any comments on
> > this would be greatly appreciated.
>
> So what's the question? I gave you a suggestion on how to figure out
> the "profile". Did you try it?
>
> Moritz
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

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