Author Topic: Installing FFMPEG - Issues  (Read 8385 times)

mortron

  • Full Member
  • ***
  • Posts: 27
    • View Profile
Installing FFMPEG - Issues
« on: May 25, 2017, 10:44:13 AM »
Hi there,

I installed Attract Mode on my Pi3 and was enjoying it fine as it was. I read that the FFMPEG step of the install instructions was important, and upon checking my configuration, saw I did not have the option for hardware decoding. I read up and found the link to this page: 

https://github.com/mickelson/attract/wiki/Compiling-on-the-Raspberry-Pi-%28Raspbian-Jessie%29

Which gave me this:

Method 2: build FFmpeg with mmal support (hardware accelerated video decoding)

cd ~/develop
git clone --depth 1 git://source.ffmpeg.org/ffmpeg.git
cd ffmpeg
./configure --enable-mmal --disable-debug --enable-memalign-hack --enable-shared
make
sudo make install
sudo ldconfig

Problem is when I get to the one step (./configure --enable-mmal...) the terminal spits this back:

e-memalign-hack --enable-shared
Unknown option "--enable-memalign-hack".
See ./configure --help for available options.

Is it because I did do the "sfml-pi" step above the FFMPEG install? I was under impression I only had to follow the method 2 section to update, and then reinstall Attract Mode, no?

I have not found any other posts indicating the issue, and would like to know how to proceed. As I said, the addition of FFMPEG wasn't due to any existing issue, just wanted to have a complete build. Now I am kind of halfway and not sure what to do. Apologies if this is a mess, never dealt with posting code and such in a forum post. Thanks.

progets

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1271
    • View Profile
Re: Installing FFMPEG - Issues
« Reply #1 on: May 25, 2017, 08:32:18 PM »
The ffmpeg --enable-memalign-hack switch is obsolete and is mentioned in the Pi FAQ http://forum.attractmode.org/index.php?topic=1249.0. Run the configure command without it.

mortron

  • Full Member
  • ***
  • Posts: 27
    • View Profile
Re: Installing FFMPEG - Issues
« Reply #2 on: May 25, 2017, 10:58:07 PM »
Thanks. I ran it and then realized I had updated everything else on my Pi, and therefore I cannot enable it as per your comments here:

I can confirm that the new ffmeg no longer supports the --enable-memalign-hack switch and it does seem to compile ok. However, once Attract-Mode is compiled it doesn't allow for hardware acceleration. I have done limited testing since I usually upgrade my image which works fine (with an obviously older ffmpeg).

I did build a new SD card with RetroPie 4.2 which has a new linux kernel, new RetroPie script and mid-release Attract-Mode code (fixes from 2.2.1 for the past 2+ months). This image doesn't allow me to enable the mmal hardware decoding. I will need to test further to see if it was an issue with my build, the new kernel, AM, etc.

If others have comments or solutions please jump in.

Is my assumption correct? If so, I guess you haven't figured out the solution yet? Either way, I have no real issues with my videos, other than their volume not being consistent from one to the other. Thanks again for the tips. Saved me some headache.

progets

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1271
    • View Profile
Re: Installing FFMPEG - Issues
« Reply #3 on: May 25, 2017, 11:27:25 PM »
No, it should work fine. I needed to tweak something on my build when I tested since I already had ffmpeg installed and working at the time.

You need to not use --enable-memalign-hack when compiling ffmpeg and then recompile attractmode after that. Once you reboot you should be able to select mmal for hardware decoding.

mortron

  • Full Member
  • ***
  • Posts: 27
    • View Profile
Re: Installing FFMPEG - Issues
« Reply #4 on: May 26, 2017, 06:31:32 AM »
I followed the linked lines of code and inputted them. It appeared to install fine, but then when I go into AM after a reboot, it's not giving me the option to switch my decoding.

This is the code I copied:

cd ~
mkdir develop

sudo apt-get install cmake libflac-dev libogg-dev libvorbis-dev libopenal-dev libjpeg62-turbo-dev libfreetype6-dev  libudev-dev libfontconfig1-dev

cd ~/develop
git clone --depth 1 https://github.com/mickelson/sfml-pi sfml-pi
mkdir sfml-pi/build;cd sfml-pi/build
cmake .. -DSFML_RPI=1 -DEGL_INCLUDE_DIR=/opt/vc/include -DEGL_LIBRARY=/opt/vc/lib/libEGL.so -DGLES_INCLUDE_DIR=/opt/vc/include -DGLES_LIBRARY=/opt/vc/lib/libGLESv1_CM.so
sudo make install
sudo ldconfig

cd ~/develop
git clone --depth 1 git://source.ffmpeg.org/ffmpeg.git
cd ffmpeg
./configure --enable-mmal --disable-debug --enable-shared
make
sudo make install
sudo ldconfig

cd ~/develop
git clone --depth 1 https://github.com/mickelson/attract attract
cd attract
make USE_GLES=1
sudo make install

cd ~
rm -r -f ./develop


I tried it with just the FFMPEG directions at first, but wondered if the sfml-pi bit was important so followed all of that code to a T, and still nothing. Not too sure if there is something there that can indicate whether or not I missed something, but it appears those lines do not have the --enable-memalign-hack in there, so should be ok, no? Sorry for being a pain in the...

progets

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1271
    • View Profile
Re: Installing FFMPEG - Issues
« Reply #5 on: May 26, 2017, 08:50:38 PM »
Provide the output of the following two commands:
Code: [Select]
attract -v

Code: [Select]
ffmpeg -codecs | grep h264_mmal

mortron

  • Full Member
  • ***
  • Posts: 27
    • View Profile
Re: Installing FFMPEG - Issues
« Reply #6 on: June 06, 2017, 06:03:01 AM »
Provide the output of the following two commands:
Code: [Select]
attract -v

Code: [Select]
ffmpeg -codecs | grep h264_mmal

Sorry been away for a bit... i will do this today some time. Just type this at the Pi terminal? Don't have to be in any particular directory? Thanks

progets

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1271
    • View Profile
Re: Installing FFMPEG - Issues
« Reply #7 on: June 06, 2017, 10:51:24 PM »
Yes, just run on the Pi command line. It doesn't matter what directory you're in.

mortron

  • Full Member
  • ***
  • Posts: 27
    • View Profile
Re: Installing FFMPEG - Issues
« Reply #8 on: June 11, 2017, 09:01:36 PM »
For the "attract -v" command, I get:

Attract-Mode v2.2.1 (Linux, SFML 2.3 +FontConfig +RPi +SWF)

Using Libav for Audio and Video.
avcodec 56.1.0 / avformat 56.1.0 / swscale 3.0.0 / avresample 2.1.0

Shaders are not available.


For the "ffmpeg -codecs | grep h264_mmal" i get:

ffmpeg version git-2017-05-25-d98f34d Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 4.9.2 (Raspbian 4.9.2-10)
  configuration: --enable-mmal --disable-debug --enable-shared
  libavutil      55. 63.100 / 55. 63.100
  libavcodec     57. 96.101 / 57. 96.101
  libavformat    57. 72.101 / 57. 72.101
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 90.100 /  6. 90.100
  libswscale      4.  7.101 /  4.  7.101
  libswresample   2.  8.100 /  2.  8.100
 D.V.LS h264                 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_mmal )

Sorry for the delay... I had life get in the way of fun ;)

mortron

  • Full Member
  • ***
  • Posts: 27
    • View Profile
Re: Installing FFMPEG - Issues
« Reply #9 on: June 21, 2017, 08:34:09 AM »
So I managed to get it working... sort of. I have the ability to select MMAL on the General config tab, but when I enable it, the video snaps stop working. They worked fine before and are fairly low res IIRC... is this normal?

progets

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1271
    • View Profile
Re: Installing FFMPEG - Issues
« Reply #10 on: June 21, 2017, 09:23:46 PM »
The output of "ffmpeg -codecs | grep h264_mmal" looks good. The output of "attract -v" isn't correct.

It should look like this (notice it's using FFmpeg and matches the file versions from the "ffmpeg -codecs | grep h264_mmal" output)
Code: [Select]
Attract-Mode v2.2.1 (Linux, SFML 2.4 +FontConfig +RPi +SWF)

Using FFmpeg for Audio and Video.
avcodec 57.96.101 / avformat 57.72.101 / swscale 4.7.101 / swresample 2.8.100

Shaders are not available.

My guess is that you need to recompile Attract-Mode so it sees your FFmpeg.
« Last Edit: June 21, 2017, 09:25:54 PM by progets »

mortron

  • Full Member
  • ***
  • Posts: 27
    • View Profile
Re: Installing FFMPEG - Issues
« Reply #11 on: June 22, 2017, 03:33:38 PM »
Yeah, you are correct, but have now got this as my output for "attract -v":

Attract-Mode v2.2.1 (Linux, SFML 2.4 +FontConfig +RPi +SWF)

Using FFmpeg for Audio and Video.
avcodec 57.96.101 / avformat 57.72.101 / swscale 4.7.101 / swresample 2.8.100

Shaders are not available.


And am now able to select MMAL decoding in the config... but when I do, the video snaps I am using disappear. So it works, but just not getting the end result I expected. Also... does this only apply to decoding in Attract Mode FE, or in the games as well? Thanks.

progets

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1271
    • View Profile
Re: Installing FFMPEG - Issues
« Reply #12 on: June 22, 2017, 09:04:29 PM »
What codec are your video files using? My guess is that they aren't h264.

The Attract-Mode video decoding option is only for the videos and not for the playing of games.