Project

General

Profile

Bug #1382

Incorrect Video Length

Added by ming over 7 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
05/26/2014
Due date:
% Done:

0%


Description

Sometimes, probably for AVI files, LibVLC returns 0 for the LibVLC#getLength() method. "The native call":(http://git.videolan.org/?p=vlc-ports/android.git;a=blob;f=vlc-android/jni/libvlcjni.c;h=5a8464ad4fd920637648a1f5d13bbc0a5a0cc098;hb=HEAD#l514) seems to be pretty trivial and I don’t see an error. The same videos work fine using the iOS version. The official VLC app shows zero length as well.

bgm.patch View (801 Bytes) megabitdragon, 05/30/2014 05:43 PM

History

#1 Updated by ming over 7 years ago

Just sent a report to the address mentioned here because Trac doesn’t allow me to register.

#2 Updated by ming over 7 years ago

The bug seems to be the same for Windows VLC version. I can confirm that VLC for Mac 2.1.4 shows zero length as well.

#3 Updated by megabitdragon over 7 years ago

It must be something with the avi container. I re-encoded the movies with different codecs and no luck. Length is still 0.

#4 Updated by megabitdragon over 7 years ago

I played with the vlc source code and I think I found a "hack" for the 0 length issue. In the avi demux module in the file demux/avi/libavi.c I replaced both occurrences of STREAM_CAN_FASTSEEK with STREAM_CAN_SEEK. According to bug 1532 ( https://trac.videolan.org/vlc/ticket/1532 ), when using FASTSEEK idx1 is not read form the AVI header. These changes forces the use of SEEK just for the header. I only tested on linux version of VLC and the length is correct and the scrolling works as well. Next step ... build android VLClib and testing it in the amahi app :).

#5 Updated by ming over 7 years ago

Great job here! But I’m confused a bit. I read this comment at the bug and it opposes to what you said :-?

#6 Updated by megabitdragon over 7 years ago

You are right. When !FASTSEEK, which is the case for http streams, idx1 is not read. The changes I made enables reading of idx1 for normal seek (the one for the http stream). I am not saying this is the best or even the correct solution but it seems to do the job.

#7 Updated by ming over 7 years ago

All right, thanks for the explanation. Can we have some patch file so I can apply it during the build?

#8 Updated by megabitdragon over 7 years ago

Here is the patch file. This goes in the vlc core not the vlc-android.

#9 Updated by ming over 7 years ago

I built it. Have you noticed any increased delay while loading a video? Especially using the remote mode.

#10 Updated by megabitdragon over 7 years ago

Now that you mention it, it seems like it does. In a way it makes sense since it has to read the additional index.

#11 Updated by ming over 7 years ago

That’s why I’m not sure should we include this or not. I see no real difference using the local address, but not sure about the remote one. I already have a not pleasant delay for loading remote videos, so probably you are the judge here. Is it really critical or length is more important than that?

#12 Updated by megabitdragon over 7 years ago

I will look into this. Maybe there is a way to just read the length not the whole index. Let's keep it like this for now. It should only affect avi movies.

#13 Updated by ming over 7 years ago

We definitely don’t want any real hacks, so your solution is the best one :-) If you see no real difference before and after—I would say use your patch and be happy.

#14 Updated by ming over 7 years ago

I added your patch to the repository. It should be applied automatically. There is a proper LibVLC versioning support as well using their Git tags.

#15 Updated by ming over 7 years ago

  • Status changed from New to Feedback
  • Assignee set to megabitdragon

#16 Updated by megabitdragon over 7 years ago

  • Status changed from Feedback to Closed

I'll close this for now but we might reopen it if loading avi will be too slow.

Also available in: Atom