av2kk
Posts: 21
Joined: Tue Jul 17, 2012 11:01 am

playing .mp4 files with hello_video

Tue Jul 17, 2012 11:13 am

I am trying to modify hello_video example to play .mp4 files. I tried changing the following line in video.c

format.eCompressionFormat = OMX_VIDEO_CodingAVC;
to
format.eCompressionFormat = OMX_VIDEO_CodingMPEG4;

but the program hangs when trying to open .mp4 .
On investigation I found it is failing the follwing test.
ilclient_enable_port_buffers(video_decode, 130, NULL, NULL, NULL) == 0)

Thanks for any help.
Krish

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5286
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: playing .mp4 files with hello_video

Tue Jul 17, 2012 3:44 pm

OMX_VIDEO_CodingMPEG4 is the encoded video format of MPEG4. Nothing to do with a container format of mp4 (which most likely is still encoded as AVC/H264).

To play video inside a container like mp4 you will need another library that parses containers, like libavcodec.
Look at omxplayer
https://github.com/huceke/omxplayer/

av2kk
Posts: 21
Joined: Tue Jul 17, 2012 11:01 am

Re: playing .mp4 files with hello_video

Wed Jul 18, 2012 10:36 am

Thanks Dom.
While I am trying to work on the OMXplayer code, can you suggest any link from where I can down load the OMXPlayer.bin so that I can carry on with my main project which is to play audio video files based on GPS input. I intend to use the OMXPlayer.bin in my program using system("./OMXPlayer <file name>");

Thanks for any help.
Krish

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5286
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: playing .mp4 files with hello_video

Wed Jul 18, 2012 12:29 pm

If you update to new image:
http://www.raspberrypi.org/archives/1605

omxplayer is preinstalled.

marosg
Posts: 25
Joined: Sat Jul 07, 2012 2:41 pm

Re: playing .mp4 files with hello_video

Wed Jul 18, 2012 2:32 pm

I would like to try to make some changes to omxplayer for myself, to see how these things work. It is long time since I did some programming. Fortunately omxplayer is written in C. Can you suggest some easy to follow steps how to get omxplayer source and compile it on Pi myself ? I have no idea how to do it properly, how to get all things that are needed.

Thank you

av2kk
Posts: 21
Joined: Tue Jul 17, 2012 11:01 am

Re: playing .mp4 files with hello_video

Thu Jul 19, 2012 12:29 pm

I got the latest Debian (15-7-2012) and tried omxplayer. but the display shows up the first frame for a second and the program quits with a have a nice day!
=============== terminal response
$omxplayer -ohdmi test.mp4
file : test.mp4 reult 13 format mov,mp4,m4a,3gp,3g2,mj2 audio streams 1 video streams 1 chapters 0 subtitles 0
Video codec omx-h264 width 640 height 296 profile 578 fps 23.976025
Audio codec aac channels 2 samplerate 44100 bitspersample 16

have a nice day ;)
================

the omxplayer.log file has a number of entries .The last lines are (for some unknwon reason I am unable to attach the omxplayer.log file to the post)
==============
00:00:00 T:0 DEBUG: COMXAudio::Initialize Input bps 16 samplerate 44100 channels 2 device hdmi buffer size 352800 bytes per second 176400 passthrough 0 hwdecode 0
00:00:00 T:0 DEBUG: OMXThread::Create - Thread with id 1163154528 started
00:00:00 T:0 DEBUG: pcm->nPortIndex : 232
00:00:00 T:0 DEBUG: pcm->eNumData : 0
00:00:00 T:0 DEBUG: pcm->eEndian : 1
00:00:00 T:0 DEBUG: pcm->bInterleaved : 1
00:00:00 T:0 DEBUG: pcm->nBitPerSample : 16
00:00:00 T:0 DEBUG: pcm->ePCMMode : 0
00:00:00 T:0 DEBUG: pcm->nChannels : 2
00:00:00 T:0 DEBUG: pcm->nSamplingRate : 44100
00:00:00 T:0 DEBUG: OMX_AUDIO_ChannelLF
00:00:00 T:0 DEBUG: OMX_AUDIO_ChannelRF
00:00:00 T:0 DEBUG: pcm->nPortIndex : 100
00:00:00 T:0 DEBUG: pcm->eNumData : 0
00:00:00 T:0 DEBUG: pcm->eEndian : 1
00:00:00 T:0 DEBUG: pcm->bInterleaved : 1
00:00:00 T:0 DEBUG: pcm->nBitPerSample : 16
00:00:00 T:0 DEBUG: pcm->ePCMMode : 0
00:00:00 T:0 DEBUG: pcm->nChannels : 2
00:00:00 T:0 DEBUG: pcm->nSamplingRate : 44100
00:00:00 T:0 DEBUG: OMX_AUDIO_ChannelLF
00:00:00 T:0 DEBUG: OMX_AUDIO_ChannelRF
00:00:00 T:0 ERROR: OMXPlayerAudio::WaitCompletion - wait for eos timed out
00:00:00 T:0 DEBUG: OMXThread::Run - Exited thread with id 1153860704
00:00:00 T:0 DEBUG: OMXThread::StopThread - Thread stopped
00:00:00 T:0 DEBUG: OMXThread::Run - Exited thread with id 1163154528
00:00:00 T:0 DEBUG: OMXThread::StopThread - Thread stopped
00:00:00 T:0 ERROR: COMXCoreComponent::DecoderEventHandler OMX.broadcom.audio_mixer - OMX_ErrorPortUnpopulated (0), cannot parse input stream
=================

Does it mean something is wrong with the test.mp4 file. I down loaded this movie trailer from the web and renamed it.

KenT
Posts: 758
Joined: Tue Jan 24, 2012 9:30 am
Location: Hertfordshire, UK
Contact: Website

Re: playing .mp4 files with hello_video

Thu Jul 19, 2012 4:21 pm

av2kk wrote:I got the latest Debian (15-7-2012) and tried omxplayer. but the display shows up the first frame for a second and the program quits with a have a nice day!

[snip]
Does it mean something is wrong with the test.mp4 file. I down loaded this movie trailer from the web and renamed it.
It looks like there is a bug introduced into the version of omxplayer that is in wheezy raspbian in that it prematurely terminates the playing of short videos. If you have a previous version of omxplayer you will probably find that your file plays OK but cannot be paused as its a short file.
Pi Presents - A toolkit to produce multi-media interactive display applications for museums, visitor centres, and more
Download from http://pipresents.wordpress.com

av2kk
Posts: 21
Joined: Tue Jul 17, 2012 11:01 am

Re: playing .mp4 files with hello_video

Fri Jul 20, 2012 1:28 am

KenT wrote:
It looks like there is a bug introduced into the version of omxplayer that is in wheezy raspbian in that it prematurely terminates the playing of short videos. If you have a previous version of omxplayer you will probably find that your file plays OK but cannot be paused as its a short file.
I tried a longer file (5 mins) with the same result. Is this also considered short?
1.How can this bug be brought to the notice of the author?
2. How can I get the earlier version and replace the present . I am new to linux and will appreciate step by step instructions.

My goal is to play .mp4 files and have full control on pausing ,replaying etc. programatically.
Thanks for any help.

Ocean20
Posts: 38
Joined: Wed Jul 18, 2012 2:36 am
Location: Australia

Re: playing .mp4 files with hello_video

Wed Jul 25, 2012 5:28 am

I can play mp3 sound files using the analogue output and omxplayer. I can't play AVI videos with omxplayer which only plays the sound of the video. I can play an AVI video with mplayer but don't get sound. Hmmm what should I do?

Return to “OpenMAX”