Skip to content
This repository has been archived by the owner on Jan 20, 2021. It is now read-only.

Switch from FFmpeg to Libav #110

Closed
ghost opened this issue Jan 12, 2016 · 20 comments
Closed

Switch from FFmpeg to Libav #110

ghost opened this issue Jan 12, 2016 · 20 comments

Comments

@ghost
Copy link

ghost commented Jan 12, 2016

FFmpeg is being deprecated from operating system repositories in favour of Libav. Would it be possible for this project to switch over?

It should be as simple as replacing all "ffmpeg" command instances with "avconv".

A link explaining the situation of libav being favoured over ffmpeg:
http://blog.pkh.me/p/13-the-ffmpeg-libav-situation.html

EDIT: As explained in the article, the majority of operating systems are, or will be, including both ffmpeg and libav-tools in their repositories. So it is favourable to have a switch between the two, instead of removing ffmpeg over libav-tools.

@matthieugrieger
Copy link
Owner

This is a possibility if it supports the same commandline arguments as ffmpeg as shown in this snippet of code from gumble: https://github.com/layeh/gumble/blob/master/gumbleffmpeg/stream.go#L89

It looks like it does as per this issue comment, so it is probably compatible: layeh/gumble#8 (comment)

This is something I forgot about, thanks for reminding me!

@ghost
Copy link
Author

ghost commented Jan 12, 2016

It should for the majority as far as I am concerned. I am trying to get this running on a Raspberry Pi device.

Debian removed ffmpeg as many other operating systems did. It was present in Debian 7, unavailable in Debian 8 (current), and will be present again in Debian 9 (released at the end of the year). Both packages will co-exist within the operating system repository, but it is recommended to only have one installed at a time.

ffmpeg is available as a backport to Debian 8. Because Raspberry Pi is not supported within the Linux kernel as of yet (but it is in progress), a custom Debian called Raspbian has to be used, which is limited and does not have backports.

I am currently compiling ffmpeg on the device (taking a few hours) crossing my fingers it will end up being a solution. However, just being able to do "apt-get install libav-tools" and being able to get going, is much welcome.

It is most likely best to include a ffmpeg / libav-tools compile argument to make this easier, as really all it means is either putting "ffmpeg" or "avconv" in place.

Thank you for your consideration, and quick reply.

@matthieugrieger
Copy link
Owner

I just made a change that should allow you to use avconv instead of ffmpeg. Can you try it out and let me know how it goes?

All you need to do is change the configuration value PlayerCommand to "avconv" to get it to work.

@ghost
Copy link
Author

ghost commented Jan 12, 2016

I am unable to finish compilation. I do not see any Go files in the golang/protobuf repository either. I do see some in subdirectories though. Has the repository perhaps received a directory structure update?

can't load package: package github.com/golang/protobuf: no buildable Go source files in /home/lilith/mumbledj/.vendor/src/github.com/golang/protobuf
=> Done!
goop go build
_/home/lilith/mumbledj
./cache.go:85: syntax error: unexpected range, expecting {
./cache.go:100: syntax error: unexpected }
goop: Command failed with exit status 2
Makefile:4: recipe for target 'mumbledj' failed
make: *** [mumbledj] Error 2

@matthieugrieger
Copy link
Owner

Nothing in the directory structure of the repository has changed, as all I did was edit existing files.

I think this has something to do with that package error at the top of your log. Can you try deleting your MumbleDJ directory and re-cloning the repository?

@ghost
Copy link
Author

ghost commented Jan 12, 2016

can't load package: package github.com/timshannon/go-openal: no buildable Go source files in /home/lilith/mumbledj/.vendor/src/github.com/timshannon/go-openal
can't load package: package github.com/golang/protobuf: no buildable Go source files in /home/lilith/mumbledj/.vendor/src/github.com/golang/protobuf

Why does it not point to "github.com/timshannon/go-openal/openal" and "github.com/golang/protobuf/proto"?

The full log:
http://pastebin.com/kb5gXn8Q

@matthieugrieger
Copy link
Owner

Not sure why this is happening to you, my compilation works fine.

I think this should solve it though. cd to your cloned directory and execute these commands:

goop go get github.com/timshannon/go-openal/openal
goop go get github.com/golang/protobuf/proto

Let me know!

@ghost
Copy link
Author

ghost commented Jan 12, 2016

Running those commands do not output any errors (nor any output at all, so they most likely succeeded without fail).

I am using all packages provided by Debian 8. Perhaps that might be why? Do I need to re-run make or can I continue?

@ghost
Copy link
Author

ghost commented Jan 12, 2016

Another issue, it seems one of the script is trying to invoke "sudo". I believe this is bad practice, as in general it should be invoked by the user, at the start of the script.

On servers I do not use sudo. I have a normal user account and a root account. If I need to perform root operations I switch to the root account.

root@pi:/home/lilith/mumbledj# make install
mkdir -p ~/.mumbledj/config
mkdir -p ~/.mumbledj/songs
if [ -f ~/.mumbledj/config/mumbledj.gcfg ]; then mv ~/.mumbledj/config/mumbledj.gcfg ~/.mumbledj/config/mumbledj_backup.gcfg; fi;
cp -u config.gcfg ~/.mumbledj/config/mumbledj.gcfg
sed -i 's/YouTube = "/YouTube = "''/' ~/.mumbledj/config/mumbledj.gcfg
sed -i 's/SoundCloud = "/SoundCloud = "''/' ~/.mumbledj/config/mumbledj.gcfg
if [ -d ~/bin ]; then cp -f mumbledj* ~/bin/mumbledj; else sudo cp -f mumbledj* /usr/local/bin/mumbledj; fi;
/bin/sh: 1: sudo: not found
Makefile:13: recipe for target 'install' failed
make: *** [install] Error 127

@matthieugrieger
Copy link
Owner

You shouldn't see any output if the commands were successful. My machine is currently running on the latest Xubuntu release so there might be some minor discrepancies between our systems.

Yeah I agree that the use of sudo within the Makefile isn't the best practice. I am hoping to completely get rid of the the Makefile at some point. An easy workaround would be to create a ~/bin directory. This will tell the Makefile script to place the compiled MumbleDJ binary into ~/bin for execution. Just make sure to add it to your $PATH or to change directories if you want to use the bot this way.

If you are running make install as root you can just remove any mention of sudo in the Makefile script and everything should work fine as well.

@ghost
Copy link
Author

ghost commented Jan 12, 2016

I am unable to successfully perform "make install", even when purging sudo from the file and running it under the root account:

root@pi:/home/lilith/mumbledj# make install
mkdir -p ~/.mumbledj/config
mkdir -p ~/.mumbledj/songs
if [ -f ~/.mumbledj/config/mumbledj.gcfg ]; then mv ~/.mumbledj/config/mumbledj.gcfg ~/.mumbledj/config/mumbledj_backup.gcfg; fi;
cp -u config.gcfg ~/.mumbledj/config/mumbledj.gcfg
sed -i 's/YouTube = "/YouTube = "''/' ~/.mumbledj/config/mumbledj.gcfg
sed -i 's/SoundCloud = "/SoundCloud = "''/' ~/.mumbledj/config/mumbledj.gcfg
if [ -d ~/bin ]; then cp -f mumbledj* ~/bin/mumbledj; else cp -f mumbledj* /usr/local/bin/mumbledj; fi;
cp: cannot stat ‘mumbledj_’: No such file or directory
Makefile:13: recipe for target 'install' failed
make: *_* [install] Error 1

Is there anyway where I can have the "make" file target the previous two failing github.com directories correctly? This way I can at least have make finish without any errors.

@matthieugrieger
Copy link
Owner

Can you verify that there is a compiled binary in your MumbleDJ directory? If there is one there, can you tell me what it is named?

@ghost
Copy link
Author

ghost commented Jan 12, 2016

There is none as far as I am concerned:

root@pi:/home/lilith/mumbledj# make install
mkdir -p ~/.mumbledj/config
mkdir -p ~/.mumbledj/songs
if [ -f ~/.mumbledj/config/mumbledj.gcfg ]; then mv ~/.mumbledj/config/mumbledj.gcfg ~/.mumbledj/config/mumbledj_backup.gcfg; fi;
cp -u config.gcfg ~/.mumbledj/config/mumbledj.gcfg
sed -i 's/YouTube = "/YouTube = "''/' ~/.mumbledj/config/mumbledj.gcfg
sed -i 's/SoundCloud = "/SoundCloud = "''/' ~/.mumbledj/config/mumbledj.gcfg
if [ -d ~/bin ]; then cp -f mumbledj* ~/bin/mumbledj; else cp -f mumbledj* /usr/local/bin/mumbledj; fi;
cp: cannot stat ‘mumbledj_’: No such file or directory
Makefile:13: recipe for target 'install' failed
make: *_* [install] Error 1
root@pi:/home/lilith/mumbledj# ls
cache.go commands.go Goopfile LICENSE Makefile README.md service_soundcloud.go songqueue.go youtube_dl.go
CHANGELOG.md config.gcfg Goopfile.lock main.go parseconfig.go service.go service_youtube.go strings.go
root@pi:/home/lilith/mumbledj#

@matthieugrieger
Copy link
Owner

Did you run make before make install? If there is no compiled binary in the directory after executing make then something is still wrong with the compilation.

@ghost
Copy link
Author

ghost commented Jan 12, 2016

Make fails because it points to:

github.com/timshannon/go-openal
github.com/golang/protobuf

Instead of:

github.com/timshannon/go-openal/openal
github.com/golang/protobuf/proto

I have no idea how I can modify the script to have it point to the correct directories.

@matthieugrieger
Copy link
Owner

Oh, strange. Does make output anything?

I've never encountered this issue before, bear with me. 😆

@ghost
Copy link
Author

ghost commented Jan 12, 2016

It is the same issue we discussed a few hours ago. You told me to manually run some commands. But for "make" to finish successfully, the script has to properly run those commands, and because the script is retrieved remotely, I can not modify them to point to the correct directories with the Go files to compile.

@matthieugrieger
Copy link
Owner

Ah, I understand now. I will have to take a longer look at this and maybe see if I can replicate the issue.

I suspect it has something to do with goop, the dependency manager used for this project. I will be switching away from goop hopefully fairly soon (I've pretty much had nothing but problems with it), and it should fix this issue.

Sorry about misunderstanding! I will continue to look around and see if I can figure something out.

@ghost
Copy link
Author

ghost commented Jan 12, 2016

Is there any way I can have "make" finish successfully by pointing to those two correct directories?

@matthieugrieger
Copy link
Owner

The only quick possible solution I can think of at the moment is to create a symbolic link between the incorrect directories and the correct ones. It is a bit of an ugly hack and I'm not sure if it would work, but it is worth a shot.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant