H.264 encoder header problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

H.264 encoder header problem

2,242 Views
nandkishorbirad
Contributor I

Hi all,

     I am working on i.MX53 platform on linux 2.6.35. It captures the camera feed and encodes to H.264 file format. I used mxc_vpu_test as a reference project. The problem is it doesn't play in VLC player or other than the movie player of ubuntu.

     When I checked the video created by mxc_vpu_test.out, It is also having same problem. I think, this some encoder header issue.

Has anybody faced same issue & how to fix it?

the command for mxc_vpu_test is,

./mxc_vpu_test -E "-o Out.mp4 -f 2 -c 300 -w 640 -h 480"

Regards,

Nandkishor.

Labels (1)
0 Kudos
Reply
10 Replies

1,640 Views
YixingKong
Senior Contributor IV

Nandkishor

This discussion is closed since no activity. If you still need help, please feel free to reply with an update to this discussion, or create another discussion.

Thanks,

Yixing

0 Kudos
Reply

1,640 Views
YixingKong
Senior Contributor IV

Nandkishor

Had your issue got resolved? If yes, we are going to close the discussion in 3 days. If you still need help, please feel free to reply with an update to this discussion.

Thanks,

Yixing

0 Kudos
Reply

1,640 Views
joanxie
NXP TechSupport
NXP TechSupport

as I mentioned in the SR, I send the link to you, try to change the raw data to mp4 file first, hope that helpful for you.

0 Kudos
Reply

1,640 Views
BrilliantovKiri
Senior Contributor I

Use ffplay, Luke! :smileywink:

0 Kudos
Reply

1,640 Views
nandkishorbirad
Contributor I

Hi Kirill,

    The encoded video file should play in common video players. This is the primary requirement, I can't suggest user to use some specific player.

0 Kudos
Reply

1,640 Views
BrilliantovKiri
Senior Contributor I

For this you should add video frames in container, e.g. avi.

>

>

0 Kudos
Reply

1,640 Views
prasannakumar_m
Contributor II

Guess the header is not stored. Using vpu_EncGiveCommand(handle, ENC_PUT_AVC_HEADER, &hdr_sps) api with appropriate parameters will provide the headers. Write the header to the file before writing the encoded data.Sample code may be fetching the header already - try to use it.

0 Kudos
Reply

1,640 Views
nandkishorbirad
Contributor I

Hi Prasanna,

     vpu_EncGiveCommand is already used as below,

enchdr_param.headerType = SPS_RBSP;

vpu_EncGiveCommand(handle, ENC_PUT_AVC_HEADER, &enchdr_param);

     

vbuf = (virt_bsbuf + enchdr_param.buf - phy_bsbuf);

ret = vpu_write(enc->cmdl, (void *)vbuf, enchdr_param.size);

enchdr_param.headerType = PPS_RBSP;

vpu_EncGiveCommand(handle, ENC_PUT_AVC_HEADER, &enchdr_param);

vbuf = (virt_bsbuf + enchdr_param.buf - phy_bsbuf);

ret = vpu_write(enc->cmdl, (void *)vbuf, enchdr_param.size);

I have attached the screen-shot of video file in hex editor. (mxc_vpu_test.png) and the video file created using G-streamer (g-streamer.png),

Regards,

Nandkishor.

0 Kudos
Reply

1,640 Views
prasannakumar_m
Contributor II

Looks like the header is present in the vpu encoded file. There must be some other problem. Please try playing in mplayer or ffplay.

0 Kudos
Reply

1,640 Views
nandkishorbirad
Contributor I

Hi Prasanna,

As I mentioned earlier the video plays in movie player in ubuntu 12.04. But not in other players like VLC player.

The video file recorded using g-streamer plays in all video player.

Did you see the attached screen shot of both video files in hex editor. g-streamer video file has more informations.

Can you point out what information is missing in other video file (mxc_vpu_test.png) & how can I generate it?

Regards,

Nandkishor.

0 Kudos
Reply