maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   SailfishOS (https://talk.maemo.org/forumdisplay.php?f=52)
-   -   [SOLVED] ffplay (ffmpeg) no audio (https://talk.maemo.org/showthread.php?t=99371)

moodroid 2017-05-07 15:45

[SOLVED] ffplay (ffmpeg) no audio
 
Hi,

I'll openly admit that I haven't a clue what I'm doing, but as I've been having a few problems gstreamer, I thought I'd try some other options...
I've built ffmpeg (including ffplay), and when I try and play a video with ffplay, the video itself is fine (after rotating and resizing), but I'm getting no audio. I've seen various terms flying around, like alsa, oss, libaudioresource, pulseaudio etc., but I'm not really sure what I'm trying to achieve, let alone how to do it. Just wondered if anyone could give me any clues on what I should try, e.g. parameters to ffplay or building ffmpeg again with certain things enabled?

Thanks

Markkyboy 2017-05-09 10:11

Re: ffplay (ffmpeg) no audio
 
Like yourself, I find myself wanting to play with things I know little about. In my mind, this is one of the best ways to learn; by fiddling and of course, also accepting you may cause problems with your beloved device.
I ended up using FFMPEG by bloodyfoxy on Openrepos; https://openrepos.net/content/bloodyfoxy/ffmpeg. Then, with a few videos shot using my Jolla1, I had a go at different conversions, some worked, some didn't.

Okay, as FFMPEG is not specific to Sailfish, you can find plenty of help/walk-throughs/videos littering the net.

Here's what I just tried on my device and it worked, albeit very basic, but it allows one to get the gist of what's going on....bit by bit :)

OKay, shoot a short video, say 30 seconds worth with some audio; chatting, music, whatever, but do make some noise as the following steps will strip the soundtrack from an MP4 video leaving it as an MP3 audio track.

Then in terminal, try this;

ffmpeg -i 20170509_105924.mp4 -vn -ar 44100 -ac 2 -ab 320 -f mp3 audio.mp3 (replace '20170509_105924.mp4' with your own)

Once done, open Mediaplayer, find your track and play it.

Hope this helps, a little......

Regards,

paolomi 2017-05-09 18:34

Re: ffplay (ffmpeg) no audio
 
Quote:

Originally Posted by moodroid (Post 1527769)
but I'm getting no audio. I've seen various terms flying around, like alsa, oss, libaudioresource, pulseaudio etc.

install "pulseaudio-devel" and recompile. I hope it helps.

moodroid 2017-05-10 18:19

Re: ffplay (ffmpeg) no audio
 
Quote:

Originally Posted by paolomi (Post 1527829)
install "pulseaudio-devel" and recompile. I hope it helps.

Thanks. Still seem to have no sound though. I've found that with paplay I get sound, but with aplay I don't get sound, so wonder if I have an alsa problem?

nieldk 2017-05-10 18:30

Re: ffplay (ffmpeg) no audio
 
Quote:

Originally Posted by moodroid (Post 1527885)
Thanks. Still seem to have no sound though. I've found that with paplay I get sound, but with aplay I don't get sound, so wonder if I have an alsa problem?

Hmm pulse audio is what SFOS should use. But I guess there are some things that needs to be specifically configured.
I will have a look next couple of days.

paolomi 2017-05-17 20:44

Re: ffplay (ffmpeg) no audio
 
I've compiled ffplay now and there are no sounds, I don't know why. :confused:

Some months ago I've compiled mpv and it doesn't work on sailfish os. :(

moodroid 2017-05-18 07:46

Re: ffplay (ffmpeg) no audio
 
Quote:

Originally Posted by paolomi (Post 1528096)
I've compiled ffplay now and there are no sounds, I don't know why. :confused:

Some months ago I've compiled mpv and it doesn't work on sailfish os. :(

Thanks for trying it, and glad it's not just me. Here's what I've discovered, but as I say, I don't really know what I'm doing...

# ffmpeg -i file.mp4 -f wav - | paplay
this plays sound, but I can't find a way to make ffplay play sound, and I can't get aplay (alsa) to work either

# ffmpeg -i file.mp4 -f avi - | tee >(ffplay -) >(ffmpeg -i - -f wav - | paplay) > /dev/null
this gives me sound and video, but it goes a bit mad when you pause and unpause

paolomi 2017-05-22 21:05

Re: ffplay (ffmpeg) no audio
 
Thanks, your command line works, but on my jolla1 some videos pause and play too often... so i made a simple script file:

Code:

#!/bin/bash                                                                                                                 
BINPATH="/home/nemo"                                                                                                         
FILE="$1"                                                                                                                   
$BINPATH/ffmpeg -i $FILE -f wav /tmp/wav.wav                                                                                 
$BINPATH/ffplay -fs $FILE & paplay /tmp/wav.wav                                                                             
rm /tmp/wav.wav

don't run it with very long videos! otherwise you have to wait very long before it plays! :eek:

this is a temporary solution: i hope ffplay will be fixed soon

moodroid 2017-06-22 11:11

Re: ffplay (ffmpeg) no audio
 
1 Attachment(s)
After reading https://stackoverflow.com/questions/...o-output-sound it definitely sounded like the problem was that ffplay needed to be patched for Sailfish to use libaudioresource, so I decided to give it a go, and depsite not having a clue what I was doing, it seems to work!

Attached is ffplay.c and ffbuild/config.mak. There may be some devel files that need to be pkcon install'ed, but I can't remember for sure, but it should be obvious from any compilation errors if there are.

The screen does go to sleep during playback, but https://openrepos.net/content/xmlich02/stay-awake can be used to work around this.

EDIT: In case anyone wants to try this, these are the devel files that I currently have installed, though I don't think all of them are required:
Installed SDL2-devel-2.0.3-1.4.1.armv7hl
Installed SDL2_sound-devel-1.0.1-1.2.3.armv7hl
Installed glib2-devel-2.48.0+git3-1.11.2.armv7hl
Installed glibc-devel-2.19+6.9-1.8.1.armv7hl
Installed jolla-developer-mode-0.3.26-10.27.4.jolla.armv7hl
Installed jolla-developer-mode-profile-0.3.26-10.27.4.jolla.armv7hl
Installed libaudioresource-devel-1.0.5-1.4.3.armv7hl
Installed libxml2-devel-2.9.1-1.3.5.armv7hl
Installed pcre-devel-8.31-1.3.1.armv7hl
Installed perl-devel-2:5.16.1-1.1.29.armv7hl
Installed pulseaudio-devel-8.0+git5-1.21.2.armv7hl
Installed smpeg-devel-2.0.0-1.1.6.armv7hl
Installed zlib-devel-1.2.8+git2-1.3.21.armv7hl

And to resize and rotate (for my device) I use:
ffplay -i <filename> -vf "transpose=1" -x 540 -y 960


All times are GMT. The time now is 02:32.

vBulletin® Version 3.8.8