What is option -level ?

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

What is option -level ?

Ulf Zibis
Hi,

in the settings of K9Copy I see the following ffmpeg command options: -b
$VIDBRk -s $WIDTHx$HEIGHT -vf
crop=$CROPWIDTH:$CROPHEIGHT:$CROPLEFT:$CROPTOP -aspect $ASPECT -codec:v
libx264 -level 30

-Ulf

--
Von meinem Seibert gesendet

_______________________________________________
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: What is option -level ?

kumowoon1025
It is a set of constraints on the encoding parameters. Basically the encoder sets the level to indicate the decoder capabilities necessary and sufficient to decode the stream. Take a look at Annex A of H.264.
_______________________________________________
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: What is option -level ?

Ulf Zibis
Much thanks Ted.

I'm wondering, why this option is not documented in
https://www.ffmpeg.org/ffmpeg-codecs.html
Unfortunately also here I can't find level 30:
https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Levels

-Ulf

Am 12.02.19 um 18:12 schrieb Ted Park:
> It is a set of constraints on the encoding parameters. Basically the encoder sets the level to indicate the decoder capabilities necessary and sufficient to decode the stream. Take a look at Annex A of H.264.
> _______________________________________________
> 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: What is option -level ?

kumowoon1025
> I'm wondering, why this option is not documented in
> https://www.ffmpeg.org/ffmpeg-codecs.html <https://www.ffmpeg.org/ffmpeg-codecs.html>

It is, sort of. It is a global codec option; various codecs have a concept of “levels” but since the definition will be completely different from one codec to another, it wouldn’t be practical to document all possible values and their meaning.

> Unfortunately also here I can't find level 30:
> https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Levels <https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Levels>
The decimal point is omitted in 30, 3 is the one you are looking for.
_______________________________________________
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: What is option -level ?

Ulf Zibis
Much thanks again.

Am 12.02.19 um 18:51 schrieb Ted Park:
>> I'm wondering, why this option is not documented in
>> https://www.ffmpeg.org/ffmpeg-codecs.html <https://www.ffmpeg.org/ffmpeg-codecs.html>
> It is, sort of. It is a global codec option; various codecs have a concept of “levels” but since the definition will be completely different from one codec to another, it wouldn’t be practical to document all possible values and their meaning.

But wouldn't it be useful to simply mention it's existence, syntax and
general meaning? Additionally in the paragraphs of each codec the values
and meanings could be documented or at least link to an external source.
How it's determined, if the option is meant for the video or the audio
codec and how to do, if a different level is wanted for each codec?

>> Unfortunately also here I can't find level 30:
>> https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Levels <https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Levels>
> The decimal point is omitted in 30, 3 is the one you are looking for.

Thanks!

-Ulf

_______________________________________________
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: What is option -level ?

kumowoon1025
> But wouldn't it be useful to simply mention it's existence, syntax and
> general meaning?

Try searching for level on the page you linked, it is listed, along with syntax. I think its name is the only practical explanation of its meaning, as I mentioned, it can be completely different for each codec.  

> Additionally in the paragraphs of each codec the values
> and meanings could be documented or at least link to an external source.
> How it's determined, if the option is meant for the video or the audio
> codec and how to do, if a different level is wanted for each codec?

The thing is, if you need to produce output in a certain profile or level, more often than not you will know the constraints imposed or more likely, you don’t care/have no choice because it is mandated by the limitations in the consumer of the output. Also the tables & definitions for levels covers 7 pages for h264.
_______________________________________________
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: What is option -level ?

Ulf Zibis

Am 12.02.19 um 19:42 schrieb Ted Park:
> Try searching for level on the page you linked, it is listed, along with syntax.

Ah, you mean to use "level" with hyphen, so "-level". This is poorly
described. But how to determine, if such option is meant for audio,
video or both?

> I think its name is the only practical explanation of its meaning, as I mentioned, it can be completely different for each codec.

Well, saying "Set the level option of the codec." IMHO would not be
superfluous. Also "codec-specific" would be better than "unknown".

In another option set of K9copy there is:
-b $VIDBRk -s $WIDTHx$HEIGHT -vf
crop=$WIDTH-$CROPRIGHT-$CROPLEFT:$HEIGHT-$CROPTOP-$CROPBOTTOM:$CROPLEFT:$CROPTOP
-aspect $ASPECT -codec:v libx264 -level 30 -flags +loop+mv4 -cmp 256
-partitions +parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 -me_method hex
-subq 7 -trellis 1 -refs 5 -bf 3 -b-pyramid normal -weightb 1
-mixed-refs 1 -8x8dct 1 -coder 1 -me_range 16 -g 250 -keyint_min 25
-sc_threshold 40 -i_qfactor 0.71 -qmin 10 -qmax 51 -qdiff 4 -pass $PASS
-passlogfile $PASSLOGFILE

Shouldn't it be "-flags pass1" instead "-pass 1"?
Are there other elements in that option set, which are bad syntax? E.g.
for -cmp I only see values like 'sad' in the ffmpeg docs, but not '256'.

-Ulf

_______________________________________________
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: What is option -level ?

Ulf Zibis

Am 12.02.19 um 21:33 schrieb Ulf Zibis:
> Shouldn't it be "-flags pass1" instead "-pass 1"?
> Are there other elements in that option set, which are bad syntax? E.g.
> for -cmp I only see values like 'sad' in the ffmpeg docs, but not '256'.

And what is the meaning of '+' with the -flags values?

-Ulf

_______________________________________________
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: What is option -level ?

Lou Logan
In reply to this post by Ulf Zibis
On Tue, Feb 12, 2019, at 11:33 AM, Ulf Zibis wrote:

> In another option set of K9copy there is:
> -b $VIDBRk -s $WIDTHx$HEIGHT -vf
> crop=$WIDTH-$CROPRIGHT-$CROPLEFT:$HEIGHT-$CROPTOP-$CROPBOTTOM:$CROPLEFT:$CROPTOP
> -aspect $ASPECT -codec:v libx264 -level 30 -flags +loop+mv4 -cmp 256
> -partitions +parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 -me_method hex
> -subq 7 -trellis 1 -refs 5 -bf 3 -b-pyramid normal -weightb 1
> -mixed-refs 1 -8x8dct 1 -coder 1 -me_range 16 -g 250 -keyint_min 25
> -sc_threshold 40 -i_qfactor 0.71 -qmin 10 -qmax 51 -qdiff 4 -pass $PASS
> -passlogfile $PASSLOGFILE
>
> Shouldn't it be "-flags pass1" instead "-pass 1"?
> Are there other elements in that option set, which are bad syntax? E.g.
> for -cmp I only see values like 'sad' in the ffmpeg docs, but not '256'.

This looks like a command from 10 years ago.

Use -crf instead of -b. If you must use -b then use -b:v.

Use scale filter instead of -s. If you need to scale.

Do you need to crop?

You don't need -aspect. If you do want to mess with aspect use setsar filter.

You probably don't need -level. Are you encoding for a device that requires level 3? Does your output work with level 3? The console output will let you know if it exceeds the level limits.

Get rid of everything starting from -flags to -qdiff. That's what -preset is for. The presets were made so users don't have to use a million options.

Do you really need to do two passes? Are you targeting a specific output file size? If no, then don't use -pass or -passlogfile, use -crf, and do it all in one pass.

So your command could be simplified to something like:
ffmpeg -i input -c:v libx264 -crf 22 -preset slow -c:a aac output.mp4
_______________________________________________
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: What is option -level ?

Carl Eugen Hoyos-2
In reply to this post by kumowoon1025
2019-02-12 18:12 GMT+01:00, Ted Park <[hidden email]>:
> It is a set of constraints on the encoding parameters. Basically
> the encoder sets the level to indicate the decoder capabilities
> necessary and sufficient to decode the stream.

In addition, I'd like to note that with software decoding, the
level chosen at encoding time has absolutely no relevance.
For hardware decoding, it is said to have some usefulness
but note that afaik all hardware suppliers do not guarantee
to support a particular level in their hardware. The only known
effect of "level" is that some hardware decoders in software
(read: FFmpeg) refuse to start decoding certain levels...

Carl Eugen
_______________________________________________
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: What is option -level ?

Ulf Zibis
In reply to this post by Lou Logan

Am 12.02.19 um 21:43 schrieb Lou Logan:

> This looks like a command from 10 years ago.
> Use -crf instead of -b. If you must use -b then use -b:v.
>
> Use scale filter instead of -s. If you need to scale.
>
> Do you need to crop?
>
> You don't need -aspect. If you do want to mess with aspect use setsar filter.
>
> You probably don't need -level. Are you encoding for a device that requires level 3? Does your output work with level 3? The console output will let you know if it exceeds the level limits.
>
> Get rid of everything starting from -flags to -qdiff. That's what -preset is for. The presets were made so users don't have to use a million options.
>
> Do you really need to do two passes? Are you targeting a specific output file size? If no, then don't use -pass or -passlogfile, use -crf, and do it all in one pass.
>
> So your command could be simplified to something like:
> ffmpeg -i input -c:v libx264 -crf 22 -preset slow -c:a aac output.mp4
Much thanks for your valuable hints Lou.
The program K9Copy was not maintained since years, so the used templates
are equal old as I suspected.

I'm not sure, if I need 2 passes, I'm at the beginning of my
experiments, but I think, -movflags faststart could be useful. If I need
2 passes I should know about the correct syntax, "-flags pass1" or
"-pass 1". Also I would be happy to understand, what the leading '+' is
for the -flags values. I honestly don't know, if I need -level, but I
want to know, how to determine, if the codec options are valid for
audio, video or both.

-Ulf

_______________________________________________
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: What is option -level ?

Lou Logan
On Tue, Feb 12, 2019, at 1:11 PM, Ulf Zibis wrote:
>
> I'm not sure, if I need 2 passes

It depends on what you want to do. If you want to try to target a specific output file size then use two-passes. If that's not really a concern just do a single pass using -crf. See the wiki page:

https://trac.ffmpeg.org/wiki/Encode/H.264

> but I think, -movflags faststart could be useful.

Sure, if you are going to present the video via progressive download. Doesn't hurt if you include it either way. It just may add a few more seconds to the whole process.

> If I need 2 passes I should know about the correct syntax, "-flags pass1" or
> "-pass 1".

"-pass 1" for the first pass, then "-pass 2" for the second pass.

> I honestly don't know if I need -level

Ignore it.
_______________________________________________
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: What is option -level ?

Ulf Zibis

Am 13.02.19 um 20:23 schrieb Lou Logan:
> https://trac.ffmpeg.org/wiki/Encode/H.264
Thanks, I know this page.

>> If I need 2 passes I should know about the correct syntax, "-flags pass1" or
>> "-pass 1".
> "-pass 1" for the first pass, then "-pass 2" for the second pass.

I was just wondering, that option "-pass" is not mentioned here:
https://www.ffmpeg.org/ffmpeg-codecs.html#toc-Codec-Options
So I understand that it is an alternative to the "-flags pass1" syntax.

-Ulf

_______________________________________________
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: What is option -level ?

Carl Eugen Hoyos-2
2019-02-13 23:23 GMT+01:00, Ulf Zibis <[hidden email]>:
>
> Am 13.02.19 um 20:23 schrieb Lou Logan:

>>> If I need 2 passes I should know about the correct syntax,
>>> "-flags pass1" or "-pass 1".
>>
>> "-pass 1" for the first pass, then "-pass 2" for the second pass.
>
> I was just wondering, that option "-pass" is not mentioned here:
> https://www.ffmpeg.org/ffmpeg-codecs.html#toc-Codec-Options

It's not a codec option but an option of the command line utility:
https://www.ffmpeg.org/ffmpeg.html#Video-Options

Carl Eugen
_______________________________________________
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: What is option -level ?

Jonathan Isom
In reply to this post by Ulf Zibis
From: Ulf Zibis <[hidden email]> <[hidden email]>
Reply: FFmpeg user questions <[hidden email]>
<[hidden email]>
Date: February 13, 2019 at 4:23:43 PM
To: [hidden email] <[hidden email]> <[hidden email]>
Subject:  Re: [FFmpeg-user] What is option -level ?


> Am 13.02.19 um 20:23 schrieb Lou Logan:
>
> https://trac.ffmpeg.org/wiki/Encode/H.264
>
> Thanks, I know this page.
>
> If I need 2 passes I should know about the correct syntax, "-flags pass1"
> or
> "-pass 1".
>
> "-pass 1" for the first pass, then "-pass 2" for the second pass.
>
>
> I was just wondering, that option "-pass" is not mentioned here:
> https://www.ffmpeg.org/ffmpeg-codecs.html#toc-Codec-Options
> So I understand that it is an alternative to the "-flags pass1" syntax.
>

Hi

I was thinking part of the reason for confusion is the understanding of how
command arguments work. I didn’t include all from earlier in the thread,
but here are some. Most arguments are preceded ‘-‘.  ‘-vf’ then its
options, the string including crop till it reaches the space after. Each
option is separated by spaces. So ‘-pass’ further down is not an option of
‘-flag8s’. Some arguments don’t have options, but most of the ones you are
looking at do.  There are a dreadful amount of arguments in those commands.
The scale ‘-s’ and its option ‘$WIDTHxHEIGHT’. ‘-flags’ has options but
‘-pass’ is not part of it. Just the ‘+loop+mv4’ part. I don’t know if
K3copy uses the bash shell to run the ffmpeg, but I suspect it does. If you
set all the environment variables(starts with ‘$’ like $WIDTH) in bash or
put in in a shell script, you can trial and error the ffmpeg command line.


-b $VIDBRk

-s $WIDTHx$HEIGHT

-vf crop=$WIDTH-$CROPRIGHT-$CROPLEFT:$HEIGHT-$CROPTOP-$CROPBOTTOM:$CROPLEFT:$CROPTOP

-aspect $ASPECT

-codec:v libx264

-level 30

-flags +loop+mv4

...

 -pass $PASS

-passlogfile $PASSLOGFILE


Hope this is helpful.

Jonathan

>
> -Ulf
>
> _______________________________________________
> 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: What is option -level ?

Ulf Zibis
Hi Jonathan,

thanks for your hints. Unfortunately they have been already  known to
me, but there still remain 2 questions from my side:
- The '+' with "-flags" arguments, I can imagine, it serves as
separator. But is that all, has '-' another meaning too? There is no
explanation on this at:
https://www.ffmpeg.org/ffmpeg-codecs.html#Codec-Options
- How to determine, if global codec options (e.g. "-level") are valid
for audio, video or both.
Please note that the variables in my option set as a template are filled
with values from K9Copy before the command is propagated to bash.

-Ulf

Am 14.02.19 um 14:19 schrieb Jonathan Isom:

> Hi
>
> I was thinking part of the reason for confusion is the understanding of how
> command arguments work. I didn’t include all from earlier in the thread,
> but here are some. Most arguments are preceded ‘-‘.  ‘-vf’ then its
> options, the string including crop till it reaches the space after. Each
> option is separated by spaces. So ‘-pass’ further down is not an option of
> ‘-flag8s’. Some arguments don’t have options, but most of the ones you are
> looking at do.  There are a dreadful amount of arguments in those commands.
> The scale ‘-s’ and its option ‘$WIDTHxHEIGHT’. ‘-flags’ has options but
> ‘-pass’ is not part of it. Just the ‘+loop+mv4’ part. I don’t know if
> K3copy uses the bash shell to run the ffmpeg, but I suspect it does. If you
> set all the environment variables(starts with ‘$’ like $WIDTH) in bash or
> put in in a shell script, you can trial and error the ffmpeg command line.
>
>
> -b $VIDBRk
>
> -s $WIDTHx$HEIGHT
>
> -vf crop=$WIDTH-$CROPRIGHT-$CROPLEFT:$HEIGHT-$CROPTOP-$CROPBOTTOM:$CROPLEFT:$CROPTOP
>
> -aspect $ASPECT
>
> -codec:v libx264
>
> -level 30
>
> -flags +loop+mv4
>
> ...
>
>  -pass $PASS
>
> -passlogfile $PASSLOGFILE
>
>
> Hope this is helpful.
>
> Jonathan
_______________________________________________
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: What is option -level ?

Carl Eugen Hoyos-2
2019-02-15 0:28 GMT+01:00, Ulf Zibis <[hidden email]>:
> Hi Jonathan,
>
> thanks for your hints. Unfortunately they have been already  known to
> me, but there still remain 2 questions from my side:
> - The '+' with "-flags" arguments, I can imagine, it serves as
> separator. But is that all, has '-' another meaning too?

"+" means that the flag should be set (no effect for flags that are set
by default or by the application) , "-" that the flag should be removed
(no effect if the flag is not set by default or by the application)

> There is no explanation on this at:
> https://www.ffmpeg.org/ffmpeg-codecs.html#Codec-Options

True.

> - How to determine, if global codec options (e.g. "-level") are valid
> for audio, video or both.

You cannot because it is codec-specific (so if you know the codec
you are using, you know if it - or its implementation - supports levels).

Please avoid top-posting here Carl Eugen
_______________________________________________
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: command line syntax ambiguity, was: What is option -level ?

Ulf Zibis
Hi Carl Eugen,

Am 15.02.19 um 01:06 schrieb Carl Eugen Hoyos:
> "+" means that the flag should be set (no effect for flags that are set
> by default or by the application) , "-" that the flag should be removed
> (no effect if the flag is not set by default or by the application)
>> There is no explanation on this at:
>> https://www.ffmpeg.org/ffmpeg-codecs.html#Codec-Options
>>
>> True.

Thanks! I filed a bug: https://trac.ffmpeg.org/ticket/7738

>> - How to determine, if global codec options (e.g. "-level") are valid
>> for audio, video or both.
> You cannot because it is codec-specific (so if you know the codec
> you are using, you know if it - or its implementation - supports levels).

But if I use a audio and video codec which both support the same codec
option e.g. "-level" and one wants "-level 30" for the video codec, but
no change or another value e.g. 5 for the audio codec, which syntax
should one use?

-Ulf

_______________________________________________
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: command line syntax ambiguity, was: What is option -level ?

Gyan


On 15-02-2019 02:11 PM, Ulf Zibis wrote:
> But if I use a audio and video codec which both support the same codec
> option e.g. "-level" and one wants "-level 30" for the video codec, but
> no change or another value e.g. 5 for the audio codec, which syntax
> should one use?
>

All codec options support stream specifiers, so level for 2nd audio
output stream would be

     -level:a:1 value

Gyan
_______________________________________________
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: command line syntax ambiguity, was: What is option -level ?

Ulf Zibis

Am 15.02.19 um 09:49 schrieb Gyan:
> All codec options support stream specifiers, so level for 2nd audio
> output stream would be
>
>     -level:a:1 value
Much thanks.

Is that documented somewhere? I don't find it.

-Ulf

_______________________________________________
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".
12