New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sample code, "Invalid data found when processing input" and av_register_all #43
Comments
What version of FFmpeg are you using?
…On Fri, Aug 21, 2020 at 4:34 AM Pierre Marandon ***@***.***> wrote:
Hello,
I am now trying SwiftFFmpeg as a replacement for VLCkit. I am at the very
beginning of the integration, so I just integrated the sample code from
README.md.
It gave me an "Invalid data found when processing input" error on the very
first line (try AVFormatContext(url: input)), for any video file
(correctly played with ffplay).
After some difficult research, if found this tutorial :
http://dranger.com/ffmpeg/tutorial01.html <http://url>, which gave me the
solution : av_register_all() should be called before any operation.
So I made this :
import CFFmpeg
class FfmpegUtils
{
static func registerAll()
{av_register_all()}
}
and then
//...
FfmpegUtils.registerAll()
let fmtCtx = try AVFormatContext(url: url.relativePath)
//...
which makes the sample code work.
However, av_register_all() triggers a deprecation warning, as FF_API_NEXT
is defined :
In avformat.h :
#if FF_API_NEXT
/**
* Initialize libavformat and register all the muxers, demuxers and
* protocols. If you do not call this function, then you can select
* exactly which formats you want to support.
*
* @see av_register_input_format()
* @see av_register_output_format()
*/
attribute_deprecated
void av_register_all(void);
attribute_deprecated
void av_register_input_format(AVInputFormat *format);
attribute_deprecated
void av_register_output_format(AVOutputFormat *format);
#endif
What is the correct way to do this ? Should the sample code or the lib be
corrected to work right away ?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#43>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHBWNVISKHU6MCEL7Z7K4LSBZLTRANCNFSM4QHGCWHA>
.
|
Version 4.3.1, freshly installed with homebrew yesterday.
|
Just to verify, your initialized your URL using URL(fileURLWithPath:"/The/Path/To/File.mov") and your application either is security scoped to access the file or has sandboxing disabled, correct? |
|
My only thought then is that you might actually have an old FFmpeg/libav install hanging around and your app is weak linking to that instead of your homebrew FFmpeg. av_unregister_all doesn't do anything for FFmpeg >= 4.0 |
I did not find any other ffmpeg executable on my computer. Is there any way to know the ffmpeg version or location used through SwiftFFmpeg code ? |
|
I got this : git-2020-05-06-106e390490, but I can't find this commit in the official repository... I also got the versions of the libraries : |
OK,I will take a look tomorrow. |
The 4.3.1 version info should be: Your pkg-config search result should be:
|
Well then, I translated the version I got from code to this :
which is definitely different from the As for |
I used any way I know to search in my computer, and could not find any ffmpeg or avutil.h file, except those from the homebrew install. |
I would run |
brew install ffmpeg
Updating Homebrew...
==> Downloading https://homebrew.bintray.com/bottles/ffmpeg-4.3.1.catalina.bottle.tar.gz
Already downloaded: /Users/pierre/Library/Caches/Homebrew/downloads/ea107a64fe9dff2f0ccb5ca4550e503fb01516b943ed86ce51f1cd04766a902c--ffmpeg-4.3.1.catalina.bottle.tar.gz
==> Pouring ffmpeg-4.3.1.catalina.bottle.tar.gz
🍺 /usr/local/Cellar/ffmpeg/4.3.1: 299 files, 60MB and we are back to the original situation. Also, before doing all of this, I noticed that ffmpeg version has been increased to
However, I do not know what did this. Maybe a Anyway, even after this update, removing |
Can you use otool to see which libraries your executable are linked to?
|
Exactly the command we were looking for ! Well, it seems to be linked to the last version...
|
Can you drop the VLCKit.framework and try again? I remember it integrated FFmpeg. |
Yep. This is a success !
I could also, as planned, remove the I am really disappointed I could not find this phantom instance of ffmpeg inside VLCkit despite all the efforts I made to locate it. The difficulty was increased due to the fact that during development, the IDE pointed to the version 4.3.1 headers... Anyway, thank you very much for all your help, and I can then happily close this issue, that is not due to SwiftFFmpeg. |
Hello,
I am now trying SwiftFFmpeg as a replacement for VLCkit. I am at the very beginning of the integration, so I just integrated the sample code from README.md.
It gave me an "Invalid data found when processing input" error on the very first line (
try AVFormatContext(url: input)
), for any video file (correctly played with ffplay).After some difficult research, if found this tutorial : http://dranger.com/ffmpeg/tutorial01.html, which gave me the solution :
av_register_all()
should be called before any operation.So I made this :
and then
which makes the sample code work.
However,
av_register_all()
triggers a deprecation warning, asFF_API_NEXT
is defined :In avformat.h :
What is the correct way to do this ? Should the sample code or the lib be corrected to work right away ?
The text was updated successfully, but these errors were encountered: