Re: [FFmpeg-devel] Fwd: Changing scan type (progressive<->interlaced) without reencoding.

2022-12-18 Thread Steinar Apalnes
Shit, sorry...I can see the replies now.

-steinar

fre. 16. des. 2022, 10:55 skrev Nicolas George :

> Steinar Apalnes (12022-12-16):
> > Did not get any response in the user list so trying here...
>
> Yes, you did.
>
> And even if you did not, that would not be an excuse to ask the question
> here.
>
> --
>   Nicolas George
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [REFUND-REQUEST]Travel cost reimbursement request

2022-12-18 Thread Michael Niedermayer
On Thu, Dec 15, 2022 at 12:29:50AM +0100, Stefano Sabatini wrote:
> On Tue, Dec 13, 2022 at 8:09 PM Carl Eugen Hoyos  wrote:
> >
> > Hi!
> >
> > I traveled to Barcelona for the development meeting and request a 
> > reimbursement:
> > Flight Vienna - Barcelona - Vienna: 449,99
> > Two nights in a hotel in Barcelona: 161,06
> > Bus to Barcelona center: 5,90
> >
> > Thank you, Carl Eugen
> 
> Approved on my side, pending Michael's approval.

LGTM

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is a danger to trust the dream we wish for rather than
the science we have, -- Dr. Kenneth Brown


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] AVX512 NUCs for FATE and development

2022-12-18 Thread Stefano Sabatini
On Sat, Dec 17, 2022 at 9:46 PM Michael Niedermayer
 wrote:
>
> On Sat, Dec 17, 2022 at 07:57:06PM +, Kieran Kunhya wrote:
> > On Sat, 10 Dec 2022 at 18:12, Carl Eugen Hoyos  wrote:
> >
> > > Am Fr., 9. Dez. 2022 um 18:07 Uhr schrieb Michael Niedermayer
> > > :
> > > >
> > > > On Thu, Dec 08, 2022 at 09:40:12PM +, Kieran Kunhya wrote:
> > > > > I intend to buy this RAM:
> > > > >
> > > https://www.amazon.co.uk/Crucial-CT2K16G4SFRA32A-PC4-25600-SODIMM-260-Pin/dp/B08C4X9VR5
> > > > >
> > > > > 2x £529 for NUCs
> > > > > 2x £102.48 for RAM
> > > > > 2x £69 for M.2 NVMe SSD
> > > > >
> > > > > £1400 total.
> > > >
> > > > iam in favor of this too
> > >
> > > +1
> >
> >
> > Just to confirm, by the time I got approval to buy this the discount was
> > over and the price of the NUC had increased to £599 and I had to buy a
> > slightly more expensive SSD as the original one I had proposed was not
> > available. This came to a total of £1560.94, not too far from my original
> > estimate of £1500.
>
> LGTM
>
> thx

Approved on my side, sorry for the delay.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] GSoC 2023

2022-12-18 Thread Thilo Borgmann

Am 15.12.22 um 23:47 schrieb Pierre-Anthony Lemieux:

I have updated the page with the HTJ2K project.


Cool, thanks!



This is a good opportunity to ask for help completing the review of
the patchset:

https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=8078

All known issues have been resolved and it would be good to merge
soon, i.e. beat the iron while it is hot.

On Thu, Dec 15, 2022 at 6:47 AM Jean-Baptiste Kempf  wrote:


Hello,

Also, please don’t copy paste ideas from previous years. If the idea did not 
get picked up for years, it won’t be more useful this year.

jb


As if both of you wouldn't be aware that there shall be no top-posting 
here...


-Thilo


On Thu, 15 Dec 2022, at 15:42, Thilo Borgmann wrote:

Hi,

as we figured during the last dev meeting on December 2nd we want to
apply again for GSoC 2023.

I told mentors often enough already that it's a vital point in our
applications to have a properly filled results page from the last GSoC
we did.
Last time no mentor cared about this - we can be quite sure that our
application will fail if we don't have [1] up-to-date until we send our
application.

Also vital for the application are already existing project ideas so
everyone interested in mentoring a project in 2023, please add your
idea(s) to [2].

The application deadline is January 23rd, I will aim for sending an
application mid January.

Thanks,
Thilo

[1] https://trac.ffmpeg.org/wiki/SponsoringPrograms/GSoC/2022/Results
[2] https://trac.ffmpeg.org/wiki/SponsoringPrograms/GSoC/2023
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


--
Jean-Baptiste Kempf -  President
+33 672 704 734
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH 1/5] avcodec/tiff: Check camera_calibration for 0

2022-12-18 Thread Michael Niedermayer
Fixes: division by 0
Fixes: 
53926/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5680347889401856

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/tiff.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 41b5a6b7e4..820457fedc 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -2050,8 +2050,10 @@ again:
 }
 
 if (!s->use_color_matrix) {
-for (i = 0; i < 3; i++)
-s->premultiply[i] /= s->camera_calibration[i][i];
+for (i = 0; i < 3; i++) {
+if (s->camera_calibration[i][i])
+s->premultiply[i] /= s->camera_calibration[i][i];
+}
 } else {
 for (int c = 0; c < 3; c++) {
 for (i = 0; i < 3; i++) {
-- 
2.17.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH 2/5] avcodec/tiff: Prettify code in dng_blit()

2022-12-18 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 libavcodec/tiff.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 820457fedc..1a1879de89 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -326,7 +326,7 @@ static void av_always_inline dng_blit(TiffContext *s, 
uint8_t *dst, int dst_stri
 scale_factor[i] = s->premultiply[s->pattern[i]] * 65535.f / 
(s->white_level - s->black_level[i]);
 } else {
 for (int i = 0; i < 4; i++)
-scale_factor[i] = 65535.f * s->premultiply[i] / (s->white_level - 
s->black_level[i]);
+scale_factor[i] = s->premultiply[   i ] * 65535.f / 
(s->white_level - s->black_level[i]);
 }
 
 if (is_single_comp) {
-- 
2.17.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH 3/5] avcodec/apac: Sanity check bits_per_coded_sample

2022-12-18 Thread Michael Niedermayer
Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 
'int'
Fixes: 
53931/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APAC_fuzzer-6072913738727424

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/apac.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/apac.c b/libavcodec/apac.c
index 030f81adce..2501209681 100644
--- a/libavcodec/apac.c
+++ b/libavcodec/apac.c
@@ -75,7 +75,9 @@ static av_cold int apac_init(AVCodecContext *avctx)
 avctx->sample_fmt = AV_SAMPLE_FMT_U8P;
 
 if (avctx->ch_layout.nb_channels < 1 ||
-avctx->ch_layout.nb_channels > 2)
+avctx->ch_layout.nb_channels > 2 ||
+avctx->bits_per_coded_sample > 32U
+)
 return AVERROR_INVALIDDATA;
 
 for (int ch = 0; ch < avctx->ch_layout.nb_channels; ch++) {
-- 
2.17.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH 4/5] avcodec/h264_slice: Use unsigned for fgs seed computation

2022-12-18 Thread Michael Niedermayer
Fixes: signed integer overflow: 2147481600 + 13408 cannot be represented in 
type 'int'
Fixes: 
53963/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-4650467311616000

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/h264_slice.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 420758ba0a..6188c74632 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1228,7 +1228,7 @@ static int h264_export_frame_props(H264Context *h)
 
 ret = ff_h2645_sei_to_frame(out, &h->sei.common, AV_CODEC_ID_H264, 
h->avctx,
 &sps->vui, sps->bit_depth_luma, 
sps->bit_depth_chroma,
-cur->poc + (h->poc_offset << 5));
+cur->poc + (unsigned)(h->poc_offset << 5));
 if (ret < 0)
 return ret;
 
-- 
2.17.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH 5/5] avcodec/wavpack: Avoid undefined shift in get_tail()

2022-12-18 Thread Michael Niedermayer
Fixes: left shift of 1208485947 by 1 places cannot be represented in type 'int'
Fixes: 
54058/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVPACK_fuzzer-5827521084260352

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/wavpack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index 3cb4077550..42859ab0a1 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -129,7 +129,7 @@ static av_always_inline unsigned get_tail(GetBitContext 
*gb, unsigned k)
 e   = (1LL << (p + 1)) - k - 1;
 res = get_bits_long(gb, p);
 if (res >= e)
-res = (res << 1) - e + get_bits1(gb);
+res = ((unsigned)res << 1) - e + get_bits1(gb);
 return res;
 }
 
-- 
2.17.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 5/5] avcodec/wavpack: Avoid undefined shift in get_tail()

2022-12-18 Thread James Almer

On 12/18/2022 2:08 PM, Michael Niedermayer wrote:

Fixes: left shift of 1208485947 by 1 places cannot be represented in type 'int'
Fixes: 
54058/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVPACK_fuzzer-5827521084260352

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
  libavcodec/wavpack.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index 3cb4077550..42859ab0a1 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -129,7 +129,7 @@ static av_always_inline unsigned get_tail(GetBitContext 
*gb, unsigned k)
  e   = (1LL << (p + 1)) - k - 1;
  res = get_bits_long(gb, p);
  if (res >= e)
-res = (res << 1) - e + get_bits1(gb);
+res = ((unsigned)res << 1) - e + get_bits1(gb);


Don't we usually do << 1U for this?


  return res;
  }
  

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 5/5] avcodec/wavpack: Avoid undefined shift in get_tail()

2022-12-18 Thread Andreas Rheinhardt
James Almer:
> On 12/18/2022 2:08 PM, Michael Niedermayer wrote:
>> Fixes: left shift of 1208485947 by 1 places cannot be represented in
>> type 'int'
>> Fixes:
>> 54058/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVPACK_fuzzer-5827521084260352
>>
>> Found-by: continuous fuzzing process
>> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
>> Signed-off-by: Michael Niedermayer 
>> ---
>>   libavcodec/wavpack.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
>> index 3cb4077550..42859ab0a1 100644
>> --- a/libavcodec/wavpack.c
>> +++ b/libavcodec/wavpack.c
>> @@ -129,7 +129,7 @@ static av_always_inline unsigned
>> get_tail(GetBitContext *gb, unsigned k)
>>   e   = (1LL << (p + 1)) - k - 1;
>>   res = get_bits_long(gb, p);
>>   if (res >= e)
>> -    res = (res << 1) - e + get_bits1(gb);
>> +    res = ((unsigned)res << 1) - e + get_bits1(gb);
> 
> Don't we usually do << 1U for this?
> 

Definitely not. The type of a shift is given by the left operand, not
the right operand, so using << 1U doesn't help at all here.
(We often use "* 2U" in such cases; "* (1U << 1)" would also be possible.)

- Andreas

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 5/5] avcodec/wavpack: Avoid undefined shift in get_tail()

2022-12-18 Thread Paul B Mahol
On 12/18/22, Michael Niedermayer  wrote:
> Fixes: left shift of 1208485947 by 1 places cannot be represented in type
> 'int'
> Fixes:
> 54058/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVPACK_fuzzer-5827521084260352
>

Please use something else than casting.

> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/wavpack.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
> index 3cb4077550..42859ab0a1 100644
> --- a/libavcodec/wavpack.c
> +++ b/libavcodec/wavpack.c
> @@ -129,7 +129,7 @@ static av_always_inline unsigned get_tail(GetBitContext
> *gb, unsigned k)
>  e   = (1LL << (p + 1)) - k - 1;
>  res = get_bits_long(gb, p);
>  if (res >= e)
> -res = (res << 1) - e + get_bits1(gb);
> +res = ((unsigned)res << 1) - e + get_bits1(gb);
>  return res;
>  }
>
> --
> 2.17.1
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH] libavdevice/pulse_audio_enc: remove inevitable early return in mute state and volume change callback

2022-12-18 Thread Varun Dhar


This patch removes an inevitable early return in libavdevice/pulse_audio_enc.c 
that prevents the user from accessing the volume or mute state of a pulseaudio 
output device. This happens because pulse_update_sink_input_info() passes a new 
pulseaudio context to pulse_audio_sink_input_cb(), causing the early return 
condition s->ctx != ctx (pulse_audio_enc.c:98) to always be true as ctx is a 
new context whereas s->ctx is the old context. As the early return is 
inevitable, the user is unable to access the volume or mute state. With this 
patch, the user will be able to access the volume or mute state of a pulseaudio 
output device.

The following code is an example showing the issue. It creates a pulse output 
device, sets the volume, then gets the volume:

#include 
#include 

#include 
#include 
#include 

//volume callback
int get_volume(AVFormatContext *ctx, int type, void *data, size_t size){
if(type == AV_DEV_TO_APP_VOLUME_LEVEL_CHANGED){
*(double*)ctx->opaque = *(double*)data;
return 0;
}
return AVERROR(ENOSYS);
}

int main(){
avdevice_register_all();
//set up pulse output stream
AVFormatContext* ctx = NULL;
avformat_alloc_output_context2(&ctx,NULL,"pulse",NULL);
AVStream* stream = avformat_new_stream(ctx,NULL);
AVCodecParameters* stream_params = stream->codecpar;
stream_params->codec_type = AVMEDIA_TYPE_AUDIO;
stream_params->codec_id = AV_CODEC_ID_PCM_S16LE;
stream_params->sample_rate = 48000;
stream_params->ch_layout.nb_channels = 2;
stream_params->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
avformat_write_header(ctx,NULL);

//set volume to 50%
double vol = 0.5;

avdevice_app_to_dev_control_message(ctx,AV_APP_TO_DEV_SET_VOLUME,&vol,sizeof(vol));
vol = 0;

//get volume (should be 50% (0.5))
ctx->opaque = &vol;
ctx->control_message_cb = &get_volume;

avdevice_app_to_dev_control_message(ctx,AV_APP_TO_DEV_GET_VOLUME,NULL,0);
assert(vol == 0.5);

av_write_trailer(ctx);
avformat_free_context(ctx);
}


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH] libavdevice/pulse_audio_enc: remove inevitable early return in mute state and volume change callback

2022-12-18 Thread Varun Dhar
Signed-off-by: Varun Dhar 
---
 libavdevice/pulse_audio_enc.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/libavdevice/pulse_audio_enc.c b/libavdevice/pulse_audio_enc.c
index 038401c680..13e3165e36 100644
--- a/libavdevice/pulse_audio_enc.c
+++ b/libavdevice/pulse_audio_enc.c
@@ -95,9 +95,6 @@ static void pulse_audio_sink_input_cb(pa_context *ctx, const 
pa_sink_input_info
 AVFormatContext *h = userdata;
 PulseData *s = h->priv_data;
 
-if (s->ctx != ctx)
-return;
-
 if (!eol) {
 double val;
 pa_volume_t vol = pa_cvolume_avg(&i->volume);
-- 
2.39.0


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH v7 0/3] 32bps FLAC patches

2022-12-18 Thread Paul B Mahol
On 12/11/22, Martijn van Beurden  wrote:
> Op do 1 dec. 2022 om 13:31 schreef Paul B Mahol :
>>
>> On 11/25/22, Paul B Mahol  wrote:
>> > On 10/11/22, Martijn van Beurden  wrote:
>> >> Recently libFLAC gained the ability (first released in FLAC 1.4.0)
>> >> to create FLAC files containing 32-bit int PCM samples. To
>> >> keep complexity reasonable, the choice was made to limit residuals
>> >> to 32-bit integers, which the encoder must make sure of. In case
>> >> the encoder cannot find any predictor of which the residuals fit
>> >> this limit, it must default to using a verbatim subframe. Tests have
>> >> shown that this does not happen often (<0.1% of subframes on a
>> >> music corpus of various styles). See also discussion here:
>> >> https://github.com/ietf-wg-cellar/flac-specification/pull/148
>> >>
>> >> These two patches implement decoding and encoding following this
>> >> format.
>> >>
>> >> Changes since v1:
>> >> fix copy-paste error in encoder, several invocations of
>> >> lpc_encode_choose_datapath used wrong parameters, making FATE fail as
>> >> compression was less than it should be
>> >>
>> >> Changes since v2:
>> >> Rebased decoder part as it didn't apply anymore
>> >>
>> >> Changes since v3:
>> >> Moved put_golomb part to flacenc.c (as it is now quite specific to
>> >> FLAC)
>> >> and renamed put_sbits64 to put_sbits63 (and changed assert
>> >> accordingly)
>> >>
>> >> Changes since v4:
>> >> Fix check of decoded_buffer_33bps malloc. Fix reading of wasted bits
>> >> for 33bps subframe. Add fate test
>> >>
>> >> Changes since v5:
>> >> Slimmed down 32 bps fate flac test from 2 to 1 input file. Replaced
>> >> -strict -2 with -strict experimental in fate and encoder warning.
>> >>
>> >> Changes since v6:
>> >> Deduplicated function bodies with preprocessor macros in both
>> >> encoder and decoder, declared variables in loop body where possible
>> >> and changed ff_ctz to ff_ctzll where necessary
>> >>
>> >> Martijn van Beurden (3):
>> >>   libavcodec/flacdec: Implement decoding of 32 bit-per-sample PCM
>> >>   libavcodec/flacenc: Implement encoding of 32 bit-per-sample PCM
>> >>   fate/flac: Add test of 32 bps encoding/decoding
>> >>
>> >>  libavcodec/flac.c   |   4 +-
>> >>  libavcodec/flacdec.c| 218 --
>> >>  libavcodec/flacenc.c| 480
>> >> +++-
>> >>  libavcodec/get_bits.h   |  12 +
>> >>  libavcodec/mathops.h|   9 +
>> >>  libavcodec/put_bits.h   |   7 +
>> >>  libavcodec/put_golomb.h |  14 --
>> >>  tests/fate/flac.mak |   4 +
>> >>  8 files changed, 602 insertions(+), 146 deletions(-)
>> >>
>> >> --
>> >> 2.30.2
>> >>
>> >
>> >
>> >
>> > If this is OK, will apply soon.
>>
>>
>> Last time to say no to this patchset.
>
> I haven't had any comments the last few weeks, it still applies
> against current git and passed FATE. If you could apply it I would be
> much obliged.
>
> Kind regards,
>
> Martijn van Beurden
>

Hi, if this still pastes FATE and compiles and applies I gonna apply
it in next 48h.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] avcodec/mediacodec_wrapper: include stdbool.h

2022-12-18 Thread zhilizhao(赵志立)



> On Dec 16, 2022, at 11:39, Zhao Zhili  wrote:
> 
> From: Zhao Zhili 
> 
> Since NDK failed to do that:
> https://github.com/android/ndk/issues/1281
> ---
> libavcodec/mediacodec_wrapper.c | 1 +
> 1 file changed, 1 insertion(+)
> 
> diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
> index 7ddf93ccc7..4d6e9487b8 100644
> --- a/libavcodec/mediacodec_wrapper.c
> +++ b/libavcodec/mediacodec_wrapper.c
> @@ -22,6 +22,7 @@
> 
> #include 
> #include 
> +#include 
> #include 
> #include 
> #include 
> -- 

Pushed as 48d5aecfc4386be096dfb5d4c021af247ef0d803.

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] 答复: [PATCH] fftools/ffmpeg_ffplay_ffprobe_cmdutils: add -safe to replace the user name and password in the protocol address

2022-12-18 Thread Wujian(Chin)


> On 17.12.2022 08:36, Wujian(Chin) wrote:
> > The Protocol address may contain the user name and password. The ps -ef 
> > command may expose the plaintext.
> > The -safe parameter option is added to replace the user name and password 
> > in the command line with the asterisk (*).
> > 
> > Signed-off-by: wujian_nanjing 
> > ---
> >   doc/ffmpeg.texi|  7 +++
> >   doc/ffplay.texi|  8 
> >   doc/ffprobe.texi   |  7 +++
> >   fftools/cmdutils.c | 47 +++
> >   fftools/cmdutils.h | 15 +++
> >   fftools/ffmpeg.c   | 16 +---
> >   fftools/ffplay.c   | 15 +--
> >   fftools/ffprobe.c  | 18 ++
> >   8 files changed, 120 insertions(+), 13 deletions(-)
> > 
> > diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 0367930..e905542 
> > 100644
> > --- a/doc/ffmpeg.texi
> > +++ b/doc/ffmpeg.texi
> > @@ -50,6 +50,13 @@ output files. Also do not mix options which belong to 
> > different files. All
> >   options apply ONLY to the next input or output file and are reset between 
> > files.
> >   
> >   @itemize
> > +@item -safe
> > +The Protocol address may contain the user name and password. The ps -ef 
> > command may expose the plaintext.
> > +The -safe parameter option is added to replace the user name and password 
> > in the command line with the asterisk (*).
> > +@example
> > +ffmpeg -safe -i rtsp://usern...@password..com @end example
> > +
> >   @item
> >   To set the video bitrate of the output file to 64 kbit/s:
> >   @example
> > diff --git a/doc/ffplay.texi b/doc/ffplay.texi index 5dd860b..f46ca91 
> > 100644
> > --- a/doc/ffplay.texi
> > +++ b/doc/ffplay.texi
> > @@ -122,6 +122,14 @@ Read @var{input_url}.
> >   
> >   @section Advanced options
> >   @table @option
> > +
> > +@item -safe
> > +The Protocol address may contain the user name and password. The ps -ef 
> > command may expose the plaintext.
> > +The -safe parameter option is added to replace the user name and password 
> > in the command line with the asterisk (*).
> > +@example
> > +ffplay -safe -i rtsp://usern...@password..com @end example
> > +
> >   @item -stats
> >   Print several playback statistics, in particular show the stream
> >   duration, the codec parameters, the current position in the stream 
> > and diff --git a/doc/ffprobe.texi b/doc/ffprobe.texi index 
> > 4dc9f57..92b13cf 100644
> > --- a/doc/ffprobe.texi
> > +++ b/doc/ffprobe.texi
> > @@ -89,6 +89,13 @@ Set the output printing format.
> >   @var{writer_name} specifies the name of the writer, and
> >   @var{writer_options} specifies the options to be passed to the writer.
> >   
> > +@item -safe
> > +The Protocol address may contain the user name and password. The ps -ef 
> > command may expose the plaintext.
> > +The -safe parameter option is added to replace the user name and password 
> > in the command line with the asterisk (*).
> > +@example
> > +ffprobe -safe -i rtsp://usern...@password..com @end example
> > +
> >   For example for printing the output in JSON format, specify:
> >   @example
> >   -print_format json
> > diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 
> > a1de621..22407f8 100644
> > --- a/fftools/cmdutils.c
> > +++ b/fftools/cmdutils.c
> > @@ -61,6 +61,40 @@ AVDictionary *format_opts, *codec_opts;
> >   
> >   int hide_banner = 0;
> >   
> > +void param_masking(int argc, char **argv) {
> > +int i, j;
> > +for (i = 1; i < argc; i++) {
> > +char *match = strstr(argv[i], "://");
> > +if (match) {
> > +int total = strlen(argv[i]);
> > +for (j = 0; j < total; j++) {
> > +argv[i][j] = '*';
> > +}
> > +}
> > +}
> > +}

> Won't that replace the entire parameter, as in, the full URL, with ***?
> While the documentation claims only the username/password will be replaced.

The description is incorrect. The URL of the user name and password should be 
replaced. I will modify it later.

Thank you for your question .
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] 答复: [PATCH] fftools/ffmpeg_ffplay_ffprobe_cmdutils: add -safe to replace the user name and password in the protocol address

2022-12-18 Thread Wujian(Chin)


>Am Sa., 17. Dez. 2022 um 08:36 Uhr schrieb Wujian(Chin) :
>>
>> The Protocol address may contain the user name and password. The ps -ef 
>> command may expose the plaintext.

>Please add a sentence explaining why this is an issue.

Other users can run the ps -ef command to view sensitive information such as 
the user name and password in the URL, which is insecure.


>> The -safe parameter option is added to replace the user name and password in 
>> the command line with the asterisk (*).
>>
>> Signed-off-by: wujian_nanjing 
>> ---
>>  doc/ffmpeg.texi|  7 +++
>>  doc/ffplay.texi|  8 
>>  doc/ffprobe.texi   |  7 +++
>>  fftools/cmdutils.c | 47 
>> +++
>>  fftools/cmdutils.h | 15 +++
>>  fftools/ffmpeg.c   | 16 +---
>>  fftools/ffplay.c   | 15 +--
>>  fftools/ffprobe.c  | 18 ++
>>  8 files changed, 120 insertions(+), 13 deletions(-)
>>
>> diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 0367930..e905542 
>> 100644
>> --- a/doc/ffmpeg.texi
>> +++ b/doc/ffmpeg.texi
>> @@ -50,6 +50,13 @@ output files. Also do not mix options which belong 
>> to different files. All  options apply ONLY to the next input or output file 
>> and are reset between files.
>>
>>  @itemize
>> +@item -safe
>> +The Protocol address may contain the user name and password. The ps -ef 
>> command may expose the plaintext.
>> +The -safe parameter option is added to replace the user name and password 
>> in the command line with the asterisk (*).
>> +@example

>> +ffmpeg -safe -i rtsp://usern...@password..com

>I believe this should be example.com

>Carl Eugen

ffmpeg -i rtsp://username:password@url  test.mp4
eg:ffmpeg -i rtsp://jack:WSX2344we@10.0.0.1:8554/stream/testqwee test.mp4
The user name and password are used for interaction with the video source 
server.

I'll modify the document description later.
Carl Eugen, thanks for your question.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] fftools/ffmpeg_ffplay_ffprobe_cmdutils: add -safe to replace the user name and password in the protocol address

2022-12-18 Thread zhilizhao(赵志立)


> On Dec 17, 2022, at 15:36, Wujian(Chin)  wrote:
> 
> The Protocol address may contain the user name and password. The ps -ef 
> command may expose the plaintext.
> The -safe parameter option is added to replace the user name and password in 
> the command line with the asterisk (*).

The patch reduced the risk to a low level, but I don’t think it
fixed the security issue totally. It’s still there with a small
time window. The usecase itself is unsafe.

There is an -safe option in concat demuxer, please make sure there
is no conflict.

concat demuxer AVOptions:
  -safe  .D. enable safe mode (default true)

> 
> Signed-off-by: wujian_nanjing 
> ---
> doc/ffmpeg.texi|  7 +++
> doc/ffplay.texi|  8 
> doc/ffprobe.texi   |  7 +++
> fftools/cmdutils.c | 47 +++
> fftools/cmdutils.h | 15 +++
> fftools/ffmpeg.c   | 16 +---
> fftools/ffplay.c   | 15 +--
> fftools/ffprobe.c  | 18 ++
> 8 files changed, 120 insertions(+), 13 deletions(-)
> 
> diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
> index 0367930..e905542 100644
> --- a/doc/ffmpeg.texi
> +++ b/doc/ffmpeg.texi
> @@ -50,6 +50,13 @@ output files. Also do not mix options which belong to 
> different files. All
> options apply ONLY to the next input or output file and are reset between 
> files.
> 
> @itemize
> +@item -safe
> +The Protocol address may contain the user name and password. The ps -ef 
> command may expose the plaintext.
> +The -safe parameter option is added to replace the user name and password in 
> the command line with the asterisk (*).
> +@example
> +ffmpeg -safe -i rtsp://usern...@password..com
> +@end example
> +
> @item
> To set the video bitrate of the output file to 64 kbit/s:
> @example
> diff --git a/doc/ffplay.texi b/doc/ffplay.texi
> index 5dd860b..f46ca91 100644
> --- a/doc/ffplay.texi
> +++ b/doc/ffplay.texi
> @@ -122,6 +122,14 @@ Read @var{input_url}.
> 
> @section Advanced options
> @table @option
> +
> +@item -safe
> +The Protocol address may contain the user name and password. The ps -ef 
> command may expose the plaintext.
> +The -safe parameter option is added to replace the user name and password in 
> the command line with the asterisk (*).
> +@example
> +ffplay -safe -i rtsp://usern...@password..com
> +@end example
> +
> @item -stats
> Print several playback statistics, in particular show the stream
> duration, the codec parameters, the current position in the stream and
> diff --git a/doc/ffprobe.texi b/doc/ffprobe.texi
> index 4dc9f57..92b13cf 100644
> --- a/doc/ffprobe.texi
> +++ b/doc/ffprobe.texi
> @@ -89,6 +89,13 @@ Set the output printing format.
> @var{writer_name} specifies the name of the writer, and
> @var{writer_options} specifies the options to be passed to the writer.
> 
> +@item -safe
> +The Protocol address may contain the user name and password. The ps -ef 
> command may expose the plaintext.
> +The -safe parameter option is added to replace the user name and password in 
> the command line with the asterisk (*).
> +@example
> +ffprobe -safe -i rtsp://usern...@password..com
> +@end example
> +
> For example for printing the output in JSON format, specify:
> @example
> -print_format json
> diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
> index a1de621..22407f8 100644
> --- a/fftools/cmdutils.c
> +++ b/fftools/cmdutils.c
> @@ -61,6 +61,40 @@ AVDictionary *format_opts, *codec_opts;
> 
> int hide_banner = 0;
> 
> +void param_masking(int argc, char **argv) {
> +int i, j;
> +for (i = 1; i < argc; i++) {
> +char *match = strstr(argv[i], "://");
> +if (match) {
> +int total = strlen(argv[i]);
> +for (j = 0; j < total; j++) {
> +argv[i][j] = '*';
> +}
> +}
> +}
> +}
> +
> +char **copy_argv(int argc, char **argv) {
> +char **argv2;
> +argv2 = av_mallocz(argc * sizeof(char *));
> +if (!argv2)
> +exit_program(1);
> +
> +for (int i = 0; i < argc; i++) {
> +int length = strlen(argv[i]) + 1;
> +argv2[i] = av_mallocz(length * sizeof(char *));
> +if (!argv2[i])
> +exit_program(1);
> +memcpy(argv2[i], argv[i], length - 1);
> +}
> +return argv2;
> +}
> +
> +void free_pp(int argc, char **argv) {
> +for (int i = 0; i < argc; i++)
> +av_free(argv[i]);
> +av_free(argv);
> +}
> void uninit_opts(void)
> {
> av_dict_free(&swr_opts);
> @@ -215,13 +249,13 @@ static void prepare_app_arguments(int *argc_ptr, char 
> ***argv_ptr)
> if (win32_argv_utf8) {
> *argc_ptr = win32_argc;
> *argv_ptr = win32_argv_utf8;
> -return;
> +goto end;
> }
> 
> win32_argc = 0;
> argv_w = CommandLineToArgvW(GetCommandLineW(), &win32_argc);
> if (win32_argc <= 0 || !argv_w)
> -return;
> +goto end;
> 
> /* determine the UTF-8 buffer size (including N

[FFmpeg-devel] [PATCH] avformat/mov: fix buffering issue on playing HTTP(s)/mp4.

2022-12-18 Thread Chen, Jinkai
Using separated HTTP connection for each stream,
prevent from reading audio and video in long distance,
which cause seeking(http request) repeatedly.
Storing the user options when open input,
and make sure that can be passed to demuxer context.

Some source can reproducing the issue:
https://ali-sprite-video.yyouwang.com/video/works/202211/1667997073624_73.mp4
https://images.voghion.com/productImages/04_01_C_30011_2020220106GiuseppeFanara0012.mp4

Signed-off-by: CJK mailto:chenjin...@agora.io>>
---
libavformat/avformat.c |  1 +
libavformat/demux.c|  5 -
libavformat/internal.h |  5 +
libavformat/mov.c  | 16 
4 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/libavformat/avformat.c b/libavformat/avformat.c
index 19c7219471..4453727f34 100644
--- a/libavformat/avformat.c
+++ b/libavformat/avformat.c
@@ -129,6 +129,7 @@ void avformat_free_context(AVFormatContext *s)
av_freep(&s->chapters);
av_dict_free(&s->metadata);
av_dict_free(&si->id3v2_meta);
+av_dict_free(&si->options);
av_packet_free(&si->pkt);
av_packet_free(&si->parse_pkt);
av_freep(&s->streams);
diff --git a/libavformat/demux.c b/libavformat/demux.c
index 2dfd82a63c..2377bfdab0 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -237,8 +237,11 @@ int avformat_open_input(AVFormatContext **ps, const char 
*filename,
if (fmt)
s->iformat = fmt;

-if (options)
+if (options) {
av_dict_copy(&tmp, *options, 0);
+si->options = NULL;
+av_dict_copy(&si->options, *options, 0);
+}

if (s->pb) // must be before any goto fail
s->flags |= AVFMT_FLAG_CUSTOM_IO;
diff --git a/libavformat/internal.h b/libavformat/internal.h
index ce837fefc7..7caae8b93e 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -186,6 +186,11 @@ typedef struct FFFormatContext {
 * Contexts and child contexts do not contain a metadata option
 */
int metafree;
+
+/**
+ * options from avformat_open_input
+ */
+AVDictionary *options;
} FFFormatContext;

static av_always_inline FFFormatContext *ffformatcontext(AVFormatContext *s)
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 29bd3103e3..1e1a7c2f7f 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4456,6 +4456,7 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
{
AVStream *st;
MOVStreamContext *sc;
+URLContext *url_context;
int ret;

st = avformat_new_stream(c->fc, NULL);
@@ -4501,6 +4502,8 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)

mov_build_index(c, st);

+url_context = ffio_geturlcontext(c->fc->pb);
+av_assert0(url_context);
if (sc->dref_id-1 < sc->drefs_count && sc->drefs[sc->dref_id-1].path) {
MOVDref *dref = &sc->drefs[sc->dref_id - 1];
if (c->enable_drefs) {
@@ -4510,6 +4513,19 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
   "filename='%s', volume='%s', nlvl_from=%d, nlvl_to=%d\n",
   st->index, dref->path, dref->dir, dref->filename,
   dref->volume, dref->nlvl_from, dref->nlvl_to);
+} else if (strcmp(url_context->prot->name, "http") == 0 ||
+   strcmp(url_context->prot->name, "https") == 0) {
+FFFormatContext *const si = ffformatcontext(c->fc);
+AVDictionary *opts = NULL;
+av_dict_copy(&opts, si->options, 0);
+ret = c->fc->io_open(c->fc, &sc->pb, c->fc->url, AVIO_FLAG_READ, 
&opts);
+av_dict_free(&opts);
+if (ret < 0) {
+av_log(c->fc, AV_LOG_ERROR,
+"mov/http(s) stream %d, error opening url %s.\n",
+st->index, c->fc->url);
+return ret;
+}
} else {
av_log(c->fc, AV_LOG_WARNING,
   "Skipped opening external track: "
--
2.24.3 (Apple Git-128)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] avformat/mov: fix buffering issue on playing HTTP(s)/mp4.

2022-12-18 Thread zhilizhao(赵志立)

> On Dec 19, 2022, at 12:24, Chen, Jinkai  wrote:
> 
> Using separated HTTP connection for each stream,
> prevent from reading audio and video in long distance,
> which cause seeking(http request) repeatedly.
> Storing the user options when open input,
> and make sure that can be passed to demuxer context.

The patch is harmful for normal files, and the implementation isn’t clean, so 
NAK.

> 
> Some source can reproducing the issue:
> https://ali-sprite-video.yyouwang.com/video/works/202211/1667997073624_73.mp4
> https://images.voghion.com/productImages/04_01_C_30011_2020220106GiuseppeFanara0012.mp4
> 
> Signed-off-by: CJK mailto:chenjin...@agora.io>>
> ---
> libavformat/avformat.c |  1 +
> libavformat/demux.c|  5 -
> libavformat/internal.h |  5 +
> libavformat/mov.c  | 16 
> 4 files changed, 26 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/avformat.c b/libavformat/avformat.c
> index 19c7219471..4453727f34 100644
> --- a/libavformat/avformat.c
> +++ b/libavformat/avformat.c
> @@ -129,6 +129,7 @@ void avformat_free_context(AVFormatContext *s)
>av_freep(&s->chapters);
>av_dict_free(&s->metadata);
>av_dict_free(&si->id3v2_meta);
> +av_dict_free(&si->options);
>av_packet_free(&si->pkt);
>av_packet_free(&si->parse_pkt);
>av_freep(&s->streams);
> diff --git a/libavformat/demux.c b/libavformat/demux.c
> index 2dfd82a63c..2377bfdab0 100644
> --- a/libavformat/demux.c
> +++ b/libavformat/demux.c
> @@ -237,8 +237,11 @@ int avformat_open_input(AVFormatContext **ps, const char 
> *filename,
>if (fmt)
>s->iformat = fmt;
> 
> -if (options)
> +if (options) {
>av_dict_copy(&tmp, *options, 0);
> +si->options = NULL;
> +av_dict_copy(&si->options, *options, 0);
> +}
> 
>if (s->pb) // must be before any goto fail
>s->flags |= AVFMT_FLAG_CUSTOM_IO;
> diff --git a/libavformat/internal.h b/libavformat/internal.h
> index ce837fefc7..7caae8b93e 100644
> --- a/libavformat/internal.h
> +++ b/libavformat/internal.h
> @@ -186,6 +186,11 @@ typedef struct FFFormatContext {
> * Contexts and child contexts do not contain a metadata option
> */
>int metafree;
> +
> +/**
> + * options from avformat_open_input
> + */
> +AVDictionary *options;
> } FFFormatContext;
> 
> static av_always_inline FFFormatContext *ffformatcontext(AVFormatContext *s)
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 29bd3103e3..1e1a7c2f7f 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -4456,6 +4456,7 @@ static int mov_read_trak(MOVContext *c, AVIOContext 
> *pb, MOVAtom atom)
> {
>AVStream *st;
>MOVStreamContext *sc;
> +URLContext *url_context;
>int ret;
> 
>st = avformat_new_stream(c->fc, NULL);
> @@ -4501,6 +4502,8 @@ static int mov_read_trak(MOVContext *c, AVIOContext 
> *pb, MOVAtom atom)
> 
>mov_build_index(c, st);
> 
> +url_context = ffio_geturlcontext(c->fc->pb);
> +av_assert0(url_context);
>if (sc->dref_id-1 < sc->drefs_count && sc->drefs[sc->dref_id-1].path) {
>MOVDref *dref = &sc->drefs[sc->dref_id - 1];
>if (c->enable_drefs) {
> @@ -4510,6 +4513,19 @@ static int mov_read_trak(MOVContext *c, AVIOContext 
> *pb, MOVAtom atom)
>   "filename='%s', volume='%s', nlvl_from=%d, 
> nlvl_to=%d\n",
>   st->index, dref->path, dref->dir, dref->filename,
>   dref->volume, dref->nlvl_from, dref->nlvl_to);
> +} else if (strcmp(url_context->prot->name, "http") == 0 ||
> +   strcmp(url_context->prot->name, "https") == 0) {
> +FFFormatContext *const si = ffformatcontext(c->fc);
> +AVDictionary *opts = NULL;
> +av_dict_copy(&opts, si->options, 0);
> +ret = c->fc->io_open(c->fc, &sc->pb, c->fc->url, AVIO_FLAG_READ, 
> &opts);
> +av_dict_free(&opts);
> +if (ret < 0) {
> +av_log(c->fc, AV_LOG_ERROR,
> +"mov/http(s) stream %d, error opening url %s.\n",
> +st->index, c->fc->url);
> +return ret;
> +}
>} else {
>av_log(c->fc, AV_LOG_WARNING,
>   "Skipped opening external track: "
> --
> 2.24.3 (Apple Git-128)
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] 答复: [PATCH] fftools/ffmpeg_ffplay_ffprobe_cmdutils: add -safe to replace the user name and password in the protocol address

2022-12-18 Thread Wujian(Chin)

>> On Dec 17, 2022, at 15:36, Wujian(Chin)  wrote:
>> 
>> The Protocol address may contain the user name and password. The ps -ef 
>> command may expose the plaintext.
>> The -safe parameter option is added to replace the user name and password in 
>> the command line with the asterisk (*).

>The patch reduced the risk to a low level, but I don’t think it fixed the 
>security issue totally. It’s still there with a small time window. The usecase 
>itself is unsafe.

It's still there with a small time window, too short for people to capture.
Do you have any other better way, if not, this way prevents 99% of the scenes 
better than not doing it at all.


>There is an -safe option in concat demuxer, please make sure there is no 
>conflict.
>concat demuxer AVOptions:
>  -safe  .D. enable safe mode (default true)

There is no conflict because -safe is identified by the second parameter after 
ffmpeg/ffprobe/ffplay.


>> Signed-off-by: wujian_nanjing 
>> ---
>> doc/ffmpeg.texi|  7 +++
>> doc/ffplay.texi|  8 
>> doc/ffprobe.texi   |  7 +++
>> fftools/cmdutils.c | 47 
>> +++
>> fftools/cmdutils.h | 15 +++
>> fftools/ffmpeg.c   | 16 +---
>> fftools/ffplay.c   | 15 +--
>> fftools/ffprobe.c  | 18 ++
>> 8 files changed, 120 insertions(+), 13 deletions(-)
>> 
>> diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 0367930..e905542 
>> 100644
>> --- a/doc/ffmpeg.texi
>> +++ b/doc/ffmpeg.texi
>> @@ -50,6 +50,13 @@ output files. Also do not mix options which belong 
>> to different files. All options apply ONLY to the next input or output file 
>> and are reset between files.
>> 
>> @itemize
>> +@item -safe
>> +The Protocol address may contain the user name and password. The ps -ef 
>> command may expose the plaintext.
>> +The -safe parameter option is added to replace the user name and password 
>> in the command line with the asterisk (*).
>> +@example
>> +ffmpeg -safe -i rtsp://usern...@password..com @end example
>> +
>> @item
>> To set the video bitrate of the output file to 64 kbit/s:
>> @example
>> diff --git a/doc/ffplay.texi b/doc/ffplay.texi index 5dd860b..f46ca91 
>> 100644
>> --- a/doc/ffplay.texi
>> +++ b/doc/ffplay.texi
>> @@ -122,6 +122,14 @@ Read @var{input_url}.
>> 
>> @section Advanced options
>> @table @option
>> +
>> +@item -safe
>> +The Protocol address may contain the user name and password. The ps -ef 
>> command may expose the plaintext.
>> +The -safe parameter option is added to replace the user name and password 
>> in the command line with the asterisk (*).
>> +@example
>> +ffplay -safe -i rtsp://usern...@password..com @end example
>> +
>> @item -stats
>> Print several playback statistics, in particular show the stream 
>> duration, the codec parameters, the current position in the stream and 
>> diff --git a/doc/ffprobe.texi b/doc/ffprobe.texi index 
>> 4dc9f57..92b13cf 100644
>> --- a/doc/ffprobe.texi
>> +++ b/doc/ffprobe.texi
>> @@ -89,6 +89,13 @@ Set the output printing format.
>> @var{writer_name} specifies the name of the writer, and 
>> @var{writer_options} specifies the options to be passed to the writer.
>> 
>> +@item -safe
>> +The Protocol address may contain the user name and password. The ps -ef 
>> command may expose the plaintext.
>> +The -safe parameter option is added to replace the user name and password 
>> in the command line with the asterisk (*).
>> +@example
>> +ffprobe -safe -i rtsp://usern...@password..com @end example
>> +
>> For example for printing the output in JSON format, specify:
>> @example
>> -print_format json
>> diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 
>> a1de621..22407f8 100644
>> --- a/fftools/cmdutils.c
>> +++ b/fftools/cmdutils.c
>> @@ -61,6 +61,40 @@ AVDictionary *format_opts, *codec_opts;
>> 
>> int hide_banner = 0;
>> 
>> +void param_masking(int argc, char **argv) {
>> +int i, j;
>> +for (i = 1; i < argc; i++) {
>> +char *match = strstr(argv[i], "://");
>> +if (match) {
>> +int total = strlen(argv[i]);
>> +for (j = 0; j < total; j++) {
>> +argv[i][j] = '*';
>> +}
>> +}
>> +}
>> +}
>> +
>> +char **copy_argv(int argc, char **argv) {
>> +char **argv2;
>> +argv2 = av_mallocz(argc * sizeof(char *));
>> +if (!argv2)
>> +exit_program(1);
>> +
>> +for (int i = 0; i < argc; i++) {
>> +int length = strlen(argv[i]) + 1;
>> +argv2[i] = av_mallocz(length * sizeof(char *));
>> +if (!argv2[i])
>> +exit_program(1);
>> +memcpy(argv2[i], argv[i], length - 1);
>> +}
>> +return argv2;
>> +}
>> +
>> +void free_pp(int argc, char **argv) {
>> +for (int i = 0; i < argc; i++)
>> +av_free(argv[i]);
>> +av_free(argv);
>> +}
>> void uninit_opts(void)
>> {
>> av_dict_free(&swr_opts);
>> @@ -215,13 +249,13 @@ static void prepare_app

Re: [FFmpeg-devel] [PATCH] avformat/mov: fix buffering issue on playing HTTP(s)/mp4.

2022-12-18 Thread Chen, Jinkai
So. I apply this strategy when it’s on HTTP/HTTPs, and it’s not affect local 
normal files.

Could you please show me a bad case on this solution ? I appreciated and try to 
fix it. Thanks.

> 2022年12月19日 下午2:18,zhilizhao(赵志立)  写道:
> 
> [你通常不会收到来自 quinkbl...@foxmail.com 的电子邮件。请访问 
> https://aka.ms/LearnAboutSenderIdentification,以了解这一点为什么很重要]
> 
>> On Dec 19, 2022, at 12:24, Chen, Jinkai  wrote:
>> 
>> Using separated HTTP connection for each stream,
>> prevent from reading audio and video in long distance,
>> which cause seeking(http request) repeatedly.
>> Storing the user options when open input,
>> and make sure that can be passed to demuxer context.
> 
> The patch is harmful for normal files, and the implementation isn’t clean, so 
> NAK.
> 
>> 
>> Some source can reproducing the issue:
>> https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fali-sprite-video.yyouwang.com%2Fvideo%2Fworks%2F202211%2F1667997073624_73.mp4&data=05%7C01%7Cchenjinkai%40agora.io%7Cb9e67445d035449f081608dae188efd6%7C602753743eaa49c283c3cc189d126981%7C0%7C0%7C638070275515676009%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Zkr9rHCQncaiW9OmzDzzlWXkTZdlUQSz%2FnDRs2m7fzg%3D&reserved=0
>> https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fimages.voghion.com%2FproductImages%2F04_01_C_30011_2020220106GiuseppeFanara0012.mp4&data=05%7C01%7Cchenjinkai%40agora.io%7Cb9e67445d035449f081608dae188efd6%7C602753743eaa49c283c3cc189d126981%7C0%7C0%7C638070275515676009%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=N5fGtmMWY5t2SZ3QkNCFCRAxq2XPCPKimmn5QS5jZyU%3D&reserved=0
>> 
>> Signed-off-by: CJK mailto:chenjin...@agora.io>>
>> ---
>> libavformat/avformat.c |  1 +
>> libavformat/demux.c|  5 -
>> libavformat/internal.h |  5 +
>> libavformat/mov.c  | 16 
>> 4 files changed, 26 insertions(+), 1 deletion(-)
>> 
>> diff --git a/libavformat/avformat.c b/libavformat/avformat.c
>> index 19c7219471..4453727f34 100644
>> --- a/libavformat/avformat.c
>> +++ b/libavformat/avformat.c
>> @@ -129,6 +129,7 @@ void avformat_free_context(AVFormatContext *s)
>>   av_freep(&s->chapters);
>>   av_dict_free(&s->metadata);
>>   av_dict_free(&si->id3v2_meta);
>> +av_dict_free(&si->options);
>>   av_packet_free(&si->pkt);
>>   av_packet_free(&si->parse_pkt);
>>   av_freep(&s->streams);
>> diff --git a/libavformat/demux.c b/libavformat/demux.c
>> index 2dfd82a63c..2377bfdab0 100644
>> --- a/libavformat/demux.c
>> +++ b/libavformat/demux.c
>> @@ -237,8 +237,11 @@ int avformat_open_input(AVFormatContext **ps, const 
>> char *filename,
>>   if (fmt)
>>   s->iformat = fmt;
>> 
>> -if (options)
>> +if (options) {
>>   av_dict_copy(&tmp, *options, 0);
>> +si->options = NULL;
>> +av_dict_copy(&si->options, *options, 0);
>> +}
>> 
>>   if (s->pb) // must be before any goto fail
>>   s->flags |= AVFMT_FLAG_CUSTOM_IO;
>> diff --git a/libavformat/internal.h b/libavformat/internal.h
>> index ce837fefc7..7caae8b93e 100644
>> --- a/libavformat/internal.h
>> +++ b/libavformat/internal.h
>> @@ -186,6 +186,11 @@ typedef struct FFFormatContext {
>>* Contexts and child contexts do not contain a metadata option
>>*/
>>   int metafree;
>> +
>> +/**
>> + * options from avformat_open_input
>> + */
>> +AVDictionary *options;
>> } FFFormatContext;
>> 
>> static av_always_inline FFFormatContext *ffformatcontext(AVFormatContext *s)
>> diff --git a/libavformat/mov.c b/libavformat/mov.c
>> index 29bd3103e3..1e1a7c2f7f 100644
>> --- a/libavformat/mov.c
>> +++ b/libavformat/mov.c
>> @@ -4456,6 +4456,7 @@ static int mov_read_trak(MOVContext *c, AVIOContext 
>> *pb, MOVAtom atom)
>> {
>>   AVStream *st;
>>   MOVStreamContext *sc;
>> +URLContext *url_context;
>>   int ret;
>> 
>>   st = avformat_new_stream(c->fc, NULL);
>> @@ -4501,6 +4502,8 @@ static int mov_read_trak(MOVContext *c, AVIOContext 
>> *pb, MOVAtom atom)
>> 
>>   mov_build_index(c, st);
>> 
>> +url_context = ffio_geturlcontext(c->fc->pb);
>> +av_assert0(url_context);
>>   if (sc->dref_id-1 < sc->drefs_count && sc->drefs[sc->dref_id-1].path) {
>>   MOVDref *dref = &sc->drefs[sc->dref_id - 1];
>>   if (c->enable_drefs) {
>> @@ -4510,6 +4513,19 @@ static int mov_read_trak(MOVContext *c, AVIOContext 
>> *pb, MOVAtom atom)
>>  "filename='%s', volume='%s', nlvl_from=%d, 
>> nlvl_to=%d\n",
>>  st->index, dref->path, dref->dir, dref->filename,
>>  dref->volume, dref->nlvl_from, dref->nlvl_to);
>> +} else if (strcmp(url_context->prot->name, "http") == 0 ||
>> +   strcmp(url_context->prot->name, "https") == 0) {
>> +FFFormatContext *const si = ffformatcontext(c->fc);
>> +AVDictionary *opts = NULL;
>> +av_dict_copy(&opts, si->options, 0);
>> +ret 

Re: [FFmpeg-devel] [PATCH] avformat/mov: fix buffering issue on playing HTTP(s)/mp4.

2022-12-18 Thread zhilizhao(赵志立)


> On Dec 19, 2022, at 15:04, Chen, Jinkai  wrote:
> 
> So. I apply this strategy when it’s on HTTP/HTTPs, and it’s not affect local 
> normal files.
> 
> Could you please show me a bad case on this solution ? I appreciated and try 
> to fix it. Thanks.

It will download the same file twice.

> 
>> 2022年12月19日 下午2:18,zhilizhao(赵志立)  写道:
>> 
>> [你通常不会收到来自 quinkbl...@foxmail.com 的电子邮件。请访问 
>> https://aka.ms/LearnAboutSenderIdentification,以了解这一点为什么很重要]
>> 
>>> On Dec 19, 2022, at 12:24, Chen, Jinkai  wrote:
>>> 
>>> Using separated HTTP connection for each stream,
>>> prevent from reading audio and video in long distance,
>>> which cause seeking(http request) repeatedly.
>>> Storing the user options when open input,
>>> and make sure that can be passed to demuxer context.
>> 
>> The patch is harmful for normal files, and the implementation isn’t clean, 
>> so NAK.
>> 
>>> 
>>> Some source can reproducing the issue:
>>> https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fali-sprite-video.yyouwang.com%2Fvideo%2Fworks%2F202211%2F1667997073624_73.mp4&data=05%7C01%7Cchenjinkai%40agora.io%7Cb9e67445d035449f081608dae188efd6%7C602753743eaa49c283c3cc189d126981%7C0%7C0%7C638070275515676009%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Zkr9rHCQncaiW9OmzDzzlWXkTZdlUQSz%2FnDRs2m7fzg%3D&reserved=0
>>> https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fimages.voghion.com%2FproductImages%2F04_01_C_30011_2020220106GiuseppeFanara0012.mp4&data=05%7C01%7Cchenjinkai%40agora.io%7Cb9e67445d035449f081608dae188efd6%7C602753743eaa49c283c3cc189d126981%7C0%7C0%7C638070275515676009%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=N5fGtmMWY5t2SZ3QkNCFCRAxq2XPCPKimmn5QS5jZyU%3D&reserved=0
>>> 
>>> Signed-off-by: CJK mailto:chenjin...@agora.io>>
>>> ---
>>> libavformat/avformat.c |  1 +
>>> libavformat/demux.c|  5 -
>>> libavformat/internal.h |  5 +
>>> libavformat/mov.c  | 16 
>>> 4 files changed, 26 insertions(+), 1 deletion(-)
>>> 
>>> diff --git a/libavformat/avformat.c b/libavformat/avformat.c
>>> index 19c7219471..4453727f34 100644
>>> --- a/libavformat/avformat.c
>>> +++ b/libavformat/avformat.c
>>> @@ -129,6 +129,7 @@ void avformat_free_context(AVFormatContext *s)
>>>  av_freep(&s->chapters);
>>>  av_dict_free(&s->metadata);
>>>  av_dict_free(&si->id3v2_meta);
>>> +av_dict_free(&si->options);
>>>  av_packet_free(&si->pkt);
>>>  av_packet_free(&si->parse_pkt);
>>>  av_freep(&s->streams);
>>> diff --git a/libavformat/demux.c b/libavformat/demux.c
>>> index 2dfd82a63c..2377bfdab0 100644
>>> --- a/libavformat/demux.c
>>> +++ b/libavformat/demux.c
>>> @@ -237,8 +237,11 @@ int avformat_open_input(AVFormatContext **ps, const 
>>> char *filename,
>>>  if (fmt)
>>>  s->iformat = fmt;
>>> 
>>> -if (options)
>>> +if (options) {
>>>  av_dict_copy(&tmp, *options, 0);
>>> +si->options = NULL;
>>> +av_dict_copy(&si->options, *options, 0);
>>> +}
>>> 
>>>  if (s->pb) // must be before any goto fail
>>>  s->flags |= AVFMT_FLAG_CUSTOM_IO;
>>> diff --git a/libavformat/internal.h b/libavformat/internal.h
>>> index ce837fefc7..7caae8b93e 100644
>>> --- a/libavformat/internal.h
>>> +++ b/libavformat/internal.h
>>> @@ -186,6 +186,11 @@ typedef struct FFFormatContext {
>>>   * Contexts and child contexts do not contain a metadata option
>>>   */
>>>  int metafree;
>>> +
>>> +/**
>>> + * options from avformat_open_input
>>> + */
>>> +AVDictionary *options;
>>> } FFFormatContext;
>>> 
>>> static av_always_inline FFFormatContext *ffformatcontext(AVFormatContext *s)
>>> diff --git a/libavformat/mov.c b/libavformat/mov.c
>>> index 29bd3103e3..1e1a7c2f7f 100644
>>> --- a/libavformat/mov.c
>>> +++ b/libavformat/mov.c
>>> @@ -4456,6 +4456,7 @@ static int mov_read_trak(MOVContext *c, AVIOContext 
>>> *pb, MOVAtom atom)
>>> {
>>>  AVStream *st;
>>>  MOVStreamContext *sc;
>>> +URLContext *url_context;
>>>  int ret;
>>> 
>>>  st = avformat_new_stream(c->fc, NULL);
>>> @@ -4501,6 +4502,8 @@ static int mov_read_trak(MOVContext *c, AVIOContext 
>>> *pb, MOVAtom atom)
>>> 
>>>  mov_build_index(c, st);
>>> 
>>> +url_context = ffio_geturlcontext(c->fc->pb);
>>> +av_assert0(url_context);
>>>  if (sc->dref_id-1 < sc->drefs_count && sc->drefs[sc->dref_id-1].path) {
>>>  MOVDref *dref = &sc->drefs[sc->dref_id - 1];
>>>  if (c->enable_drefs) {
>>> @@ -4510,6 +4513,19 @@ static int mov_read_trak(MOVContext *c, AVIOContext 
>>> *pb, MOVAtom atom)
>>> "filename='%s', volume='%s', nlvl_from=%d, 
>>> nlvl_to=%d\n",
>>> st->index, dref->path, dref->dir, dref->filename,
>>> dref->volume, dref->nlvl_from, dref->nlvl_to);
>>> +} else if (strcmp(url_context->prot->name, "http") == 0 ||
>>> +   strcmp(url_context->prot->name, "https") == 0

Re: [FFmpeg-devel] [PATCH] fftools/ffmpeg_ffplay_ffprobe_cmdutils: add -safe to replace the user name and password in the protocol address

2022-12-18 Thread zhilizhao(赵志立)


> On Dec 19, 2022, at 14:50, Wujian(Chin)  wrote:
> 
> 
>>> On Dec 17, 2022, at 15:36, Wujian(Chin)  wrote:
>>> 
>>> The Protocol address may contain the user name and password. The ps -ef 
>>> command may expose the plaintext.
>>> The -safe parameter option is added to replace the user name and password 
>>> in the command line with the asterisk (*).
> 
>> The patch reduced the risk to a low level, but I don’t think it fixed the 
>> security issue totally. It’s still there with a small time window. The 
>> usecase itself is unsafe.
> 
> It's still there with a small time window, too short for people to capture.
> Do you have any other better way, if not, this way prevents 99% of the scenes 
> better than not doing it at all.
> 
> 
>> There is an -safe option in concat demuxer, please make sure there is no 
>> conflict.
>> concat demuxer AVOptions:
>> -safe  .D. enable safe mode (default true)
> 
> There is no conflict because -safe is identified by the second parameter 
> after ffmpeg/ffprobe/ffplay.

Isn’t it break the following use case?

ffmpeg -safe 0 -f concat -i abc -c copy /tmp/test.mp4

> 
> 
>>> Signed-off-by: wujian_nanjing 
>>> ---
>>> doc/ffmpeg.texi|  7 +++
>>> doc/ffplay.texi|  8 
>>> doc/ffprobe.texi   |  7 +++
>>> fftools/cmdutils.c | 47 
>>> +++
>>> fftools/cmdutils.h | 15 +++
>>> fftools/ffmpeg.c   | 16 +---
>>> fftools/ffplay.c   | 15 +--
>>> fftools/ffprobe.c  | 18 ++
>>> 8 files changed, 120 insertions(+), 13 deletions(-)
>>> 
>>> diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 0367930..e905542 
>>> 100644
>>> --- a/doc/ffmpeg.texi
>>> +++ b/doc/ffmpeg.texi
>>> @@ -50,6 +50,13 @@ output files. Also do not mix options which belong 
>>> to different files. All options apply ONLY to the next input or output file 
>>> and are reset between files.
>>> 
>>> @itemize
>>> +@item -safe
>>> +The Protocol address may contain the user name and password. The ps -ef 
>>> command may expose the plaintext.
>>> +The -safe parameter option is added to replace the user name and password 
>>> in the command line with the asterisk (*).
>>> +@example
>>> +ffmpeg -safe -i rtsp://usern...@password..com @end example
>>> +
>>> @item
>>> To set the video bitrate of the output file to 64 kbit/s:
>>> @example
>>> diff --git a/doc/ffplay.texi b/doc/ffplay.texi index 5dd860b..f46ca91 
>>> 100644
>>> --- a/doc/ffplay.texi
>>> +++ b/doc/ffplay.texi
>>> @@ -122,6 +122,14 @@ Read @var{input_url}.
>>> 
>>> @section Advanced options
>>> @table @option
>>> +
>>> +@item -safe
>>> +The Protocol address may contain the user name and password. The ps -ef 
>>> command may expose the plaintext.
>>> +The -safe parameter option is added to replace the user name and password 
>>> in the command line with the asterisk (*).
>>> +@example
>>> +ffplay -safe -i rtsp://usern...@password..com @end example
>>> +
>>> @item -stats
>>> Print several playback statistics, in particular show the stream 
>>> duration, the codec parameters, the current position in the stream and 
>>> diff --git a/doc/ffprobe.texi b/doc/ffprobe.texi index 
>>> 4dc9f57..92b13cf 100644
>>> --- a/doc/ffprobe.texi
>>> +++ b/doc/ffprobe.texi
>>> @@ -89,6 +89,13 @@ Set the output printing format.
>>> @var{writer_name} specifies the name of the writer, and 
>>> @var{writer_options} specifies the options to be passed to the writer.
>>> 
>>> +@item -safe
>>> +The Protocol address may contain the user name and password. The ps -ef 
>>> command may expose the plaintext.
>>> +The -safe parameter option is added to replace the user name and password 
>>> in the command line with the asterisk (*).
>>> +@example
>>> +ffprobe -safe -i rtsp://usern...@password..com @end example
>>> +
>>> For example for printing the output in JSON format, specify:
>>> @example
>>> -print_format json
>>> diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 
>>> a1de621..22407f8 100644
>>> --- a/fftools/cmdutils.c
>>> +++ b/fftools/cmdutils.c
>>> @@ -61,6 +61,40 @@ AVDictionary *format_opts, *codec_opts;
>>> 
>>> int hide_banner = 0;
>>> 
>>> +void param_masking(int argc, char **argv) {
>>> +int i, j;
>>> +for (i = 1; i < argc; i++) {
>>> +char *match = strstr(argv[i], "://");
>>> +if (match) {
>>> +int total = strlen(argv[i]);
>>> +for (j = 0; j < total; j++) {
>>> +argv[i][j] = '*';
>>> +}
>>> +}
>>> +}
>>> +}
>>> +
>>> +char **copy_argv(int argc, char **argv) {
>>> +char **argv2;
>>> +argv2 = av_mallocz(argc * sizeof(char *));
>>> +if (!argv2)
>>> +exit_program(1);
>>> +
>>> +for (int i = 0; i < argc; i++) {
>>> +int length = strlen(argv[i]) + 1;
>>> +argv2[i] = av_mallocz(length * sizeof(char *));
>>> +if (!argv2[i])
>>> +exit_program(1);
>>> +memcpy(argv2[i], argv[i], length 

[FFmpeg-devel] [PATCH v6 0/3] ffmpeg: add video heartbeat capability to fix_sub_duration

2022-12-18 Thread Jan Ekström
Changes from v5:
 - Rebased things on top of current master (option related code moved to
   ffmpeg_mux_init etc).
 - Added notes in the documentation regarding drawbacks of this option and
   that it should not be utilized in cases where latency of when the subtitle
   event is passed on to output is not relevant.

Jan Ekström (3):
  ffmpeg: refactor post-decoding steps for subtitles into a function
  ffmpeg: move decoded frame counter from after post-processing to
decode
  ffmpeg: add video heartbeat capability to fix_sub_duration

 doc/ffmpeg.texi   |  14 ++
 fftools/ffmpeg.c  | 194 +++---
 fftools/ffmpeg.h  |   8 +
 fftools/ffmpeg_mux_init.c |   4 +
 fftools/ffmpeg_opt.c  |   5 +
 tests/fate/ffmpeg.mak |  14 ++
 .../fate/ffmpeg-fix_sub_duration_heartbeat|  48 +
 7 files changed, 264 insertions(+), 23 deletions(-)
 create mode 100644 tests/ref/fate/ffmpeg-fix_sub_duration_heartbeat

-- 
2.38.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH v6 1/3] ffmpeg: refactor post-decoding steps for subtitles into a function

2022-12-18 Thread Jan Ekström
From: Jan Ekström 

This enables us to later call this when generating additional
subtitles for splitting purposes.

Co-authored-by: Andrzej Nadachowski 

Signed-off-by: Jan Ekström 
---
 fftools/ffmpeg.c | 49 +++-
 1 file changed, 28 insertions(+), 21 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 881d6f0af2..eaf0a40328 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2187,27 +2187,15 @@ fail:
 return err < 0 ? err : ret;
 }
 
-static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int 
*got_output,
-   int *decode_failed)
+static int process_subtitle(InputStream *ist, AVSubtitle *subtitle, int 
*got_output)
 {
-AVSubtitle subtitle;
+int ret = 0;
 int free_sub = 1;
-int ret = avcodec_decode_subtitle2(ist->dec_ctx,
-   &subtitle, got_output, pkt);
-
-check_decode_result(NULL, got_output, ret);
-
-if (ret < 0 || !*got_output) {
-*decode_failed = 1;
-if (!pkt->size)
-sub2video_flush(ist);
-return ret;
-}
 
 if (ist->fix_sub_duration) {
 int end = 1;
 if (ist->prev_sub.got_output) {
-end = av_rescale(subtitle.pts - ist->prev_sub.subtitle.pts,
+end = av_rescale(subtitle->pts - ist->prev_sub.subtitle.pts,
  1000, AV_TIME_BASE);
 if (end < ist->prev_sub.subtitle.end_display_time) {
 av_log(NULL, AV_LOG_DEBUG,
@@ -2219,7 +2207,7 @@ static int transcode_subtitles(InputStream *ist, AVPacket 
*pkt, int *got_output,
 }
 FFSWAP(int,*got_output, ist->prev_sub.got_output);
 FFSWAP(int,ret, ist->prev_sub.ret);
-FFSWAP(AVSubtitle, subtitle,ist->prev_sub.subtitle);
+FFSWAP(AVSubtitle, *subtitle,   ist->prev_sub.subtitle);
 if (end <= 0)
 goto out;
 }
@@ -2228,20 +2216,20 @@ static int transcode_subtitles(InputStream *ist, 
AVPacket *pkt, int *got_output,
 return ret;
 
 if (ist->sub2video.frame) {
-sub2video_update(ist, INT64_MIN, &subtitle);
+sub2video_update(ist, INT64_MIN, subtitle);
 } else if (ist->nb_filters) {
 if (!ist->sub2video.sub_queue)
 ist->sub2video.sub_queue = av_fifo_alloc2(8, sizeof(AVSubtitle), 
AV_FIFO_FLAG_AUTO_GROW);
 if (!ist->sub2video.sub_queue)
 report_and_exit(AVERROR(ENOMEM));
 
-ret = av_fifo_write(ist->sub2video.sub_queue, &subtitle, 1);
+ret = av_fifo_write(ist->sub2video.sub_queue, subtitle, 1);
 if (ret < 0)
 exit_program(1);
 free_sub = 0;
 }
 
-if (!subtitle.num_rects)
+if (!subtitle->num_rects)
 goto out;
 
 ist->frames_decoded++;
@@ -2251,15 +2239,34 @@ static int transcode_subtitles(InputStream *ist, 
AVPacket *pkt, int *got_output,
 || ost->enc_ctx->codec_type != AVMEDIA_TYPE_SUBTITLE)
 continue;
 
-do_subtitle_out(output_files[ost->file_index], ost, &subtitle);
+do_subtitle_out(output_files[ost->file_index], ost, subtitle);
 }
 
 out:
 if (free_sub)
-avsubtitle_free(&subtitle);
+avsubtitle_free(subtitle);
 return ret;
 }
 
+static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int 
*got_output,
+   int *decode_failed)
+{
+AVSubtitle subtitle;
+int ret = avcodec_decode_subtitle2(ist->dec_ctx,
+   &subtitle, got_output, pkt);
+
+check_decode_result(NULL, got_output, ret);
+
+if (ret < 0 || !*got_output) {
+*decode_failed = 1;
+if (!pkt->size)
+sub2video_flush(ist);
+return ret;
+}
+
+return process_subtitle(ist, &subtitle, got_output);
+}
+
 static int send_filter_eof(InputStream *ist)
 {
 int i, ret;
-- 
2.38.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH v6 2/3] ffmpeg: move decoded frame counter from after post-processing to decode

2022-12-18 Thread Jan Ekström
From: Jan Ekström 

This way we can call process_subtitles without causing the decoded
frame counter to get bumped.

Additionally, this now takes into mention all of the decoded
subtitle frames without fix_sub_duration latency/buffering, or filtering
out decoded reset/end subtitles without any rendered rectangles, which
matches the original intent in 4754345027eb85cfa51aeb88beec68d7b036c11e
.

Signed-off-by: Jan Ekström 
---
 fftools/ffmpeg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index eaf0a40328..3b94eaaa58 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2232,8 +2232,6 @@ static int process_subtitle(InputStream *ist, AVSubtitle 
*subtitle, int *got_out
 if (!subtitle->num_rects)
 goto out;
 
-ist->frames_decoded++;
-
 for (OutputStream *ost = ost_iter(NULL); ost; ost = ost_iter(ost)) {
 if (!check_output_constraints(ist, ost) || !ost->enc_ctx
 || ost->enc_ctx->codec_type != AVMEDIA_TYPE_SUBTITLE)
@@ -2264,6 +2262,8 @@ static int transcode_subtitles(InputStream *ist, AVPacket 
*pkt, int *got_output,
 return ret;
 }
 
+ist->frames_decoded++;
+
 return process_subtitle(ist, &subtitle, got_output);
 }
 
-- 
2.38.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH v6 3/3] ffmpeg: add video heartbeat capability to fix_sub_duration

2022-12-18 Thread Jan Ekström
From: Jan Ekström 

Splits the currently handled subtitle at random access point
packets that can be configured to follow a specific output stream.

This way the subtitle - which is known to be shown at this time
can be split and passed to muxer before its full duration is
yet known. This is also a drawback, as this essentially outputs
multiple subtitles from a single input subtitle that continues
over multiple random access points. Thus this feature should not
be utilized in cases where subtitle output latency does not matter.

Co-authored-by: Andrzej Nadachowski 
Co-authored-by: Bernard Boulay 

Signed-off-by: Jan Ekström 
---
 doc/ffmpeg.texi   |  14 ++
 fftools/ffmpeg.c  | 141 ++
 fftools/ffmpeg.h  |   8 +
 fftools/ffmpeg_mux_init.c |   4 +
 fftools/ffmpeg_opt.c  |   5 +
 tests/fate/ffmpeg.mak |  14 ++
 .../fate/ffmpeg-fix_sub_duration_heartbeat|  48 ++
 7 files changed, 234 insertions(+)
 create mode 100644 tests/ref/fate/ffmpeg-fix_sub_duration_heartbeat

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 0367930a3b..d5f231e635 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -1339,6 +1339,20 @@ List all hardware acceleration components enabled in 
this build of ffmpeg.
 Actual runtime availability depends on the hardware and its suitable driver
 being installed.
 
+@item -fix_sub_duration_heartbeat[:@var{stream_specifier}]
+Set a specific output video stream as the heartbeat stream according to which
+to split and push through currently in-progress subtitle upon receipt of a
+random access packet.
+
+This lowers the latency of subtitles for which the end packet or the following
+subtitle has not yet been received. As a drawback, this will most likely lead
+to duplication of subtitle events in order to cover the full duration, so
+when dealing with use cases where latency of when the subtitle event is passed
+on to output is not relevant this option should not be utilized.
+
+Requires @option{-fix_sub_duration} to be set for the relevant input subtitle
+stream for this to have any effect.
+
 @end table
 
 @section Audio Options
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 3b94eaaa58..1fde4bf0f5 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -119,6 +119,7 @@ typedef struct BenchmarkTimeStamps {
 int64_t sys_usec;
 } BenchmarkTimeStamps;
 
+static int trigger_fix_sub_duration_heartbeat(OutputStream *ost, const 
AVPacket *pkt);
 static BenchmarkTimeStamps get_benchmark_time_stamps(void);
 static int64_t getmaxrss(void);
 static int ifilter_has_all_input_formats(FilterGraph *fg);
@@ -870,6 +871,13 @@ static int encode_frame(OutputFile *of, OutputStream *ost, 
AVFrame *frame)
av_ts2str(pkt->duration), av_ts2timestr(pkt->duration, 
&enc->time_base));
 }
 
+if ((ret = trigger_fix_sub_duration_heartbeat(ost, pkt)) < 0) {
+av_log(NULL, AV_LOG_ERROR,
+   "Subtitle heartbeat logic failed in %s! (%s)\n",
+   __func__, av_err2str(ret));
+exit_program(1);
+}
+
 ost->data_size_enc += pkt->size;
 
 if (enc->codec_type == AVMEDIA_TYPE_VIDEO)
@@ -1817,6 +1825,16 @@ static void do_streamcopy(InputStream *ist, OutputStream 
*ost, const AVPacket *p
 
 opkt->duration = av_rescale_q(pkt->duration, ist->st->time_base, 
ost->mux_timebase);
 
+{
+int ret = trigger_fix_sub_duration_heartbeat(ost, pkt);
+if (ret < 0) {
+av_log(NULL, AV_LOG_ERROR,
+   "Subtitle heartbeat logic failed in %s! (%s)\n",
+   __func__, av_err2str(ret));
+exit_program(1);
+}
+}
+
 of_output_packet(of, opkt, ost, 0);
 
 ost->streamcopy_started = 1;
@@ -2246,6 +2264,129 @@ out:
 return ret;
 }
 
+static int copy_av_subtitle(AVSubtitle *dst, AVSubtitle *src)
+{
+int ret = AVERROR_BUG;
+AVSubtitle tmp = {
+.format = src->format,
+.start_display_time = src->start_display_time,
+.end_display_time = src->end_display_time,
+.num_rects = 0,
+.rects = NULL,
+.pts = src->pts
+};
+
+if (!src->num_rects)
+goto success;
+
+if (!(tmp.rects = av_calloc(src->num_rects, sizeof(*tmp.rects
+return AVERROR(ENOMEM);
+
+for (int i = 0; i < src->num_rects; i++) {
+AVSubtitleRect *src_rect = src->rects[i];
+AVSubtitleRect *dst_rect;
+
+if (!(dst_rect = tmp.rects[i] = av_mallocz(sizeof(*tmp.rects[0] {
+ret = AVERROR(ENOMEM);
+goto cleanup;
+}
+
+tmp.num_rects++;
+
+dst_rect->type  = src_rect->type;
+dst_rect->flags = src_rect->flags;
+
+dst_rect->x = src_rect->x;
+dst_rect->y = src_rect->y;
+dst_rect->w = src_rect->w;
+dst_r

Re: [FFmpeg-devel] [PATCH] avformat/mov: fix buffering issue on playing HTTP(s)/mp4.

2022-12-18 Thread Chen, Jinkai
Thanks for your reply, and I found the some wrong in the code. Drop this patch.

2022年12月19日 下午3:14,zhilizhao(赵志立) 
mailto:quinkbl...@foxmail.com>> 写道:

[你通常不会收到来自 quinkbl...@foxmail.com 的电子邮件。请访问 
https://aka.ms/LearnAboutSenderIdentification,以了解这一点为什么很重要]

On Dec 19, 2022, at 15:04, Chen, Jinkai 
mailto:chenjin...@agora.io>> wrote:

So. I apply this strategy when it’s on HTTP/HTTPs, and it’s not affect local 
normal files.

Could you please show me a bad case on this solution ? I appreciated and try to 
fix it. Thanks.

It will download the same file twice.


2022年12月19日 下午2:18,zhilizhao(赵志立) 
mailto:quinkbl...@foxmail.com>> 写道:

[你通常不会收到来自 quinkbl...@foxmail.com 的电子邮件。请访问 
https://aka.ms/LearnAboutSenderIdentification,以了解这一点为什么很重要]

On Dec 19, 2022, at 12:24, Chen, Jinkai 
mailto:chenjin...@agora.io>> wrote:

Using separated HTTP connection for each stream,
prevent from reading audio and video in long distance,
which cause seeking(http request) repeatedly.
Storing the user options when open input,
and make sure that can be passed to demuxer context.

The patch is harmful for normal files, and the implementation isn’t clean, so 
NAK.


Some source can reproducing the issue:
https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fali-sprite-video.yyouwang.com%2Fvideo%2Fworks%2F202211%2F1667997073624_73.mp4&data=05%7C01%7Cchenjinkai%40agora.io%7Cd59e763bc99c41524b4208dae190a5e3%7C602753743eaa49c283c3cc189d126981%7C0%7C0%7C638070308656480057%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=MBRf%2F%2BSsKXMr7oAPZfp0MGIjTCh4kRvgK974xW6KKfI%3D&reserved=0
https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fimages.voghion.com%2FproductImages%2F04_01_C_30011_2020220106GiuseppeFanara0012.mp4&data=05%7C01%7Cchenjinkai%40agora.io%7Cd59e763bc99c41524b4208dae190a5e3%7C602753743eaa49c283c3cc189d126981%7C0%7C0%7C638070308656480057%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=WFqLW4s7bBWYoL7VXyZVGoFKJlZbjUvF81rgefM2Pj8%3D&reserved=0

Signed-off-by: CJK 
mailto:chenjin...@agora.io>>
---
libavformat/avformat.c |  1 +
libavformat/demux.c|  5 -
libavformat/internal.h |  5 +
libavformat/mov.c  | 16 
4 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/libavformat/avformat.c b/libavformat/avformat.c
index 19c7219471..4453727f34 100644
--- a/libavformat/avformat.c
+++ b/libavformat/avformat.c
@@ -129,6 +129,7 @@ void avformat_free_context(AVFormatContext *s)
av_freep(&s->chapters);
av_dict_free(&s->metadata);
av_dict_free(&si->id3v2_meta);
+av_dict_free(&si->options);
av_packet_free(&si->pkt);
av_packet_free(&si->parse_pkt);
av_freep(&s->streams);
diff --git a/libavformat/demux.c b/libavformat/demux.c
index 2dfd82a63c..2377bfdab0 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -237,8 +237,11 @@ int avformat_open_input(AVFormatContext **ps, const char 
*filename,
if (fmt)
s->iformat = fmt;

-if (options)
+if (options) {
av_dict_copy(&tmp, *options, 0);
+si->options = NULL;
+av_dict_copy(&si->options, *options, 0);
+}

if (s->pb) // must be before any goto fail
s->flags |= AVFMT_FLAG_CUSTOM_IO;
diff --git a/libavformat/internal.h b/libavformat/internal.h
index ce837fefc7..7caae8b93e 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -186,6 +186,11 @@ typedef struct FFFormatContext {
 * Contexts and child contexts do not contain a metadata option
 */
int metafree;
+
+/**
+ * options from avformat_open_input
+ */
+AVDictionary *options;
} FFFormatContext;

static av_always_inline FFFormatContext *ffformatcontext(AVFormatContext *s)
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 29bd3103e3..1e1a7c2f7f 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4456,6 +4456,7 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
{
AVStream *st;
MOVStreamContext *sc;
+URLContext *url_context;
int ret;

st = avformat_new_stream(c->fc, NULL);
@@ -4501,6 +4502,8 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)

mov_build_index(c, st);

+url_context = ffio_geturlcontext(c->fc->pb);
+av_assert0(url_context);
if (sc->dref_id-1 < sc->drefs_count && sc->drefs[sc->dref_id-1].path) {
MOVDref *dref = &sc->drefs[sc->dref_id - 1];
if (c->enable_drefs) {
@@ -4510,6 +4513,19 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
   "filename='%s', volume='%s', nlvl_from=%d, nlvl_to=%d\n",
   st->index, dref->path, dref->dir, dref->filename,
   dref->volume, dref->nlvl_from, dref->nlvl_to);
+} else if (strcmp(url_context->prot->name, "http") == 0 ||
+   strcmp(url_context->prot->name, "https") == 0) {
+