Home/News | About | Download | Documentation | Forum | Bug Reports | Contact | Donations | Consulting | Projects | Legal | Security | FATE

This forum has not been maintained for a long time and will probably get deleted in the near future.
For faster responses to your questions, please use StackOverflow instead and tag your questions with "FFmpeg".
If you need a backup of the posts from this forum, please contact me directly.

FFmpeg file IO issues on iOS

Who doesn't love them :) But for faster response on your Bug Reports, please visit: http://www.ffmpeg.org/bugreports.html
Forum rules
First of all, please remember that all the developers working on FFmpeg are volunteers, we are not paid for analyzing, debugging, fixing and answering bug reports. While we try our best to create high quality software and be responsive, if you should not get an answer, please consider the above and be aware of the fact that we receive many bug reports and the amount of time it takes to deal with them can be substantial. Nevertheless most issues get resolved, just please understand that there are no guarantees nor promises.

FFmpeg file IO issues on iOS

Postby ebeis051 » Fri Jan 27, 2017 1:16 am

I have an application that leverages FFmpeg libraries to play video. It works on every platform except iOS, where I experience a strange file IO issue that I cannot figure out.

I am able to stream two videos successfully, but on the third attempt to stream the calls to av_read_frame() fail and the AVIOContext shows error 9, E_BADF. To investigate, I added some logging messages to try to see where the error originated and I found that the error was coming from the read() call inside the file_read() function in libavformat/file.c.

I then looked into how the files were being opened and I found that on the third run, the open() call (inside avpriv_open() in libavutil/file_open.c) was returning 0 as the file descriptor, whereas the first two were returning more normal positive values. The attempts to read from this file descriptor proceeded to fail indefinitely. The 0 file descriptor is usually reserved for stdin, and I am confident my application is not closing stdin at any point. Having open() return 0 as the file descriptor isn't inherently wrong, but in this case it results in a read failure every time. Weirdly, I am able to work around this by artificially using up 0 in the table by opening something but not operating on it, and then restarting the open process to get back to a positive value. When I do this, my videos are able to play again.

I can't say for sure yet if this is a problem in FFmpeg or the operating system, but I am unable to reproduce this issue in a simple program that doesn't use FFmpeg, nor does it occur on any other platform as I mentioned above. I have also tried many different versions of the FFmpeg source running on iOS versions 9 and 10 and they all demonstrate the issue. I realize iOS is not a high runner platform for FFmpeg use, but I am wondering if anyone has attempted to build and use FFmpeg for iOS and recognizes any of these issues. Any pointers in the right direction would be greatly appreciated.
Posts: 1
Joined: Fri Jan 27, 2017 12:29 am

Re: FFmpeg file IO issues on iOS

Postby mulvya » Sat Jan 28, 2017 6:03 am

You should post this on the ffmpeg-user mailing list or ffmpeg IRC.

See https://ffmpeg.org/contact.html
Posts: 570
Joined: Mon Oct 26, 2015 6:58 am

Re: FFmpeg file IO issues on iOS

Postby llogan » Sat Jan 28, 2017 8:21 am

If you're using the libraries then libav-user is the proper mailing list.
Get an answer more quickly by providing your actual ffmpeg command and the complete console output. Use the code button to format your command and output or your question will be ignored.
Posts: 2363
Joined: Fri Jan 25, 2013 9:47 pm
Location: Alaska

Return to Bugs, bugs, bugs :)

Who is online

Users browsing this forum: No registered users and 1 guest