Play video file with broken AVI index on iOS using MobileVLCKit

iOS, iPad, iPhone, tvOS specific usage questions
danylokostyshyn
New Cone
New Cone
Posts: 4
Joined: 05 Mar 2015 23:11

Play video file with broken AVI index on iOS using MobileVLCKit

Postby danylokostyshyn » 05 Mar 2015 23:19

Hello guys, I'm working on a video streaming app for iOS, and I faced up with a problem - the app should be able to play partially downloaded videos. I can't stream video directly from a server because there is no server, videos are downloaded using P2P network. Download starts from the beginning of the file and after about 20% I want to be able to play the file.

Currently I'm trying to use MobileVLCKit. When I try to play a partially downloaded file (about 30%) using VLC player on my Mac, VLC tells me: "Broken or missing AVI Index" and offers to "Play as is" or "Build index and than play", when I choose "Play as is" video starts playing, but on iOS when I try to play the same video I get BAD_ACCESS when MobileVLCKit invoke AVI_IndexCreate. Is there a way to force MobileVLCKit to play video "as is" with a broken index, or maybe there are some other options how I can to this? Thanks a lot.

Here are console output and backtrace:

Code: Select all

[1389:617849] creating player instance using shared library [1759f504] core generic error: option marq-color does not exist [1759f504] core generic error: option marq-opacity does not exist [1759f504] core generic error: option marq-position does not exist [1759f504] core generic error: option marq-refresh does not exist [1759f504] core generic error: option marq-size does not exist [1759f504] core generic error: option marq-timeout does not exist [1759f504] core generic error: option marq-x does not exist [1759f504] core generic error: option marq-y does not exist [176f8264] avi demux error: no key frame set for track 0 [176f8264] avi demux error: no key frame set for track 1

Code: Select all

(lldb) bt * thread #8: tid = 0x976f9, 0x20000000, stop reason = EXC_BAD_ACCESS (code=1, address=0x20000000) frame #0: 0x20000000 * frame #1: 0x00675d72 testApp'Open [inlined] AVI_IndexCreate + 542 at avi.c:2407 frame #2: 0x00675b54 testApp'Open(p_this=<unavailable>) + 5228 at avi.c:631 frame #3: 0x0065111e testApp'vlc_module_load [inlined] module_load(obj=<unavailable>, init=<unavailable>, args=0x04d29d94, args=0x04d29d94, args=<unavailable>) + 814 at modules.c:185 frame #4: 0x00651100 testApp'vlc_module_load(obj=0x155f7654, capability=0x008fdd2e, name=<unavailable>, strict=false, probe=<unavailable>) + 784 at modules.c:277 frame #5: 0x0065129a testApp'module_need(obj=<unavailable>, cap=<unavailable>, name=<unavailable>, strict=<unavailable>) + 30 at modules.c:366 frame #6: 0x0062ae9a testApp'demux_New + 734 frame #7: 0x00634a4c testApp'InputSourceInit + 2624 frame #8: 0x00631e74 testApp'Init + 580 frame #9: 0x00633c7a testApp'Run + 18 frame #10: 0x35542e92 libsystem_pthread.dylib'_pthread_body + 138 frame #11: 0x35542e06 libsystem_pthread.dylib'_pthread_start + 118

fkuehne
Developer
Developer
Posts: 7264
Joined: 16 Mar 2004 19:37
VLC version: 0.4.6 - present
Operating System: Darwin
Location: Germany
Contact:

Re: Play video file with broken AVI index on iOS using MobileVLCKit

Postby fkuehne » 06 Mar 2015 12:09

Is this MobileVLCKit from cocoapods or a custom build?
VideoLAN
Felix Paul Kühne
Medic. VLC developer for appleOS since before you were born.
Blog: https://www.feepk.net

danylokostyshyn
New Cone
New Cone
Posts: 4
Joined: 05 Mar 2015 23:11

Re: Play video file with broken AVI index on iOS using MobileVLCKit

Postby danylokostyshyn » 06 Mar 2015 13:40

Sorry, forgot to mention. I've tried both. First one was the latest version of MobileVLCKit available through CocoaPods. In the podspec it is marked as version 2.2.1, but it uses the sources from here http://download.videolan.org/pub/videol ... binary.zip, so I don't know which version number is correct. And also I tried to build it myself from the latest sources (main branch, last commit from 2015-02-18). In both cases I got the same error.

The video file, which i'm testing on, use "MPEG-4 Video (XVID)" codec.

fkuehne
Developer
Developer
Posts: 7264
Joined: 16 Mar 2004 19:37
VLC version: 0.4.6 - present
Operating System: Darwin
Location: Germany
Contact:

Re: Play video file with broken AVI index on iOS using MobileVLCKit

Postby fkuehne » 06 Mar 2015 15:01

Please give your code for VLCLibrary or VLCMediaPlayer initialization as well as your VLCMedia creation. You might be using an unsupported option.
VideoLAN
Felix Paul Kühne
Medic. VLC developer for appleOS since before you were born.
Blog: https://www.feepk.net

danylokostyshyn
New Cone
New Cone
Posts: 4
Joined: 05 Mar 2015 23:11

Re: Play video file with broken AVI index on iOS using MobileVLCKit

Postby danylokostyshyn » 06 Mar 2015 15:24

I didn't write any initialization code myself, i tried to use "Dropin-Player" from examples, and just passed the file URL into it, like this:

Code: Select all

VDLPlaybackViewController *controller = [[VDLPlaybackViewController alloc] initWithNibName:@"VDLPlaybackViewController" bundle:nil]; [self.navigationController presentViewController:controller animated:YES completion:nil]; [controller playMediaFromURL:videoFileURL];
I can't find any specific options in VDLPlaybackViewController, when VLCMediaPlayer initialization occurs, just regular alloc/init with no additional setup:

Code: Select all

_mediaplayer = [[VLCMediaPlayer alloc] init]; _mediaplayer.delegate = self; _mediaplayer.drawable = self.movieView;
i know that this might be an issue, because method like - (instancetype)initWithOptions:(NSArray *)options; exist, but i wasn't able to find any documentation which options are available.

danylokostyshyn
New Cone
New Cone
Posts: 4
Joined: 05 Mar 2015 23:11

Re: Play video file with broken AVI index on iOS using MobileVLCKit

Postby danylokostyshyn » 06 Mar 2015 16:20

Found it, i just need to pass "--avi-index=2", 3-is default ({0 (Ask for action), 1 (Always fix), 2 (Never fix), 3 (Fix when necessary)} as an option, and it works! Many thanks! :)

fkuehne
Developer
Developer
Posts: 7264
Joined: 16 Mar 2004 19:37
VLC version: 0.4.6 - present
Operating System: Darwin
Location: Germany
Contact:

Re: Play video file with broken AVI index on iOS using MobileVLCKit

Postby fkuehne » 06 Mar 2015 20:01

yes, that's the workaround, but it shouldn't crash without that option ;)
VideoLAN
Felix Paul Kühne
Medic. VLC developer for appleOS since before you were born.
Blog: https://www.feepk.net


Return to “VLC for iOS, iPadOS and Apple TV”

Who is online

Users browsing this forum: No registered users and 18 guests