diff mbox

[FFmpeg-devel,v2,1/3] ffmpeg_opt: pass output framerate as a hint to the encoder

Message ID 1486384400-5736-1-git-send-email-t.rapp@noa-archive.com
State Superseded
Headers show

Commit Message

Tobias Rapp Feb. 6, 2017, 12:33 p.m. UTC
Sets framerate field in output codec context if explicitly specified on
the command-line.

Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
---
 ffmpeg_opt.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Tobias Rapp Feb. 13, 2017, 7:51 a.m. UTC | #1
On 06.02.2017 13:33, Tobias Rapp wrote:
> Sets framerate field in output codec context if explicitly specified on
> the command-line.
>
> Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
> ---
>  ffmpeg_opt.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
> index 6a47d32..3b532da 100644
> --- a/ffmpeg_opt.c
> +++ b/ffmpeg_opt.c
> @@ -1535,6 +1535,8 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
>          av_log(NULL, AV_LOG_FATAL, "Invalid framerate value: %s\n", frame_rate);
>          exit_program(1);
>      }
> +    if (frame_rate && ost->frame_rate.num && ost->frame_rate.den)
> +        video_enc->framerate = ost->frame_rate;
>      if (frame_rate && video_sync_method == VSYNC_PASSTHROUGH)
>          av_log(NULL, AV_LOG_ERROR, "Using -vsync 0 and -r can produce invalid output files\n");
>

Ping on the patch series.
Tobias Rapp Feb. 20, 2017, 1:40 p.m. UTC | #2
On 13.02.2017 08:51, Tobias Rapp wrote:
> On 06.02.2017 13:33, Tobias Rapp wrote:
>> Sets framerate field in output codec context if explicitly specified on
>> the command-line.
>>
>> Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
>> ---
>>  ffmpeg_opt.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
>> index 6a47d32..3b532da 100644
>> --- a/ffmpeg_opt.c
>> +++ b/ffmpeg_opt.c
>> @@ -1535,6 +1535,8 @@ static OutputStream
>> *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
>>          av_log(NULL, AV_LOG_FATAL, "Invalid framerate value: %s\n",
>> frame_rate);
>>          exit_program(1);
>>      }
>> +    if (frame_rate && ost->frame_rate.num && ost->frame_rate.den)
>> +        video_enc->framerate = ost->frame_rate;
>>      if (frame_rate && video_sync_method == VSYNC_PASSTHROUGH)
>>          av_log(NULL, AV_LOG_ERROR, "Using -vsync 0 and -r can produce
>> invalid output files\n");
>>
>
> Ping on the patch series.

Ping. Having better bitrate estimation improves automatic AVI index 
space reservation (commit e65db4ce5966506d957032ef30545419801ae7dc) for 
non-constant bitrate use-cases.

Regards,
Tobias
Mark Thompson Feb. 20, 2017, 2:09 p.m. UTC | #3
On 06/02/17 12:33, Tobias Rapp wrote:
> Sets framerate field in output codec context if explicitly specified on
> the command-line.
> 
> Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
> ---
>  ffmpeg_opt.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
> index 6a47d32..3b532da 100644
> --- a/ffmpeg_opt.c
> +++ b/ffmpeg_opt.c
> @@ -1535,6 +1535,8 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
>          av_log(NULL, AV_LOG_FATAL, "Invalid framerate value: %s\n", frame_rate);
>          exit_program(1);
>      }
> +    if (frame_rate && ost->frame_rate.num && ost->frame_rate.den)
> +        video_enc->framerate = ost->frame_rate;
>      if (frame_rate && video_sync_method == VSYNC_PASSTHROUGH)
>          av_log(NULL, AV_LOG_ERROR, "Using -vsync 0 and -r can produce invalid output files\n");
>  
> 

Is there a reason not to always set this, rather than only when it is specified explicitly on the command line as you have?

(Like <https://git.libav.org/?p=libav.git;a=commit;h=d10102d23c9467d4eb84f58e0cd12be284b982f6>, though that is after the current merge point and I don't know if it interacts with anything else.)
Tobias Rapp Feb. 20, 2017, 3:05 p.m. UTC | #4
On 20.02.2017 15:09, Mark Thompson wrote:
> On 06/02/17 12:33, Tobias Rapp wrote:
>> Sets framerate field in output codec context if explicitly specified on
>> the command-line.
>>
>> Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
>> ---
>>  ffmpeg_opt.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
>> index 6a47d32..3b532da 100644
>> --- a/ffmpeg_opt.c
>> +++ b/ffmpeg_opt.c
>> @@ -1535,6 +1535,8 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
>>          av_log(NULL, AV_LOG_FATAL, "Invalid framerate value: %s\n", frame_rate);
>>          exit_program(1);
>>      }
>> +    if (frame_rate && ost->frame_rate.num && ost->frame_rate.den)
>> +        video_enc->framerate = ost->frame_rate;
>>      if (frame_rate && video_sync_method == VSYNC_PASSTHROUGH)
>>          av_log(NULL, AV_LOG_ERROR, "Using -vsync 0 and -r can produce invalid output files\n");
>>
>>
>
> Is there a reason not to always set this, rather than only when it is specified explicitly on the command line as you have?
>
> (Like <https://git.libav.org/?p=libav.git;a=commit;h=d10102d23c9467d4eb84f58e0cd12be284b982f6>, though that is after the current merge point and I don't know if it interacts with anything else.)

I just tried to be extra cautious. Merging Libav commit 
d10102d23c9467d4eb84f58e0cd12be284b982f6 would provide a more general 
solution and might be preferred.

Regards,
Tobias
Michael Niedermayer Feb. 26, 2017, 3:09 p.m. UTC | #5
On Mon, Feb 20, 2017 at 04:05:00PM +0100, Tobias Rapp wrote:
> On 20.02.2017 15:09, Mark Thompson wrote:
> >On 06/02/17 12:33, Tobias Rapp wrote:
> >>Sets framerate field in output codec context if explicitly specified on
> >>the command-line.
> >>
> >>Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
> >>---
> >> ffmpeg_opt.c | 2 ++
> >> 1 file changed, 2 insertions(+)
> >>
> >>diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
> >>index 6a47d32..3b532da 100644
> >>--- a/ffmpeg_opt.c
> >>+++ b/ffmpeg_opt.c
> >>@@ -1535,6 +1535,8 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
> >>         av_log(NULL, AV_LOG_FATAL, "Invalid framerate value: %s\n", frame_rate);
> >>         exit_program(1);
> >>     }
> >>+    if (frame_rate && ost->frame_rate.num && ost->frame_rate.den)
> >>+        video_enc->framerate = ost->frame_rate;
> >>     if (frame_rate && video_sync_method == VSYNC_PASSTHROUGH)
> >>         av_log(NULL, AV_LOG_ERROR, "Using -vsync 0 and -r can produce invalid output files\n");
> >>
> >>
> >
> >Is there a reason not to always set this, rather than only when it is specified explicitly on the command line as you have?
> >
> >(Like <https://git.libav.org/?p=libav.git;a=commit;h=d10102d23c9467d4eb84f58e0cd12be284b982f6>, though that is after the current merge point and I don't know if it interacts with anything else.)
> 
> I just tried to be extra cautious. Merging Libav commit
> d10102d23c9467d4eb84f58e0cd12be284b982f6 would provide a more
> general solution and might be preferred.

that one would change fate results, are the changed results better or
worse ?

[...]
diff mbox

Patch

diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 6a47d32..3b532da 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -1535,6 +1535,8 @@  static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
         av_log(NULL, AV_LOG_FATAL, "Invalid framerate value: %s\n", frame_rate);
         exit_program(1);
     }
+    if (frame_rate && ost->frame_rate.num && ost->frame_rate.den)
+        video_enc->framerate = ost->frame_rate;
     if (frame_rate && video_sync_method == VSYNC_PASSTHROUGH)
         av_log(NULL, AV_LOG_ERROR, "Using -vsync 0 and -r can produce invalid output files\n");