Re: [FFmpeg-user] Codec copy with -ss before -i and after -i is not documented [was: Re: Why are these different?]

2024-02-12 Thread Paul B Mahol
On Mon, Feb 12, 2024 at 4:29 AM Jim DeLaHunt 
wrote:

> Paul:
>
> On 2024-02-11 13:42, Paul B Mahol wrote:
> > Codec copy with -ss before -i and after -i is not documented that it
> gives different results because
> > once you do not decode everything from start you basically can notexpect
> to get always (for any
> > container and for any input) frame-accurate results in both cases.
>
> I think you are saying something important here, but I am having a hard
> time understanding what you mean.  This sentence uses the word "not"
> three times. I get lost.
>
> Let me see if I can figure it out. Is this what you mean, Paul?
>
> > [Definition of "codec copy operation": the copying of content from one
> > file to another by demuxing packets from the input container (file),
> > then muxing them unchanged into the output container (file). The "-c
> > copy" option tells FFmpeg to perform a codec copy operation.]
> >
> > The FFmpeg documentation does not say that FFmpeg gives different
> > results if you do a codec copy operation with a "-ss" option before
> > the input argument, compared to a code copy operation with the same
> > "-ss" option after the input argument. Nor does it say that FFmpeg
> > gives the same results.
> >
> > It is unreasonable to expect FFmpeg to give frame-accurate results
> > from a given "-ss" option both when the option is before and is after
> > the input argument, for every container and for every input. Instead,
> > one should expect that for some containers and for some inputs, and
> > for some cases of the "-ss" option before or after the input argument,
> > FFmpeg will give results which are inexact in the number of frames
> > passed to the output.
> >
> > But one should not expect the FFmpeg documentation to be clear about
> > which cases have frame-accurate results and which do not. The FFmpeg
> > documentation leaves any statement of results being the same or
> > different based on the position of the "-ss" option. The result of
> > this is that the FFmpeg documentation does not need to engage with the
> > task of clearly describing which cases give frame-accurate results and
> > which do not.
>
>
> I think Mark Filipak asked a reasonable and (eventually) well-defined
> question. This thread has so far been 30 messages. I get the impression
> that the answer to his question is:
>
> > Because the FFmpeg project includes different implementations for
> > different containers, input types, and "-ss" option positions, but:
> >
> >  1. The project does not require any of the implementations to give
> > frame-accurate results for the codec copy operation, (though it is
> > allowed), and
> >  2. The project does not require the documentation to describe whether
> > the results are frame-accurate or not, and
> >  3. The project does not require the documentation to confess either
> > #1 or #2.
> >  4. Because of #1, any answer to whether or not a particular case is
> > frame-accurate, or the the way in which it is inaccurate, or why,
> > must come from studying the code.
> >
> > So one should not expect a person on this list to have the answer
> > easily at hand. Mark's answer must come from studying the code.
> >
>
> I suspect Mark will not be delighted with that answer.
>

Mark wants single command example to work 100% correct in 100% situations
and that output is 100% correct 100% of time.

That is possible only for very trivial containers only currently. And
because libs are very low level it can not be done at all with current
state of code.

mpv have some sort of more advanced algo for frame-accurate seeking but its
just designed for player and might not work at all with codec copy mode.


>
>  —Jim DeLaHunt
> ___
> ffmpeg-user mailing list
> ffmpeg-user@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
>
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-user] Codec copy with -ss before -i and after -i is not documented [was: Re: Why are these different?]

2024-02-11 Thread Jim DeLaHunt

Paul:

On 2024-02-11 13:42, Paul B Mahol wrote:

Codec copy with -ss before -i and after -i is not documented that it gives 
different results because
once you do not decode everything from start you basically can notexpect to get 
always (for any
container and for any input) frame-accurate results in both cases.


I think you are saying something important here, but I am having a hard 
time understanding what you mean.  This sentence uses the word "not" 
three times. I get lost.


Let me see if I can figure it out. Is this what you mean, Paul?

[Definition of "codec copy operation": the copying of content from one 
file to another by demuxing packets from the input container (file), 
then muxing them unchanged into the output container (file). The "-c 
copy" option tells FFmpeg to perform a codec copy operation.]


The FFmpeg documentation does not say that FFmpeg gives different 
results if you do a codec copy operation with a "-ss" option before 
the input argument, compared to a code copy operation with the same 
"-ss" option after the input argument. Nor does it say that FFmpeg 
gives the same results.


It is unreasonable to expect FFmpeg to give frame-accurate results 
from a given "-ss" option both when the option is before and is after 
the input argument, for every container and for every input. Instead, 
one should expect that for some containers and for some inputs, and 
for some cases of the "-ss" option before or after the input argument, 
FFmpeg will give results which are inexact in the number of frames 
passed to the output.


But one should not expect the FFmpeg documentation to be clear about 
which cases have frame-accurate results and which do not. The FFmpeg 
documentation leaves any statement of results being the same or 
different based on the position of the "-ss" option. The result of 
this is that the FFmpeg documentation does not need to engage with the 
task of clearly describing which cases give frame-accurate results and 
which do not.



I think Mark Filipak asked a reasonable and (eventually) well-defined 
question. This thread has so far been 30 messages. I get the impression 
that the answer to his question is:


Because the FFmpeg project includes different implementations for 
different containers, input types, and "-ss" option positions, but:


 1. The project does not require any of the implementations to give
frame-accurate results for the codec copy operation, (though it is
allowed), and
 2. The project does not require the documentation to describe whether
the results are frame-accurate or not, and
 3. The project does not require the documentation to confess either
#1 or #2.
 4. Because of #1, any answer to whether or not a particular case is
frame-accurate, or the the way in which it is inaccurate, or why,
must come from studying the code.

So one should not expect a person on this list to have the answer 
easily at hand. Mark's answer must come from studying the code.




I suspect Mark will not be delighted with that answer.

    —Jim DeLaHunt
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".