Re: [FFmpeg-devel] [PATCH] libavcodec/qsvenc.c: Set height and width alignment when using mjpeg_qsv

2020-01-21 Thread Jon Cook
Giving up on how to update the patch. Going to delete this ticket and
create a new one!

Jon

On Tue, 21 Jan 2020 at 12:30, Jon Cook  wrote:

> Updated patch with FrameInfo.Width and Height set as per review comments
>
> Jon
>
> On Tue, 21 Jan 2020 at 11:47, Jon Cook  wrote:
>
>> Hi Zhong,
>>
>> Thanks for your reply.
>>
>> > IMHO If you set the aligned value, FrameInfo.Width/Height shoule
>> > be changed to be:
>> >
>> >q->param.mfx.FrameInfo.Width  = FFALIGN(avctx->width,
>> q->width_align);
>> >q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height,
>> q->height_align);
>>
>> Makes sense. I'll update the patch. This is my first time making changes
>> to the code so forgive any mistakes as I find my way around.
>>
>> > Could you help to provide detail steps (CLI and input video) to
>> > reproduce the issue?
>>
>> The command line I'm using is below along with the output without the
>> changes applied. Input video is not important, any video will do. There is
>> a little bit more about the problem here
>> http://ffmpeg.org/pipermail/ffmpeg-user/2019-November/046143.html
>>
>> Regards,
>> Jon
>>
>> $ ./ffmpeg.exe -loglevel debug -y -i C:/Users/jcook/Desktop/sample.avi
>> -c:v  mjpeg_qsv output.mp4
>> ffmpeg version N-95883-ga2fbdc6898 Copyright (c) 2000-2019 the FFmpeg
>> developers
>>   built with Microsoft (R) C/C++ Optimizing Compiler Version
>> 19.16.27031.1 for x64
>>   configuration: --toolchain=msvc --target-os=win64 --arch=x86_64
>> --prefix=/ffmpeg --enable-shared --disable-static --enable-yasm
>> --enable-asm --enable-libmfx --enable-nonfree
>>   libavutil  56. 36.101 / 56. 36.101
>>   libavcodec 58. 62.100 / 58. 62.100
>>   libavformat58. 35.100 / 58. 35.100
>>   libavdevice58.  9.101 / 58.  9.101
>>   libavfilter 7. 67.100 /  7. 67.100
>>   libswscale  5.  6.100 /  5.  6.100
>>   libswresample   3.  6.100 /  3.  6.100
>> Splitting the commandline.
>> Reading option '-loglevel' ... matched as option 'loglevel' (set logging
>> level) with argument 'debug'.
>> Reading option '-y' ... matched as option 'y' (overwrite output files)
>> with argument '1'.
>> Reading option '-i' ... matched as input url with argument
>> 'C:/Users/jcook/Desktop/sample.avi'.
>> Reading option '-c:v' ... matched as option 'c' (codec name) with
>> argument 'mjpeg_qsv'.
>> Reading option 'output.mp4' ... matched as output url.
>> Finished splitting the commandline.
>> Parsing a group of options: global .
>> Applying option loglevel (set logging level) with argument debug.
>> Applying option y (overwrite output files) with argument 1.
>> Successfully parsed a group of options.
>> Parsing a group of options: input url C:/Users/jcook/Desktop/sample.avi.
>> Successfully parsed a group of options.
>> Opening an input file: C:/Users/jcook/Desktop/sample.avi.
>> [NULL @ 01E0699F8540] Opening 'C:/Users/jcook/Desktop/sample.avi' for
>> reading
>> [file @ 01E0699D8280] Setting default whitelist 'file,crypto'
>> [avi @ 01E0699F8540] Format avi probed with size=2048 and score=100
>> [avi @ 01E0699D86C0] use odml:1
>> st:1 removing common factor 36 from timebase
>> [avi @ 01E0699F8540] Before avformat_find_stream_info() pos: 4108
>> bytes read:142280 seeks:5 nb_streams:2
>> [mpeg4 @ 01E069A0AE00] Format yuv420p chosen by get_format().
>> [avi @ 01E0699F8540] All info found
>> [avi @ 01E0699F8540] After avformat_find_stream_info() pos: 16409
>> bytes read:142280 seeks:5 frames:21
>> Input #0, avi, from 'C:/Users/jcook/Desktop/sample.avi':
>>   Metadata:
>> encoder : MEncoder SVN-r33148-4.0.1
>>   Duration: 00:00:05.56, start: 0.00, bitrate: 540 kb/s
>> Stream #0:0, 1, 1/25: Video: mpeg4 (Simple Profile), 1 reference
>> frame (XVID / 0x44495658), yuv420p(left), 320x240 [SAR 1:1 DAR 4:3], 0/1,
>> 425 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
>> Stream #0:1, 20, 32/1225: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz,
>> stereo, fltp, 100 kb/s
>> Successfully opened the file.
>> Parsing a group of options: output url output.mp4.
>> Applying option c:v (codec name) with argument mjpeg_qsv.
>> Successfully parsed a group of options.
>> Opening an output file: output.mp4.
>> [file @ 01E06B51B9C0] Setting default whitelist 'file,crypto'
>> Successfully opened the file.
>> detected 12 logical cores
>> Stream mapping:
>>   Stream #0:0 -> #0:0 (mpeg4 (native) -> mjpeg (mjpeg_qsv))
>>   Stream #0:1 -> #0:1 (mp3 (mp3float) -> aac (native))
>> Press [q] to stop, [?] for help
>> cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless
>> if it occurs once at the start per stream)
>> [graph_1_in_0_1 @ 01E069A12A40] Setting 'time_base' to value '1/44100'
>> [graph_1_in_0_1 @ 01E069A12A40] Setting 'sample_rate' to value '44100'
>> [graph_1_in_0_1 @ 01E069A12A40] Setting 'sample_fmt' to value 'fltp'
>> [graph_1_in_0_1 @ 01E069A12A40] Setting 'channel_layout' to value
>> '0x3'
>> [graph_1_in_0_1 @ 01E069A12A40] tb:1/44100 samplefmt:fltp
>> 

Re: [FFmpeg-devel] [PATCH] libavcodec/qsvenc.c: Set height and width alignment when using mjpeg_qsv

2020-01-21 Thread Jon Cook
Updated patch with FrameInfo.Width and Height set as per review comments

Jon

On Tue, 21 Jan 2020 at 11:47, Jon Cook  wrote:

> Hi Zhong,
>
> Thanks for your reply.
>
> > IMHO If you set the aligned value, FrameInfo.Width/Height shoule
> > be changed to be:
> >
> >q->param.mfx.FrameInfo.Width  = FFALIGN(avctx->width, q->width_align);
> >q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height,
> q->height_align);
>
> Makes sense. I'll update the patch. This is my first time making changes
> to the code so forgive any mistakes as I find my way around.
>
> > Could you help to provide detail steps (CLI and input video) to
> > reproduce the issue?
>
> The command line I'm using is below along with the output without the
> changes applied. Input video is not important, any video will do. There is
> a little bit more about the problem here
> http://ffmpeg.org/pipermail/ffmpeg-user/2019-November/046143.html
>
> Regards,
> Jon
>
> $ ./ffmpeg.exe -loglevel debug -y -i C:/Users/jcook/Desktop/sample.avi
> -c:v  mjpeg_qsv output.mp4
> ffmpeg version N-95883-ga2fbdc6898 Copyright (c) 2000-2019 the FFmpeg
> developers
>   built with Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27031.1
> for x64
>   configuration: --toolchain=msvc --target-os=win64 --arch=x86_64
> --prefix=/ffmpeg --enable-shared --disable-static --enable-yasm
> --enable-asm --enable-libmfx --enable-nonfree
>   libavutil  56. 36.101 / 56. 36.101
>   libavcodec 58. 62.100 / 58. 62.100
>   libavformat58. 35.100 / 58. 35.100
>   libavdevice58.  9.101 / 58.  9.101
>   libavfilter 7. 67.100 /  7. 67.100
>   libswscale  5.  6.100 /  5.  6.100
>   libswresample   3.  6.100 /  3.  6.100
> Splitting the commandline.
> Reading option '-loglevel' ... matched as option 'loglevel' (set logging
> level) with argument 'debug'.
> Reading option '-y' ... matched as option 'y' (overwrite output files)
> with argument '1'.
> Reading option '-i' ... matched as input url with argument
> 'C:/Users/jcook/Desktop/sample.avi'.
> Reading option '-c:v' ... matched as option 'c' (codec name) with argument
> 'mjpeg_qsv'.
> Reading option 'output.mp4' ... matched as output url.
> Finished splitting the commandline.
> Parsing a group of options: global .
> Applying option loglevel (set logging level) with argument debug.
> Applying option y (overwrite output files) with argument 1.
> Successfully parsed a group of options.
> Parsing a group of options: input url C:/Users/jcook/Desktop/sample.avi.
> Successfully parsed a group of options.
> Opening an input file: C:/Users/jcook/Desktop/sample.avi.
> [NULL @ 01E0699F8540] Opening 'C:/Users/jcook/Desktop/sample.avi' for
> reading
> [file @ 01E0699D8280] Setting default whitelist 'file,crypto'
> [avi @ 01E0699F8540] Format avi probed with size=2048 and score=100
> [avi @ 01E0699D86C0] use odml:1
> st:1 removing common factor 36 from timebase
> [avi @ 01E0699F8540] Before avformat_find_stream_info() pos: 4108
> bytes read:142280 seeks:5 nb_streams:2
> [mpeg4 @ 01E069A0AE00] Format yuv420p chosen by get_format().
> [avi @ 01E0699F8540] All info found
> [avi @ 01E0699F8540] After avformat_find_stream_info() pos: 16409
> bytes read:142280 seeks:5 frames:21
> Input #0, avi, from 'C:/Users/jcook/Desktop/sample.avi':
>   Metadata:
> encoder : MEncoder SVN-r33148-4.0.1
>   Duration: 00:00:05.56, start: 0.00, bitrate: 540 kb/s
> Stream #0:0, 1, 1/25: Video: mpeg4 (Simple Profile), 1 reference frame
> (XVID / 0x44495658), yuv420p(left), 320x240 [SAR 1:1 DAR 4:3], 0/1, 425
> kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
> Stream #0:1, 20, 32/1225: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz,
> stereo, fltp, 100 kb/s
> Successfully opened the file.
> Parsing a group of options: output url output.mp4.
> Applying option c:v (codec name) with argument mjpeg_qsv.
> Successfully parsed a group of options.
> Opening an output file: output.mp4.
> [file @ 01E06B51B9C0] Setting default whitelist 'file,crypto'
> Successfully opened the file.
> detected 12 logical cores
> Stream mapping:
>   Stream #0:0 -> #0:0 (mpeg4 (native) -> mjpeg (mjpeg_qsv))
>   Stream #0:1 -> #0:1 (mp3 (mp3float) -> aac (native))
> Press [q] to stop, [?] for help
> cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless
> if it occurs once at the start per stream)
> [graph_1_in_0_1 @ 01E069A12A40] Setting 'time_base' to value '1/44100'
> [graph_1_in_0_1 @ 01E069A12A40] Setting 'sample_rate' to value '44100'
> [graph_1_in_0_1 @ 01E069A12A40] Setting 'sample_fmt' to value 'fltp'
> [graph_1_in_0_1 @ 01E069A12A40] Setting 'channel_layout' to value '0x3'
> [graph_1_in_0_1 @ 01E069A12A40] tb:1/44100 samplefmt:fltp
> samplerate:44100 chlayout:0x3
> [format_out_0_1 @ 01E069A2F800] Setting 'sample_fmts' to value 'fltp'
> [format_out_0_1 @ 01E069A2F800] Setting 'sample_rates' to value
> '96000|88200|64000|48000|44100|32000|24000|22050|16000|12000|11025|8000|7350'

[FFmpeg-devel] [PATCH] libavcodec/qsvenc.c: Set height and width alignment when using mjpeg_qsv

2020-01-21 Thread Jon Cook
From: JonCookCubic 

Setting FrameInfo.Width and Height as per review comments

Signed-off-by: JonCookCubic 
---
 libavcodec/qsvenc.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 9e416500e9..40904af388 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -470,6 +470,12 @@ static int init_video_param_jpeg(AVCodecContext *avctx, 
QSVEncContext *q)
 q->param.mfx.Quality  = av_clip(avctx->global_quality, 1, 100);
 q->param.mfx.RestartInterval  = 0;
 
+q->width_align = 16;
+q->height_align = 16;
+
+q->param.mfx.FrameInfo.Width = FFALIGN(avctx->width, q->width_align);
+q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height, q->height_align);
+
 return 0;
 }
 
-- 
2.20.1.windows.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] libavcodec/qsvenc.c: Set height and width alignment when using mjpeg_qsv

2020-01-21 Thread Jon Cook
Hi Zhong,

Thanks for your reply.

> IMHO If you set the aligned value, FrameInfo.Width/Height shoule
> be changed to be:
>
>q->param.mfx.FrameInfo.Width  = FFALIGN(avctx->width, q->width_align);
>q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height,
q->height_align);

Makes sense. I'll update the patch. This is my first time making changes to
the code so forgive any mistakes as I find my way around.

> Could you help to provide detail steps (CLI and input video) to
> reproduce the issue?

The command line I'm using is below along with the output without the
changes applied. Input video is not important, any video will do. There is
a little bit more about the problem here
http://ffmpeg.org/pipermail/ffmpeg-user/2019-November/046143.html

Regards,
Jon

$ ./ffmpeg.exe -loglevel debug -y -i C:/Users/jcook/Desktop/sample.avi -c:v
 mjpeg_qsv output.mp4
ffmpeg version N-95883-ga2fbdc6898 Copyright (c) 2000-2019 the FFmpeg
developers
  built with Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27031.1
for x64
  configuration: --toolchain=msvc --target-os=win64 --arch=x86_64
--prefix=/ffmpeg --enable-shared --disable-static --enable-yasm
--enable-asm --enable-libmfx --enable-nonfree
  libavutil  56. 36.101 / 56. 36.101
  libavcodec 58. 62.100 / 58. 62.100
  libavformat58. 35.100 / 58. 35.100
  libavdevice58.  9.101 / 58.  9.101
  libavfilter 7. 67.100 /  7. 67.100
  libswscale  5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging
level) with argument 'debug'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with
argument '1'.
Reading option '-i' ... matched as input url with argument
'C:/Users/jcook/Desktop/sample.avi'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument '
mjpeg_qsv'.
Reading option 'output.mp4' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url C:/Users/jcook/Desktop/sample.avi.
Successfully parsed a group of options.
Opening an input file: C:/Users/jcook/Desktop/sample.avi.
[NULL @ 01E0699F8540] Opening 'C:/Users/jcook/Desktop/sample.avi' for
reading
[file @ 01E0699D8280] Setting default whitelist 'file,crypto'
[avi @ 01E0699F8540] Format avi probed with size=2048 and score=100
[avi @ 01E0699D86C0] use odml:1
st:1 removing common factor 36 from timebase
[avi @ 01E0699F8540] Before avformat_find_stream_info() pos: 4108 bytes
read:142280 seeks:5 nb_streams:2
[mpeg4 @ 01E069A0AE00] Format yuv420p chosen by get_format().
[avi @ 01E0699F8540] All info found
[avi @ 01E0699F8540] After avformat_find_stream_info() pos: 16409 bytes
read:142280 seeks:5 frames:21
Input #0, avi, from 'C:/Users/jcook/Desktop/sample.avi':
  Metadata:
encoder : MEncoder SVN-r33148-4.0.1
  Duration: 00:00:05.56, start: 0.00, bitrate: 540 kb/s
Stream #0:0, 1, 1/25: Video: mpeg4 (Simple Profile), 1 reference frame
(XVID / 0x44495658), yuv420p(left), 320x240 [SAR 1:1 DAR 4:3], 0/1, 425
kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream #0:1, 20, 32/1225: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz,
stereo, fltp, 100 kb/s
Successfully opened the file.
Parsing a group of options: output url output.mp4.
Applying option c:v (codec name) with argument mjpeg_qsv.
Successfully parsed a group of options.
Opening an output file: output.mp4.
[file @ 01E06B51B9C0] Setting default whitelist 'file,crypto'
Successfully opened the file.
detected 12 logical cores
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg4 (native) -> mjpeg (mjpeg_qsv))
  Stream #0:1 -> #0:1 (mp3 (mp3float) -> aac (native))
Press [q] to stop, [?] for help
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if
it occurs once at the start per stream)
[graph_1_in_0_1 @ 01E069A12A40] Setting 'time_base' to value '1/44100'
[graph_1_in_0_1 @ 01E069A12A40] Setting 'sample_rate' to value '44100'
[graph_1_in_0_1 @ 01E069A12A40] Setting 'sample_fmt' to value 'fltp'
[graph_1_in_0_1 @ 01E069A12A40] Setting 'channel_layout' to value '0x3'
[graph_1_in_0_1 @ 01E069A12A40] tb:1/44100 samplefmt:fltp
samplerate:44100 chlayout:0x3
[format_out_0_1 @ 01E069A2F800] Setting 'sample_fmts' to value 'fltp'
[format_out_0_1 @ 01E069A2F800] Setting 'sample_rates' to value
'96000|88200|64000|48000|44100|32000|24000|22050|16000|12000|11025|8000|7350'
[AVFilterGraph @ 01E069AA7100] query_formats: 4 queried, 9 merged, 0
already done, 0 delayed
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if
it occurs once at the start per stream)
Last message repeated 20 times
[mpeg4 @ 01E069A2EE00] Format yuv420p chosen by get_format().
cur_dts is 

Re: [FFmpeg-devel] [PATCH] libavcodec/qsvenc.c: Set height and width alignment when using mjpeg_qsv

2020-01-20 Thread Zhong Li
Jon Cook  于2020年1月20日周一 下午5:58写道:
>
> From: JonCookCubic 
>
> Currently width_align and height_align are zero which cases "Error submitting 
> the frame for encoding". This change sets the alignments.

Could you help to provide detail steps (CLI and input video) to
reproduce the issue?

>
> Signed-off-by: Jon Cook 
> ---
>  libavcodec/qsvenc.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> index 9e416500e9..b18393532f 100644
> --- a/libavcodec/qsvenc.c
> +++ b/libavcodec/qsvenc.c
> @@ -470,6 +470,9 @@ static int init_video_param_jpeg(AVCodecContext *avctx, 
> QSVEncContext *q)
>  q->param.mfx.Quality  = av_clip(avctx->global_quality, 1, 
> 100);
>  q->param.mfx.RestartInterval  = 0;
>
> +q->width_align = 16;
> +q->height_align = 16;
> +

IMHO If you set the aligned value, FrameInfo.Width/Height shoule be
changed to be:

q->param.mfx.FrameInfo.Width  = FFALIGN(avctx->width, q->width_align);
q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height, q->height_align);

>  return 0;
>  }
>
> --
> 2.20.1.windows.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] libavcodec/qsvenc.c: Set height and width alignment when using mjpeg_qsv

2020-01-20 Thread Jon Cook
From: JonCookCubic 

Currently width_align and height_align are zero which cases "Error submitting 
the frame for encoding". This change sets the alignments.

Signed-off-by: Jon Cook 
---
 libavcodec/qsvenc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 9e416500e9..b18393532f 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -470,6 +470,9 @@ static int init_video_param_jpeg(AVCodecContext *avctx, 
QSVEncContext *q)
 q->param.mfx.Quality  = av_clip(avctx->global_quality, 1, 100);
 q->param.mfx.RestartInterval  = 0;
 
+q->width_align = 16;
+q->height_align = 16;
+
 return 0;
 }
 
-- 
2.20.1.windows.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] libavcodec/qsvenc.c: Set height and width alignment when using mjpeg_qsv

2020-01-20 Thread Jon Cook
From: JonCookCubic 

Currently width_align and height_align are zero which cases "Error submitting 
the frame for encoding". This change sets the alignments.

Signed-off-by: Jon Cook 
---
 libavcodec/qsvenc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 9e416500e9..b18393532f 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -470,6 +470,9 @@ static int init_video_param_jpeg(AVCodecContext *avctx, 
QSVEncContext *q)
 q->param.mfx.Quality  = av_clip(avctx->global_quality, 1, 100);
 q->param.mfx.RestartInterval  = 0;
 
+q->width_align = 16;
+q->height_align = 16;
+
 return 0;
 }
 
-- 
2.20.1.windows.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".