Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.
3058 Discussions

media SDK sample_encode with JPEG, image height is halved

yu__leon
Beginner
1,053 Views

hi there

i am trying sample_encode program in the media SDK  to convert NV12 file to JPEG.  However the output jpeg height is halved. the original image resolution is 1920 x 1080, and the output jpeg exif info  shows resolution 1920 x 540.    In comparision, for the same nv12 input file, ffmpeg converts it properly. 

any advice is appreciated.  thank you. 

attached files: 

1.  image input file:  test-nv12.yuv,  which is generated by ffmpeg from a JPEG image.   the image resolution is 1920 x 1080. 

2.  sample_encode output file:  sample_encode_output.jpg.  the image height is reduced by 50%. 

the file info property of sample_encode_output.jpg  shows that the resolution is 1920 x 540. 

3. ffmpeg convert nv12 to jpeg  output file:  test-ffmpeg.jpg .   this file has no visual difference from the nv12 input. 

media SDK command used : 

.\sample_encode.exe jpeg -q 100 -i .\test-nv12.yuv -o output.jpg -w 1920 -h 1080 -sw -tff -nv12


Encoding Sample Version 8.3.26.0

Input file format       NV12
Output video            JPEG
Source picture:
        Resolution      1920x1088
        Crop X,Y,W,H    0,0,1920,1080
Destination picture:
        Resolution      1920x1088
        Crop X,Y,W,H    0,0,1920,1080
Frame rate      30.00
Bit rate(Kbps)  0
Gop size        100
Ref dist        0
Ref number      0
Idr Interval    0
Target usage    quality
Memory type     system
Media SDK impl          sw
Media SDK version       1.26

Processing started
Frame number: 1
Encoding fps: 377

0 Kudos
4 Replies
yu__leon
Beginner
1,053 Views

SDK config dump

Configuration settings (fields from API 1.27)
*** Encoder ***
AllocId:0
reserved:0 0 
reserved3:0
AsyncDepth:4
mfx.reserved:0 0 0 0 0 0 0 
mfx.LowPower:0
mfx.BRCParamMultiplier:0
mfx.FrameInfo.reserved:0 0 0 0 
mfx.FrameInfo.reserved4:0
mfx.FrameInfo.BitDepthLuma:0
mfx.FrameInfo.BitDepthChroma:0
mfx.FrameInfo.Shift:0
mfx.FrameInfo.FrameId.TemporalId:0
mfx.FrameInfo.FrameId.PriorityId:0
mfx.FrameInfo.FrameId.DependencyId:0
mfx.FrameInfo.FrameId.QualityId:0
mfx.FrameInfo.FrameId.ViewId:0
mfx.FrameInfo.FourCC:842094158
mfx.FrameInfo.FourCC(string):NV12
mfx.FrameInfo.Width:1920
mfx.FrameInfo.Height:1088
mfx.FrameInfo.CropX:0
mfx.FrameInfo.CropY:0
mfx.FrameInfo.CropW:1920
mfx.FrameInfo.CropH:1080
mfx.FrameInfo.BufferSize:71305088
mfx.FrameInfo.reserved5:70780800
mfx.FrameInfo.FrameRateExtN:30
mfx.FrameInfo.FrameRateExtD:1
mfx.FrameInfo.reserved3:0
mfx.FrameInfo.AspectRatioW:0
mfx.FrameInfo.AspectRatioH:0
mfx.FrameInfo.PicStruct:2
mfx.FrameInfo.ChromaFormat:1
mfx.FrameInfo.reserved2:0
mfx.CodecId:1195724874
mfx.CodecID(string):JPEG
mfx.CodecProfile:1
mfx.CodecLevel:0
mfx.NumThread:8
mfx.TargetUsage:1
mfx.GopPicSize:100
mfx.GopRefDist:0
mfx.GopOptFlag:0
mfx.IdrInterval:0
mfx.RateControlMethod:0
mfx.InitialDelayInKB:0
mfx.QPI:0
mfx.Accuracy:0
mfx.BufferSizeInKB:0
mfx.TargetKbps:0
mfx.QPP:0
mfx.ICQQuality:0
mfx.MaxKbps:0
mfx.QPB:0
mfx.Convergence:0
mfx.NumSlice:0
mfx.NumRefFrame:0
mfx.EncodedOrder:0
mfx.DecodedOrder:1
mfx.ExtendedPicStruct:100
mfx.TimeStampCalc:0
mfx.SliceGroupsPresent:0
mfx.MaxDecFrameBuffering:0
mfx.EnableReallocRequest:0
mfx.JPEGChromaFormat:1
mfx.Rotation:100
mfx.JPEGColorFormat:0
mfx.InterleavedDec:0
mfx.SamplingFactorH:0 0 0 0 
mfx.SamplingFactorV:0 0 0 0 
mfx.Interleaved:1
mfx.Quality:100
mfx.RestartInterval:0
Protected:0
IOPattern:2
reserved2:0
 

0 Kudos
Mark_L_Intel1
Moderator
1,053 Views

Hi Leo,

Sorry for the late response.

I can reproduce with the command you supplied. After I remove the argument "-tff", I can generate a full frame picture.

Could you try to remove "-tff" and see if it solves your problem?

Mark

0 Kudos
yu__leon
Beginner
1,053 Views

Hi Mark

yes  removing "-tff" solves the problem. thank you.

what is the difference between  MFX_PICSTRUCT_PROGRESSIVE and MFX_PICSTRUCT_FIELD_TFF?   I am using -tff for my H264 encoding as follows. And the NV12 frame for H264 encoding is generated by Intel IPP from RGB frame.    

sample_encode.exe -nv12 -tff -sw h264 -u speed -i "d:\intelsdk_test\nv12.yuv" -o "d:\intelsdk_test\encoded_h264.avc" -w 720 -h 576 -dump "d:\intelsdk_test\config.txt"

0 Kudos
Mark_L_Intel1
Moderator
1,053 Views

Hi Leon,

Could you open other post for the question?

You can refer to the following online document at "Appendix A" in the encode section:

https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.pdf

There should be a constrain when you use these parameters.

Please post the follow-up question in the new post you created.

Mark

0 Kudos
Reply