AnsweredAssumed Answered

MP4 Video Encoding

Question asked by Remus Mihail Prunescu on Jun 19, 2018
Latest reply on Jun 27, 2018 by Remus Mihail Prunescu

Dear NXP Community,

 

1. I'm using the following command to encode /dev/video0 straight into mp4 (Yocto/gstreamer/video – Gateworks):

gst-launch-1.0  imxv4l2videosrc device=/dev/video0 ! imxvpuenc_mpeg4 bitrate=10000 ! filesink location=/tmp/file.mp4

 

The problem is that some players (e.g. VLC under Linux/Windows) cannot play the file (they give an error saying they don't understand the file format). If I run ffmpeg:

ffmpeg -i video.mp4 -vcodec copy output.mp4

then all players are able to read the file and it works. I'd like not to depend on ffmpeg - could gst-launch and its plugins create a valid mp4 file? How would you modify the above command to achieve that?

 

2. I'd like to be able to encode straight into mp4 from C and I'm following the example from libimxvpuapi - encode-example-writecb.c. I have the same problem there - the encoded file cannot be read by players but after running ffmpeg things work. I'd like my app not to depend on ffmpeg.

What's missing from encode-example-writecb.c in order to produce an mp4 file that can be read by all players?

 

Many thanks in advance!

 

Regards,

Remus.

Outcomes