Needs review
Project:
FFmpeg Wrapper
Version:
6.x-2.x-dev
Component:
Miscellaneous
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Jan 2010 at 12:46 UTC
Updated:
5 Mar 2013 at 07:25 UTC
Jump to comment: Most recent file
Comments
Comment #1
arthurf commentedCan you run ffmpeg and give the output here so I can see how the regex needs to be adjusted?
Comment #2
HappyCloud commentedI've attached outputs from:
ffmpeg -formats
ffmpeg -codecs
And a screen dump from /admin/settings/ffmpeg_wrapper in Drupal.
Tell me if you want something else.
Comment #3
torgospizzaSubscribing. I have this same issue. I am running ffmpeg SVN-r21643, PHP 5.2.6-ubuntu3.
Attached is some output from admin/settings/ffmpeg_wrapper as well as running ffmpeg -formats.
Thanks!
Comment #4
torgospizzaAttached is the output containing the -codecs output as well.
Comment #5
fdavis47714 commentedI would like to try out this module, but am concerned about this issue. Can anyone tell me the last known ffmpeg version that should be safe to use?
Comment #6
torgospizzaFor me, I was able to get ffmpeg wrapper working by changing the lines in code that checked for the positions of the start and end points of the list of codecs/file formats. (See my previous attachment for how it looks on my setup.)
The lines I changed ended up being:
You can see that the new values coincide with the beginning and end of the output from doing ffmpeg -codecs or ffmpeg -formats. I'm not sure how this varies from install to install, though.
So perhaps a text input configuration (an override) would help, where if you are troubleshooting the issue of not having any available formats or codecs, reviewing the output from ffmpeg can give you an idea of what the new values are, and you can override them by setting the config variable. It would change the above lines to something like this:
I also had to delete the cache once I did this since NULL values were currently stored. HTH.
Comment #7
arthurf commentedOk this is really helpful. One option is to write a function that gets the ffmpeg version (ffmpeg -v) and switches how it parses the output. Another might be to write a grep that can handle the differences... long term it's probably better to do it based on version as there is no doubt that it will change again.
Comment #8
arthurf commentedoh, fyi, going to admin/settings/ffmpeg_wrapper should clear the cache- was it not for you?
Comment #9
jcmarco commentedThat are the changes I needed to run FFmpeg version SVN-r21861
Comment #10
zuzu83 commentedhi,
I am use ffmpeg SVN-r21874.
your patch is good, codecs is detected.
Supported file formats is not detected...
....?
Comment #11
hypertext200This is what video module users also faced, and this patch will work
Comment #12
arthurf commentedapplied patch to 6.1, 6.2, thanks jcmarco!
Comment #13
seanbI had the same problem a while ago. The attached patch fixes the issue voor FFmpeg version SVN-r20783. Codecs and file formats work for me. Let me know if it helps!
Regards,
Sean
Comment #14
jcmarco commentedI found that different versions of FFmpeg have the -codecs command or not.
In the "official" version 0.5 only works with -formats
but from SVN-r20561 the -formats command split in different ones thus includes the -codecs command
I have added a new function that gives the version information in different formats,
and using this information I get the codecs and formats using different strings for extracting the configuration.
I have tested it in two installations with different versions (0.5 and SVN-r21861) I guess that it should work to everybody.
Comment #15
arthurf commented@jcmarco - once again, thank you so much for the patch. This is committed to 6.1x, needs to be applied to 6.2x Please test and let me know if we have some success
Comment #16
arthurf commentedPatch is applied to 6.2x
Comment #17
delykj commentedIn my case this is not working. I modified a little bit ffmpeg_wrapper_get_codecs function:
old code:
new code:
Comment #18
arthurf commentedOk, I did a bunch of refactoring in the 6.2x branch to try to get this code a bit more abstract. Here's what I've come up with:
The reason for this approach is that I'd like to move the exception logic out of all the functions that depend on get_version() as much as possible. This doesn't quite get around that, but it moves in that direction. If anybody has any ideas, I'm really open to something different.
Comment #19
mfbI found a server with an unrecognized version number format:
r11872+debian_0.svn20080206-18+lenny1It starts withrrather thanSVN-rAlso the logic in the 6.x-1.x branch doesn't handle version or revision numbers between 0.5 and 20561 correctly. Patch is attached, guess it needs to be ported to 6.x-2.xComment #20
rob c commentedi agree with mfb #19
also running a custom version of ffmpeg and the current release just does not work this way.
(-ubuntu-robin-r#number for example)
did not review the patch yet, but i did patched (cut out) the version check and hard code my own version in it and now all is well. (from the get_formats and get_codecs functions that is)
Comment #21
arthurf commented@allrob can you do this on the 2x branch and test? I'm trying to avoid touching the 1.x branch. I'll commit mfb's patch shortly
Comment #22
arthurf commentedI committed to parts of the patch- the svn check I think is already handled correctly
Comment #23
rob c commentedDownloaded v2.x dev version of today.
Tested on a clean system - this system is running Ubuntu 10.04 (lucid) with the unstripped ffmpeg libs, no fancy stuff, just the basics and stable, no testing, no medibuntu.
results:
print_r ( $ffmpeg_version );
Array (
[svn] => 0
[version] => 0
)
FFmpeg version SVN-r0.5.1-4:0.5.1-1ubuntu1, Copyright (c) 2000-2009 Fabrice Bellard, et al.
FFmpeg wrapper config page:
Supported file formats: works.
Installed codecs: do not.
Tweaking the codec check (so the else part of the parser statement is always used) makes it work again.
And on my other dev system (custom almost everything)
FFmpeg version git-391a132, Copyright (c) 2000-2011 the FFmpeg developers
built on Mar 6 2011 19:13:13 with gcc 4.4.3
And both formats and codecs work, testing mp4/aac/xvid encoding seems to work, no tweaking required. (so it works with a git version.)
I'll add some ffmpeg -formats dumps if you need them.
#14 jcmarco
'In the "official" version 0.5 only works with -formats
but from SVN-r20561 the -formats command split in different ones thus includes the -codecs command'
For the git version i use i can confirm the same, so this will be the future? Better have the straight forward 'official' stuff by default? The rest is old and will be axe-able anyway someday.
And for SVN-r0.5.1-4:0.5.1-1ubuntu1 on lucid i can confirm the -codecs argument is not working, while it's 0.5.x + So that's a small issue to work on.
Keep it up!
Comment #24
arthurf commentedSo it sounds like the regex for version needs to be updated to include: SVN-r0.5.1-4:0.5.1-1ubuntu1 ?
Comment #25
rob c commentedThis list can become quite large, but it will do the job.
Comment #26
darrick commentedI just downloaded the latest code for 6.x-2.x as of March 14th, 2011 and ran into this problem. Found that $this->get_version('svn') returns an array not a string. I've attached a patch.
Comment #27
arthurf commentedYour patch was the correct fix, though looking at my own code, get_version() was a problem. I refactored this a bit to be easier to use and then fixed up the few instances where it is getting called.
Comment #28
mfbffmpeg recently switched from svn to git, and soon after forked into multiple git repositories including one called libav. Yay decentralization. Not sure what this means for ffmpeg versions going forward...
Comment #29
arthurf commented@mfb hopefully these modern versions will handle codecs/formats the same way so that version detection from here forward won't be necessary- note that in the last fix I added support for a version of ffmpeg from *2004* blech!
Comment #30
begun commentedThis module does not work when ffmpeg is compiled from the git repository. This was causing me all sorts of frustrations. I ended up modifying the ffmpeg_wrapper_class.inc. Had to add the following code to function get_version(). Now it appears to work.
I guess I should submit a patch, but I am rather new to this and am not sure how to do it. Guess it would be a good time to learn ;-)
Comment #31
arthurf commented@Begun You might want to check out: http://drupal.org/node/707484 for information on patching
The one thing about your patch here is that I'm guessing that we need to be careful of which git versions are being caught by your pattern. I'm guessing everything greater than 29240 would be ok for now, but we should probably check against previous versions.
Comment #32
mhawker commentedBegun,
Thanks for posting this, now the codecs show up for the version of FFmpeg I installed (ffmpeg version git-N-29577-gc402ce4-syslint, Copyright (c) 2000-2011), but I still don't see any Formats.
Do you see formats? I assume this is why I don't have any "Output formats" when try the Test convert file.
Comment #33
arthurf commentedIt's likely that changes are needed for both get_codecs() and get_formats() - unfortunately I don't have access to a git version of ffmpeg, otherwise I could test this out and get a patch in.
Comment #34
mhawker commentedLet me know if I can help. Unfortunately, I'm not a developer/programmer (that's why I used an install script) so I might not be much help.
Comment #35
mfbto compile your own ffmpeg from git:
git clone git://git.videolan.org/ffmpeg.git && cd ffmpeg && ./configure && make(of course more configure flags would be needed for full codec support)Comment #36
begun commented@mhawker I was also not getting any formats appearing. I just took another look at ffmpeg_wrapper_class.inc and the problem appears to be occurring in the get_formats method. There is a problem with the value assigned to $endpos variable. I found that changing the following line worked.
Original code on line 270
Updated code on line 270
Below is the tail end of the 'ffmpeg -formats' command as seen from the command line. As you can see in this version of ffmpeg the first line after the formats uses a lowercase 'f' in 'ffmpeg'. This fixed it for me.
Comment #37
arthurf commented@begun so stripos() works for you?
Comment #38
mhawker commentedAgain, thanks Begun. That worked for me as well.
In regards to a Git repository install, the changes you made to ffmpeg_wrapper_classic.inc cause codecs and formats installed with FFmpeg now to show up in FFmpeg Wrapper.
Comment #39
arthurf commented@mhawker - do you mean that stripos() fixes the issue alone, or is the additional regex still necessary?
Comment #40
mhawker commentedI think additional regex would be needed so that stripos() ignores letter-case for FFmpeg in this particular instance.
EDIT after reading below post:
I had to lookup regex to know what you were asking me so I'm probably the wrong person to ask. I just know when I changed
$endpos = strpos($formats, 'FFmpeg version');to
$endpos = strpos($formats, 'ffmpeg version');the formats showed up.
Comment #41
begun commentedI just tried out stripos() and it did the trick (see code below). I don't think there is a need to change the regex. I have run both ffmpeg -codecs and ffmpeg -formats from the command line and as far as I can see the output from the git version appears compatible with the regex patterns already in place.
Comment #42
arthurf commentedI've committed the above changes- please check to see if things are working.
Comment #43
mhawker commentedInstalled FFmpeg Wrapper 6.x-2.x-dev (2011-May-13) and my settings are back to the way they were without the changes to ffmpeg_wrapper_class.inc (from Begun's posts).
No formats are listed and the listed codecs all list Decode/Encode - No
ffmpeg version git-N-29577-gc402ce4-syslint, Copyright (c) 2000-2011 the FFmpeg developers built on May 3 2011 13:29:00 with gcc 4.1.2 20080704 (Red Hat 4.1.2-50)
Comment #44
jantoine commentedI am running into this same issue with the ffmpeg_wrapper module version 6.x-2.x-dev as of 2011-05-13 and ffmpeg version ffmpeg git-N-30811-gd8ee777. Below is the version string pulled from the ffmpeg_wrapper module.
The problem lies in the get_version function. It is currently matching my version with the pattern found on line 179 which is meant to check for releases. The pattern is not actually requiring that a version number be found as the "*" represents zero or more characters. I replaced the "*" with a "+" (one or more characters) and this seems to have fixed the error on the settings page. I am guessing this should be applied to all patterns.
Cheers,
Antoine
Comment #45
heavy_engineer commented^^ worked for me too. thanks.
Comment #46
arthurf commentedI moved the git check up in the version check- I think that should work before the more generic version gets run. Please let me know if this works for you
Comment #47
robmil29 commentedI am running into the same issue and tried what #44 suggested with no luck. Using the latest 6.x-2.x-dev as of 2011-06-20.
Comment #48
arthurf commented@robmil29 - can you put some debugging code into the version check function to see what version it's trying to give you?
Comment #49
robmil29 commentedHmm.. looks like its trying to give me ffmpeg version 0.4.9-pre1, build4736, under do we a release ? Thank you
Comment #50
mhawker commentedThe newest dev version recognizes and list everything correctly for me now - ffmpeg git-N-29577-gc402ce4-syslint
Comment #51
arthurf commented@robmil29
Can you try adding the following to pick up your version of ffmpeg?
Comment #52
virtuali1151 commentedI seem to be running into the same problem.. and I am using the latest dev 2 version as well... from the command line my version shows: FFmpeg version git-N-29059-g44a8b0d-syslint, From the UI it shows FFmpeg git-N-29059-g44a8b0d-syslint so this seems to be correct... but I am still not sure why it doesnt list the output formats etc... I have tried the above fixes to no avail...
Comment #53
arthurf commented@virtuali1151 try setting the return value in get_version to 29059 to see if this starts showing your formats.
Comment #54
virtuali1151 commentedYup.. that worked but I also had to change line 182 (if ($matches[1] >= 29240) ) to 29059 to get the output formats to show up... the video and audio codecs are now working as well....
cheers.
Comment #55
robmil29 commentedHey arthurf, your solution in #51 did the trick. Thank you for your help!
Comment #56
arthurf commentedOk so it sounds like the regex is still the issue.
Comment #57
arthurf commentedI just changed the regex for the git string- this is working for me switching between a cvs and git version. Also committed the fix to the 7.x branch.
Comment #58
SlayJay commentedI'm having this same problem, and the 2011-Jul-22 dev version just spins forever until php times out when I try to use it.
Not sure what info you need, ffmpeg wrapper lists my ffmpeg as:
ffmpeg version N-31627-g9c2651a, Copyright (c) 2000-2011 the FFmpeg developers built on Jul 23 2011 15:02:13 with gcc 4.6.1 configuration: --enable-gpl --enable-version3 --enable-memalign-hack --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib libavutil 51. 11. 0 / 51. 11. 0 libavcodec 53. 9. 0 / 53. 9. 0 libavformat 53. 6. 0 / 53. 6. 0 libavdevice 53. 2. 0 / 53. 2. 0 libavfilter 2. 27. 3 / 2. 27. 3 libswscale 2. 0. 0 / 2. 0. 0 libpostproc 51. 2. 0 / 51. 2. 0 Expected number for v but found: -vthis is the same version if I do ffmpeg -version... but it lists nothing available under codecs.
running ffmpeg -codecs manually shows lots of codecs with different combinations of D E A
Hope that helps.
Comment #59
arthurf commentedHrm, I would think that would be getting picked up in $ffmpeg->get_version(). Can you see if the regex that is there for git is not catching it?
Comment #60
SlayJay commented$pattern = "/ffmpeg version ([0-9.]*)/i"; catches it, but $matches[1] is blank.
$matches print_r is:
Array
(
[0] => ffmpeg version
[1] =>
)
Comment #61
SlayJay commentedI fixed the codec detection by adding the following code as the first pattern check. It's a modified version of post #51 but I added version in front of ffmpeg.
HOWEVER, when I go to actually use it under test convert file, I still have nothing show up under output format. It's a blank list. I've tried this with two different files.
code to at least fix the codec display page:
Comment #62
arthurf commentedTry changing the regex to: /ffmpeg version.*?([0-9.]*)/i
Comment #63
SlayJay commentedthat matches, but leaves the version # blank again like it was. And the output dropdown is still blank under test convert file.
Comment #64
arthurf commenteddid you go to admin/config/ffmpeg_wrapper? That will reset the cache of the codecs
Comment #65
SlayJay commentedYes, and I just did it again to make sure.
Output drop down remains blank.
(attached a screen shot if that helps any)
Comment #66
SlayJay commentedOk, one step closer:
under function get_formats() you have the lines:
for this version at least, FFmpeg is all lower case. Changing this to
Populates the drop down box. HOWEVER it's still not working. Now when I try to use it, I get the error:
There were errors during the conversion!
There were errors during the conversion!
Errors found: The file could not be transcoded because the video codec is not supported
Comment #67
arthurf commentedTry replacing those with stripos?
Comment #68
SlayJay commentedThat fixes the populate the output box problem, but still getting the Errors found: The file could not be transcoded because the video codec is not supported error.
Comment #69
avatxus commentedHi endorn,
Were you able to make this work?
Comment #70
arthurf commented@endorn can you update to the latest dev version and let me know if that is working for you?
Comment #71
heavy_engineer commentedLatest dev version works fine for me with latest ffmpeg
ffmpeg version N-31809-g9acffed, Copyright (c) 2000-2011 the FFmpeg developers
Comment #72
naeluh commentedsub
Comment #73
naeluh commentedHi I am using the latest dev version
I installed updated and got this error -
How I can I fix this. thanks.
The wrapper still functions properly dspite this warning
I am using ffmpeg N-31981
Comment #74
torgospizzaYou can turn off warnings in your php settings. You can override that in settings.php if you like. Since it's just a warning it can be ignored, but variable_get is being used incorrectly in that module - it always needs the 2nd argument which is the default if variable_get() returns with nothing. http://api.drupal.org/api/drupal/includes--bootstrap.inc/function/variab...
Comment #75
osopolarThe issue to the warning in #73 is this: #1202902: Add integration with ffmpeg_converter
Comment #76
bnordgren commentedHey guys, hate to beat a dead horse, but I think ffmpeg changed things again. As of 35110 (possibly earlier), the only thing going to stdout from an "ffmpeg -formats" command is the list of formats. Trying to find $endpos and trim the output down actually fails (e.g., no output to process).
I modified the get_formats function as follows:
Also, I had to add #51 myself. (I'm using 7.x-1.0alpha2) Was it supposed to be committed already?
Finally, I think the get_file_info function may be broken too. The test file conversion in the admin menu is not listing any information on the source file. I'm attaching the output from this as well. Note that there is nothing at all going to stdout. I had to copy from stderr to capture something in my file...Would this perhaps be merit a separate issue?
Comment #77
molenick commentedIt looks like this is still an issue with the 7.x-1.x-dev verison released yesterday. Since this seems to be a reocurring issue, may I suggest putting a drupal_set_warning in get_version() if no version is found? This will at least notify users that something is wrong and will hopefully shortcut the troubleshooting process.
Comment #78
iva2k commentedThis issue will most likely be an ongoing chase, as ffmpeg seems to be changing its interface all the time.
I just pulled the latest version from ffmpeg git, and found that everything is broken again by a couple of drastic interface changes:
ffmpeg -codecsnow returns a list of supported media stream formats. Here's a snipped from the manpage:ffmpeg -encoderscommand, which shows available encoders. But it's output also differs from old -codecs command (dots used and different meaning of letters, legend up at the top).I'm doing a patch, but what I need to finish it is a version number when these changes happened (so the "if" statements can be precise). Can anyone post the cutoff version numbers or point to the place where it can be found?
Comment #79
iva2k commentedI filed a separate issue #1933740: Support for latest ffmpeg (git version 50450) to track that latest ffmpeg Git head.