Author Topic: FLV files larger than 4GB do not open with the correct duration  (Read 3835 times)

rcdrone

  • Newbie
  • *
  • Posts: 8
FLV files larger than 4GB do not open with the correct duration
« on: January 19, 2017, 07:42:29 AM »
I have a bunch of FLV recordings from OBS, and the ones over 4GB only load partially, like the file size might be getting 64-bit -> 32-bit truncated or something. I tried the 2.6.18 64-bit GUI programs for both Windows and Linux, and they both have the same problem.

I also tried following the VS 2015 build instructions at http://avidemux.org/smif/index.php/topic,17302.0.html to see if I could debug it myself, but I got stuck not knowing where to get msys64 (is it msys2?), or where to get the files for the mingw skeleton. I tried to hack my way through stuff and was able to build ffmpeg, but then avidemux_core complained about a missing pthread.h, and I gave up.

Jan Gruuthuse

  • Hero Member
  • *****
  • Posts: 6060
Re: FLV files larger than 4GB do not open with the correct duration
« Reply #1 on: January 19, 2017, 07:55:35 AM »
If your storage is FAT32: that is a problem: max file size is 4GB. Windows: NTFS should be fine?

rcdrone

  • Newbie
  • *
  • Posts: 8
Re: FLV files larger than 4GB do not open with the correct duration
« Reply #2 on: January 19, 2017, 03:54:41 PM »
All my Windows drives are NTFS, and my Linux drive is ext4.

Jan Gruuthuse

  • Hero Member
  • *****
  • Posts: 6060
Re: FLV files larger than 4GB do not open with the correct duration
« Reply #3 on: January 19, 2017, 04:53:15 PM »
try mkvtoolnix and remux to mkv, load the newly created mkv into avidemux.
MKVToolNix – Matroska tools for Linux/Unix and Windows

rcdrone

  • Newbie
  • *
  • Posts: 8
Re: FLV files larger than 4GB do not open with the correct duration
« Reply #4 on: January 19, 2017, 05:47:34 PM »
I took a 7.51 GB FLV and converted it with mkvtoolnix to a 5.83 GB MKV (don't know why it got smaller). The FLV loads incorrectly into avidemux as being 3h 8m, but the MKV loads correctly as 6h 42m. So it seems the 4GB+ problem is specific to FLV files.

Jan Gruuthuse

  • Hero Member
  • *****
  • Posts: 6060
Re: FLV files larger than 4GB do not open with the correct duration
« Reply #5 on: January 20, 2017, 05:49:03 AM »
OBS recordings from your desktop or some other source. (DVB, Game console, ...) Could be anything. You do run latest OBS recording software?

rcdrone

  • Newbie
  • *
  • Posts: 8
Re: FLV files larger than 4GB do not open with the correct duration
« Reply #6 on: January 20, 2017, 06:02:30 AM »
I always upgrade OBS Studio when it nags. Are other programs creating FLV files larger than 4GB that avidemux is able to load correctly? VLC correctly handles all my FLV files.

Jan Gruuthuse

  • Hero Member
  • *****
  • Posts: 6060
Re: FLV files larger than 4GB do not open with the correct duration
« Reply #7 on: January 20, 2017, 06:10:26 AM »
Did not come across any mentioning of 4GB and FLV issues. As said before could be anything.

rcdrone

  • Newbie
  • *
  • Posts: 8
Re: FLV files larger than 4GB do not open with the correct duration
« Reply #8 on: January 20, 2017, 08:51:33 PM »
I feel like this should be relatively simple to debug if I could get a little bit better build instructions for Windows. I can build fine on Linux (Ubuntu 16.04), but I'm not really proficient with that platform, and don't want to go through a lot of trial and error to find a competent C++ debugger, and attempt to configure it for this project.

Jan Gruuthuse

  • Hero Member
  • *****
  • Posts: 6060
Re: FLV files larger than 4GB do not open with the correct duration
« Reply #9 on: January 20, 2017, 10:25:16 PM »
Perhaps here: https://msys2.github.io/ ? If you have further issues with building perhaps start a new thread.

rcdrone

  • Newbie
  • *
  • Posts: 8
Re: FLV files larger than 4GB do not open with the correct duration
« Reply #10 on: January 22, 2017, 02:25:42 PM »
I just did some printf debugging with a Linux build, and got large FLVs working by fixing up the FLV demuxer code. There's several spots where a 32-bit size is used rather than a 64-bit type, or perhaps off_t, The plugin also ignores the TimestampExtended field of FLV tags, which causes timestamps larger than 24 bits to be truncated. It would be nice to have all this fixed going forward.

eumagga0x2a

  • Moderator
  • Hero Member
  • *****
  • Posts: 2893
Re: FLV files larger than 4GB do not open with the correct duration
« Reply #11 on: January 22, 2017, 03:09:43 PM »
It would be lovely if you submit a patch.

rcdrone

  • Newbie
  • *
  • Posts: 8
Re: FLV files larger than 4GB do not open with the correct duration
« Reply #12 on: January 22, 2017, 05:01:05 PM »
Thread has been started in the Patch gallery forum: http://avidemux.org/smif/index.php/topic,17438.0.html

I based the patch on the master branch of mean00/avidemux2 using git format-patch. I hope that's what you guys are expecting. Let me know if you have any questions.

fofu01

  • Newbie
  • *
  • Posts: 8
Re: FLV files larger than 4GB do not open with the correct duration
« Reply #13 on: February 01, 2017, 10:43:31 PM »
How do  you apply that patch to avidemux? And has anyone tried it?

eumagga0x2a

  • Moderator
  • Hero Member
  • *****
  • Posts: 2893
Re: FLV files larger than 4GB do not open with the correct duration
« Reply #14 on: February 02, 2017, 07:53:04 AM »
The patch in question has been included into Avidemux on Jan 22. However, there haven't been any nightly builds for Windows since Jan 19.

You could read up about how to use patch here and about git-apply here, or go straight to the minimum of the information required for patching Avidemux here. This assumes that you build Avidemux from source yourself, which is quite easy on Linux. Windows builds are generated on Linux too!

While Avidemux builds I use locally include this commit, I don't have FLV videos long enough to verify myself that the issue is fixed, but logically it should (and it works for the author of the patch).