acowley / ffmpeg-light

Minimal Haskell bindings to the FFmpeg library
BSD 3-Clause "New" or "Revised" License
67 stars 29 forks source link

ffmpeg 'framrate not set' error while writing #8

Closed imalsogreg closed 9 years ago

imalsogreg commented 9 years ago

Running your demo program in encode-mode, I get:

[mpeg4 @ 0x2459960] framerate not set
testff: Couldn't open codec

Failing on Ubuntu 14.04, ffmpeg 2.5.2 built from source

No problem with arch, ffmpeg 2.4.3 from the arch repr with the same config options.

Not urgent, I have a work-around for myself for now. Will give it some more thought.

acowley commented 9 years ago

I'm on 2.5.3 now, and I've been trying pretty much every version for a while, but this is all on OS X. Do you have any ideas as to the problem? What's the work around?

imalsogreg commented 9 years ago

I don't have any good leads unfortunately. Work-around avoids ffmpeg-light entirely: write the frames to images and then run ffmpeg over them manually to make a movie. I'm wondering if the issue is something about my from-source build or uninstalled codecs.. although I know my sytem can at least generate a .mov file using ffmpeg from the command line.

The decoding side seems to work fine for .mov here, as well (I get frame 0 and frame 300 as .png as expected).

acowley commented 9 years ago

And, just to be sure, you see this error when you,

$ cabal configure -f BuildDemo
$ cabal run demo

?

imalsogreg commented 9 years ago

Error persists when running that way, yes.

I originally saw it from my own code using ffmpeg-light as a library, and also making a throwaway executable with the source from your demo/Main.hs copy-pasted into my Main.hs

acowley commented 9 years ago

Okay, my Linux VM was on 2.3 and still working. I rebuilt ffmpeg 2.3, and it still worked. I then deleted all ffmpeg things, and re-ran the compile script to build a 2.5, and it still works.

Can you try the Vagrant setup in the repository to see if that works for you? If nothing else, it might offer a clue as to what you're doing differently than me when building things.

imalsogreg commented 9 years ago

First-time vagranter.

I'm trying the vagrant thing again from scratch. Please don't sink too much of your time into this - I expect it's something face-palm-like on my side. :)

acowley commented 9 years ago

Okay, the fact that it works for me with the Vagrant setup gives me some confidence that it can work. One thing that's a bit bad about all the scripting used to setup the VM is that it doesn't do any useful error checking, so you may want to watch the output when it's doing its thing to see if any step is failing. What can happen is that one step fails, but subsequent steps still try to run, hiding the earlier failure.

imalsogreg commented 9 years ago

Ok, it worked on my side too, in the Vagrant box. I'll try to wipe all the ffmpeg related stuff I did and get a clean start from your script. You do a good job of explaning the issues with ffmpeg on ubuntu in your Vagrant readme, which I wish I had looked at earlier. So I think it's safe to close the issue :)

acowley commented 9 years ago

I spent an entire day setting that up. It was painful :P

I did my development on OS X with brew install ffmpeg, and was gutted when I found out how hard it was going to be to get working on Linux. Feel free to add any notes you come up with about getting things working somewhere in the repository so others can find it (or be pointed to it).

imalsogreg commented 9 years ago

Gosh, I can imagine that was a pain! Did some reading about ffmpeg/avconv fork history, and although I'm ignorant to the political details that lead to the split, I'm glad to learn ffmpeg proper is back in the official repositories in Ubuntu 15.04.

I'll definitely send some tweaks to your readme as soon as I get a consistent working install here.

Thanks for the library! the lack of something like this always drove me nuts. I've started trying to write ffmpeg wrappers a couple times but always got lost in the FFI weeds.