omxplayer bad audio quality


23 posts
by okieng » Wed May 22, 2013 1:04 pm
Hi,
I have live stream and mp4 video.
Live stream is H264 video/ MPEG Audio.
I am receiving stream with omxplayer w/o any problem.

mp4 video ise same video codec but different audio codec .( MPEG AAC mp4a )
When i tried play omxplayer audio has distortion. I barely hear audio. Poor audio quality.

Looks like mpeg aac audio codec is not working.
Do you have any idea how i can fix this problem.

Thanks
Oki
Posts: 14
Joined: Thu Apr 18, 2013 4:06 pm
by dom » Wed May 22, 2013 1:18 pm
Is audio quality okay when played from a local file with a different codec?

Can you capture a sample file (e.g. 200MB) with the bad audio, and post it somewhere?
Moderator
Moderator
Posts: 3859
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by gkreidl » Wed May 22, 2013 1:56 pm
dom wrote:Is audio quality okay when played from a local file with a different codec?

Can you capture a sample file (e.g. 200MB) with the bad audio, and post it somewhere?


@dom:

may I remind you of the broken flac support (since version of 04/21)?
Minimal Kiosk Browser
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode for embedded applications
Posts: 664
Joined: Thu Jan 26, 2012 1:07 pm
by bartender » Sat Jun 08, 2013 8:39 am
mp4a isn't flac, is it?
I also have this annoying problem.
Posts: 35
Joined: Wed Sep 26, 2012 8:19 pm
by bartender » Sat Jun 08, 2013 8:51 am
I uploaded a sample: http://vault.xtsubasa.org/omx_sample.mp4 (65 M)
Posts: 35
Joined: Wed Sep 26, 2012 8:19 pm
by dom » Sat Jun 08, 2013 10:41 pm
bartender wrote:I uploaded a sample: http://vault.xtsubasa.org/omx_sample.mp4 (65 M)

Sample plays fine for me.
I was testing with this version of omxplayer:
https://github.com/popcornmix/omxplayer/commits/master

Are you able to build from source?
Moderator
Moderator
Posts: 3859
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by bartender » Sun Jun 09, 2013 7:04 am
dom wrote:Are you able to build from source?


No. "make ffmpeg" throws this error:
Code: Select all
arm-unknown-linux-gnueabi-gcc is unable to create an executable file.
C compiler test failed.

If you think configure made a mistake, make sure you are using the latest
version from Git.  If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.log" produced by configure as this will help
solving the problem.
make[1]: *** [configure] Error 1
make[1]: Leaving directory `/home/rondo/omxplayer'
make: *** [ffmpeg] Error 2


Running "make" throws:
Code: Select all
make: /opt/xbmc-bcm/buildroot/output/host/usr//bin/arm-unknown-linux-gnueabi-g++: Command not found
make: *** [linux/XMemUtils.o] Error 127


Also, 2 more questions:
1. How do we build Arch package from it?
2. This is a forked omxplayer, why was it forked?
Posts: 35
Joined: Wed Sep 26, 2012 8:19 pm
by pepedog » Sun Jun 09, 2013 9:55 am
Posts: 940
Joined: Fri Oct 07, 2011 9:55 am
by dom » Sun Jun 09, 2013 11:15 am
bartender wrote:2. This is a forked omxplayer, why was it forked?


Because the original author is no longer working on it, and although I have write access to his repo, it feels easier making substantial changes in my own area.
Moderator
Moderator
Posts: 3859
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by bartender » Sun Jun 09, 2013 1:00 pm
pepedog wrote:https://aur.archlinux.org/packages/omxplayer-git/
for packaging


This one won't do, it's exactly what I built originally (and sound was bad).
Posts: 35
Joined: Wed Sep 26, 2012 8:19 pm
by drirr » Mon Jun 10, 2013 4:51 pm
bartender wrote:
pepedog wrote:https://aur.archlinux.org/packages/omxplayer-git/
for packaging


This one won't do, it's exactly what I built originally (and sound was bad).

Just edit the PKGBUILD to point at the other repository and run makepkg.
Raspberry Pi (rev 000f, 512MB RAM) with heatsinks and a modmypi case running Arch Linux ARM (armv6h) hooked up to a 750GB 2.5" USB-harddrive
Posts: 54
Joined: Sun Sep 09, 2012 8:06 am
by bartender » Mon Jun 10, 2013 6:09 pm
drirr wrote:Just edit the PKGBUILD to point at the other repository and run makepkg.


Changed PKGBUILD, built it, now I have a core dump after running omxplayer with the sample above.
Posts: 35
Joined: Wed Sep 26, 2012 8:19 pm
by h8h » Thu Jul 11, 2013 3:19 pm
I can compile it and it works (even audio) :), its a dirty way, but if you know a better way, tell me ... ;)

Code: Select all
git clone https://github.com/popcornmix/omxplayer.git
cd omxplayer


Deps (same as omxplayer):

    fbset
    ffmpeg
    ffmpeg-compat
    freetype2
    pcre
    rtmpdump

In File Makefile:
Add to CFLAGS: -lfreetype
Add to LDFLAGS: -L/opt/vc/lib
Add to INCLUDES: -I/opt/vc/lib -I/usr/include/freetype2

Remove cp -a ffmpeg_compiled/usr/local/lib/*.so* $(DIST)/usr/lib/omxplayer/ in Target 'dist' ~ Line 69

In File Makefile.include:
Set USE_BUILDROOT=0 (Line 1)
Remove Variable CC and CXX (Line ~ 27 / 28)

In File gen_version.sh delete all \n characters, because they failed :) and every new echo makes automatically a new line.

At least the quick and dirty step:
Thanks to http://kittyhawkrpi.blogspot.de/2012/10 ... linux.html btw.
Code: Select all
ln -s /opt/vc/include/interface/vcos/pthreads/vcos_futex_mutex.h /opt/vc/include/interface/vcos/
ln -s /opt/vc/include/interface/vcos/pthreads/vcos_platform.h /opt/vc/include/interface/vcos/
ln -s /opt/vc/include/interface/vcos/pthreads/vcos_platform_types.h /opt/vc/include/interface/vcos/
ln -s /opt/vc/include/interface/vmcs_host/linux/vchost_config.h /opt/vc/include/interface/vmcs_host/

ok lets go :)

Code: Select all
make
make dist


# Create new fonts path
# If you're too lazy to change the omxplayer script, create the font path
Code: Select all
mkdir -p /usr/share/fonts/truetype/freefont
cp fonts/* /usr/share/fonts/truetype/freefont

Copy over omxplayer-dist/* to the Pi /

If you can even compile it, with this hack, please tell me and i create a package on aur.
Posts: 3
Joined: Thu Jul 11, 2013 2:38 pm
by Antario » Thu Jul 18, 2013 8:53 pm
Hi! I have been able to compile it, though I needed to add -I/opt/vc/include to the INCLUDES in the Makefile, but unfortunately the audio still doesn't work properly for me. :(

Edit: I can't even compile the b0143ac0 revision (huceke) now, which I could in the past. Now it quits with an error saying that gcc was unable to create an executable file.

Edit2: I compiled from https://github.com/popcornmix/omxplayer again, but omxplayer crashes after starting, even if no argument is passed. (Blank screen, I guess it is something with the framebuffer.)
Posts: 19
Joined: Sat Jan 14, 2012 12:02 am
by h8h » Fri Jul 19, 2013 5:08 pm
Have you tried to start omxplayer with -g (--genlog generate log file)? Generates it any logs?

Which pi distro did you use?
Posts: 3
Joined: Thu Jul 11, 2013 2:38 pm
by Antario » Sat Jul 20, 2013 1:36 pm
Hi h8h!
Unfortunately it didn't generate a log file. I use ArchLinux with the latest firmware, kernel version 3.6.11-13 and gcc version 4.7.2.
Posts: 19
Joined: Sat Jan 14, 2012 12:02 am
by h8h » Sun Jul 21, 2013 8:21 am
Ok ... thats bad :?

Could you please try to rebuild the omxplayer.bin with

Code: Select all
make omxplayer.bin


Then use the omxplayer script in the same directory (./omxplayer) and try to start omxplayer. Which video source did you use hdmi or rca?
Posts: 3
Joined: Thu Jul 11, 2013 2:38 pm
by brunorro » Sun Jul 21, 2013 9:33 am
Hi !

I hope my contribution won't be useless. A week ago I was able to compile omxplayer the way you said here, but there were some details. Unfortunately my history didn't show me all what I did, but, let me remember...

By the way, I also had one more dependency. Right now I can't remember if it was only boost or both boost and boost-libs, but right now I have both of them installed:
Code: Select all
boost
boost-libs


Also, I slightly changed INCLUDES Makefile line in order to add /opt/vc/include directory, it looks like this:

Code: Select all
INCLUDES+=-I/opt/vc/lib -I/opt/vc/include -I/usr/include/freetype2 -I./ -Ilinux -Iffmpeg_compiled/usr/local/include/


It worked. I know it's probably a stupid thing to say because everybody here changed before, but ... it worked :P
Posts: 2
Joined: Thu Sep 13, 2012 9:10 am
by Antario » Thu Jul 25, 2013 2:16 pm
Hi everyone!

I compiled it again. This time when I run omxplayer as the regular user, it displays an error for a split second (a path, I think something with "vc" and a Permission denied at the end) and it crashes with a black, blank screen.
If I run it with sudo, it doesn't crash, but curiously changes back the terminal font to default after exit (I have a custom font set up). It works like this, though, plays video without audio distortion. :)

I compiled it differently this time, I edited the prepare-native-raspbian.sh script by deleting everything after this echo inside the script:
Code: Select all
echo "
install: dist
      cp omxplayer-dist/* / -r" >> Makefile
I could do this, since the last few commands were mostly ones concerning the unneded rpi-config script and a pushd command to patch gcc and g++ with gcc version 4.7.2 which is unneeded in Arch.
Afterwards I ran it with:
Code: Select all
$ ./prepare-native-raspbian.sh
Then $ make. If $ ./omxplayer works, you can $ make dist and copy the contents of omxplayer-dist over / (root permissions needed this time, of course).

Any idea about what's wrong with the permissions? Why can't I run omxplayer without superuser permissions?
Another curious question, but it doesn't really matter: why don't I had to compile it with $ make ffmpeg, like the huceke fork?

Cheers! :D
Posts: 19
Joined: Sat Jan 14, 2012 12:02 am
by Antario » Sat Jul 27, 2013 10:56 am
Hi again!

Okay, another update.
I managed to compile by editing the prepare-native-raspbian.sh script, like I said before. I found out that the permission problem lied inside the /usr/bin/omxplayer script. The echoes piped to vtconsole were the problem, so I removed those from omxplayer. I guess they were to blank the console while playing, but omxplayer now has an option, namely -blank which does exactly the same, and does it well, too.
Two problems remain, however. Subtitles doesn't show for some curious reason. (The fonts are there, everything seems perfectly fine, the .srt is in UTF-8 format, etc ... ; I didn't try with embedded, though.) The other problem is with the audio. It goes out of sync and gets a little distorted if seeked. (Even with an initial jump-to-time with the -l option.) It sounds like gargling, lol.

Any ideas?
Also, I can share the modified prepare-native-raspbian.sh (I should name it prepare-native-archlinuxarm.sh I guess) and the modified /usr/bin/omxplayer, too. Let me know if you need them. ;) (I would have shared it now anyways if I had time, but I'm in a haste.)

Cheers!
Posts: 19
Joined: Sat Jan 14, 2012 12:02 am
by dom » Sat Jul 27, 2013 2:43 pm
Antario wrote:The fonts are there, everything seems perfectly fine, the .srt is in UTF-8 format, etc ... ; I didn't try with embedded, though.)


What gpu_mem have you got? HD + subs may need more than 64M.
Moderator
Moderator
Posts: 3859
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by mcwarman » Tue Jul 30, 2013 8:19 pm
Firstly i would just like to say a massive thank you to all the contributors on this thread. Using a combination of all your various inputs i managed to 'make' the omxplayer from popcornmix git (Build date: 29/07/2013 22:00 CEST, Git version: 6838dfd)

I just thought i would share my experience after updating the MakeFile with changes highlighted by h8h and Antario. I ran into two errors regarding missing files during the make after looking at the LDFLAGS line i could see it was relating to them specifically:

Code: Select all
$(SDKSTAGE)/usr/lib/arm-linux-gnueabihf/libfreetype.so $(SDKSTAGE)/lib/arm-linux-gnueabihf/libz.so.1.2.7


I compared the MakeFile from the AUR package and noticed the omission of the above and the addition of the following:

Code: Select all
-lfreetype -lz


After a quick update to the script to sort out fonts and comment out vtconsole vtcon1 bind, the horrible audio quality has now disappeared. Thanks to all.
mcwarman
Posts: 1
Joined: Mon Jul 15, 2013 12:31 pm
by Antario » Wed Jul 31, 2013 6:18 am
dom wrote:What gpu_mem have you got? HD + subs may need more than 64M.
As far as I know the RAM is dynamically allocated since a certain firmware version. Am I wrong?
Edit: OK. I checked. Dynamic RAM isn't configured for me (I didn't spend time with it, I didn't know I had to set it up), but previously I set up a 128-128 split in config.txt, so it should be fine (it was fine with the huceke version, before 2 previous firmware and kernel updates).

mcwarman wrote:Using a combination of all your various inputs i managed to 'make' the omxplayer from popcornmix git (Build date: 29/07/2013 22:00 CEST, Git version: 6838dfd)
I'm happy it worked! ;)
Posts: 19
Joined: Sat Jan 14, 2012 12:02 am