Community
cancel
Showing results for 
Search instead for 
Did you mean: 
dzhou_tac
Beginner
127 Views

H264 stream decoded and encoded into MPEG2 with color difference

Hi,

I decoded H264 stream then encoded it into MPEG2 or other format of stream. But when the re-encoded MPEG2 is played, I got totally different color.

decoding: umc_h264_dec_con -fyv12 -i test264.ts -o test.yuv

encoding: umc_video_enc_con m2 -i test.yuv -w 700 -h 500 -o test.mpg

Does any one why?

david.tac

0 Kudos
6 Replies
Tamer_Assad
Innovator
127 Views

Hi David,

Please try decoding to iYUV(i420).

I guess the original YUV format of your H264 stream is iYUV, and when you decode to YV12, the order of the U and the V components of the decoded product gets reversed.

Give it a try, I would like to know how is it going then.

Regards,

Tamer

dzhou_tac
Beginner
127 Views

Hi Tamer,

Thanks. With iYUV420, it works.

david

dzhou_tac
Beginner
127 Views

Hi Tamer,

With YUV420 as encoder input, it fails to encode into H261, DV_SD, DV50, and DV100.

With YV12 as Encoder input, it also fails to encoder into DV, DV50, DV100

Thanks,

David

Ying_H_Intel
Employee
127 Views

Hi David,

Tamer is right, YUV420 is default encoder input.

But as the readme.htm claim

Note: dv_hd encoding required following keys: -h height, -w width, -f frame rate. DV100(DVHD) encoder has four modes: 720/60p & 720/50p -progressive format; 1080/60i & 1080/50i - interlaced format. See DV100 standard SMPTE-370M-2006 for details. And according to standard input yuv file should have YUV422 planar sampling structure. Examples of command lines:
>umc_video_enc_con.exe dv_hd -i input.yuv -f 29.97 -w 1920 -h 1080 -o dv100_1080_60i.dv100
>umc_video_enc_con.exe dv_hd -i input.yuv -f 25 -w 1920 -h 1080 -o dv100_1080_50i.dv100
>umc_video_enc_con.exe dv_hd -i input.yuv -f 60 -w 1280 -h 720 -o dv100_720_60p.dv100
>umc_video_enc_con.exe dv_hd -i input.yuv -f 50 -w 1280 -h 720 -o dv100_720_50p.dv100

So both YUV420 and YV12 don't work with DV100.

But about H261, DV_SD, DV50 failed, do you mean they fail to work whengiveinput, notonly the incorrectcolor, right? it may be other reasons, like YUV size etc.What is the YUV sizefor your input?

Best Regards,

Ying

dzhou_tac
Beginner
127 Views

Hi Ying,

Thank you for your prompt reply.

Is it possible that the resolution of InputSource.yuv to be different with the resolution of the output stream.

For example, if input stream is decoded as 700x600 15 fps into input.yuv, then to encode the intput.yuv as 1900x1200 30fps?

The H162 and DV.. fails at the command line. The Error Msg is:

Error: Video Encoder initialization failed.

Thank you,

david

Ying_H_Intel
Employee
127 Views

Hi David,

Right, the different resolution should be the reason. In general, we assume the input resolution are same as output resolution. Ifgive thesame size ofboth InputSource.yuv and encoder's resolution, all of the encoders work normallly, right?

on the other hand, you may notice that in the solution ofumc_video_enc_con,theproject color_space_converter include someauxiliaryfunctionality includingresizing , colorConvertion, deintrlace itc. But they are working during GetFrame() phase. The encoder H261 or DV may havestrictlycheck the unmatched resolutionduring init phase, so the video encoder initialization failed.If you need to convert stream from 700x600 to 1900x1200, for safety, you may convert the resolution yourself.

for example, modify the encoder sample codeon http://software.intel.com/en-us/articles/getting-started-with-intel-ipp-unified-media-classes-sample...

ReadYUVData("test.yuv",cYUVData,700,600,200), in which add ippiResize to convert Resolution;
EncodeStream(cYUVData,1900,1200,frame,cVideoData,VideoDataSize);
WriteVideoData("testout.stream",cVideoData,VideoDataSize);

Best Regards,
Ying

Reply