[FAQ] Working with large videos on Android

All threads that are outdated (e. g. problem with an older version that was replaced by a new one) are moved here.
User avatar
Harry
Site Admin
Site Admin
Posts: 8944
Joined: Sun Sep 12, 2010 10:32 am
Location: Siegum, Germany
Has thanked: 98 times
Been thanked: 369 times
Contact:

[FAQ] Working with large videos on Android

Postby Harry » Thu Jun 12, 2014 10:42 am

[THIS ARTICLE IS OUTDATED, THE 2GB LIMIT FOR ANDROID HAS BEEN FIXED IN LAPTIMER 19]

Due to a limitation in the video library used for overlaying, both raw and overlaid videos must not exceed a size of approximately 2 GB on Android. Although I work on this issue for quite some time already, I could not work around this limitation so far. It is possible to record and handle videos larger than 2 GB, but once you start applying an overlay, you will run into issues.

Recording video
A size of 2 GB roughly means 11 minutes for FullHD videos and 25 minutes for HD videos. This means recording a single video lap will mostly not be a problem. Opposed to this, full session recordings will mostly exceed this limit for FullHD and sometimes for HD.

Workaround: I strongly recommend to use HD in general. This is both beneficial for the size needed and for overlay processing times. LapTimer comes with a standard video resolution setting of "HD". Changing it to "FullHD" in Video View will bring up an additional warning. As a more general recommendation, please consider limiting video recording to dedicated video sessions only and use lap timing / data recording for standard operation.

What to do if the video exceeds 2GB?
As LapTimer does not limit the video size to 2 GB when recording, you may run into situations you find your video to show a size bigger than 2 GB (and get an error message when overlaying). As long as the limitation is not fixed, there is actually only one option to work around: reduce video size "after the fact".

Work around:
To work around, you actually create a smaller version of the video (options below). For the remainder of this post I assume you have your video stored on an external SD card - which makes it accessible on your desktop. In case your smartphone comes with an "internal / emulated" SD card, access differs by manufacturer and is typically supported by some proprietary tools. Furthermore, we assume the (big) video's filename is LapTimer-XXXXXXXX-XXXXXX.mp4. Directory / folder names are omitted in the samples but may need to be added depending on your storage scheme (both SD card and desktop).

  1. Reduce video resolution by converting it to HD: the following command transforms the original video to HD size, sets a standard quality, qualifies the audio stream to be copied and stores the result in a file with postfix "-HD". As the video frames are decoded, resized, and encoded again, this command will require some time to complete.

    Code: Select all

    ffmpeg -i LapTimer-XXXXXXXX-XXXXXX.mp4 -s hd720 -c:v libx264 -crf 23 -c:a copy LapTimer-XXXXXXXX-XXXXXX-HD.mp4
  2. Remove footage from the end of the video: the following command cuts the video length to 4 minutes and stores the result in a file with postfix "-4mins". This command is executed very fast and will not loss quality due to decoding / encoding cycles. This approach will certainly not allow you to overlay laps in the scope cut off. Choosing 4 minutes is a sample and needs to be selected as appropriate.

    Code: Select all

    ffmpeg -i LapTimer-XXXXXXXX-XXXXXX.mp4 -t 00:04:00 -c copy LapTimer-XXXXXXXX-XXXXXX-4mins.mp4
    Please note that removing footage from the beginning is possible too, but will void all time offsets in LapTimer's data recordings. This in turn requires you to re-sync all laps manually.

Once the video with reduced size is created, it needs to be transferred back to the SD card and the smartphone. There are two options again:

  1. Copy the changed file using the original file name: this will overwrite the original video but keep the relation between lap data recordings and the video. Once the SD card is entered again, LapTimer should see the updated video immediately and the overlay can be started. It is certainly possible (and recommended) to store a copy of the original file on the desktop for later use.
  2. Copy the changed file using the new name (i.e. with "-HD" etc postfix) to the same folder the original video is stored in: once back in LapTimer, the laps will still reference the big video. To re-link the laps to the new (smaller) video, in Lap List / Lap Details, tap the video preview row first. This will bring you to the (big) video's "Video Details". Press the "+Video" button in the top right of the screen and select the new video from the list. This will re-link all lap references going to LapTimer-XXXXXXXX-XXXXXX.mp4 so far to use LapTimer-XXXXXXXX-XXXXXX-HD.mp4 (or -4mins) now.

In the work arounds shown above a free command line tool named "ffmpeg" is used. You can download it for any platform from the net. In case you are not familiar with using command line tools, please search the Internet for "Handbrake" - which is a GUI front end for ffmpeg and probably easier to use.

- Harry


Image Image Image Image
User avatar
Harry
Site Admin
Site Admin
Posts: 8944
Joined: Sun Sep 12, 2010 10:32 am
Location: Siegum, Germany
Has thanked: 98 times
Been thanked: 369 times
Contact:

Re: [FAQ] Working with large videos on Android

Postby Harry » Mon Jul 14, 2014 8:50 am

Hi Harry, my original raw video file is over 2GB. Used Windows Movie Maker to trim the video down to 600MB (22 mins of track recording). However, the Android phone reads the new file only as 38 seconds (even though it keeps playing to the end for a full 22 mins!). All video players on the phone show the video length of "38 seconds"but play till the 22nd min. PLEASE HELP!

Harry, I have read your post. Where do I put in the code "ffmpeg -i LapTimer-XXXXXXXX-XXXXXX.mp4 -t 00:04:00 -c copy LapTimer-XXXXXXXX-XXXXXX-4mins.mp4"? How do I do that in Windows or Android?

What app or software do I need to download? Could you please paste the links here? Thanks!


The commands listed are "Terminal commands", which means you enter them at a command line prompt in Windows/MaxOSX/Linux. In case you are not comfortable using a command line, please use Handbrake instead.

Sources for ffmpeg and Handbrake can be found using Google:

http://handbrake.fr/downloads.php
https://www.ffmpeg.org/download.html

- Harry


Image Image Image Image
JonathanM
10 or more Posts ★
10 or more Posts ★
Posts: 11
Joined: Sun Aug 03, 2014 12:25 pm
Has thanked: 1 time
Been thanked: 1 time

Re: [FAQ] Working with large videos on Android

Postby JonathanM » Sun Aug 03, 2014 12:55 pm

The command line arguments seem to have changed slightly (with ffmpeg).

Created the following .sh to trim the files down to 15m (which I find is always just under the 2G limit)

Code: Select all

#!/bin/bash
/usr/bin/ffmpeg -i "$1" -t 00:15:00 -dcodec copy -vcodec copy -acodec copy "15m-$1"


toehead93
Fewer than 10 Posts
Fewer than 10 Posts
Posts: 1
Joined: Mon Sep 29, 2014 9:20 pm

Re: [FAQ] Working with large videos on Android

Postby toehead93 » Mon Sep 29, 2014 9:26 pm

I am having this problem and a little nervous about using the outside software to resize the video but I will try this weekend (moving so might not have time). Will this also fix another problem I have, it looks like the video and data recorded my session at Sebring club course as one long lap so I cannot view lap details, not even lap times so I have no idea what my best lap was. I know the video and data need to overlay so I can see all the OBDII data and video synced but will that also allow me to see individual lap information?


User avatar
Harry
Site Admin
Site Admin
Posts: 8944
Joined: Sun Sep 12, 2010 10:32 am
Location: Siegum, Germany
Has thanked: 98 times
Been thanked: 369 times
Contact:

Re: [FAQ] Working with large videos on Android

Postby Harry » Tue Sep 30, 2014 11:42 am

On the second item (we are off topic on this thread, so in case a further ping/pong is needed, open a separate thread please): in case you see one long session, LapTimer couldn't detect individual laps (missing track sets or bad GPS reception). In case LapTimer started recording automatically, you had most probably no good GPS reception. It is easy to test this by watching the "multi lap" in LapTimer's Data Recordings screens (Lap List -> multi-lap -> Data Recording -> Preview. In case you started LapTimer manually using the red video button in Video View, you had probably no track set loaded. If this is the case, load the track from Add-ons now and select "Recalculate" from the multi-lap's details dialog. Select "Validate Lap" to let LapTimer split it into laps "after the fact".

- Harry


Image Image Image Image
djw_djw
Fewer than 10 Posts
Fewer than 10 Posts
Posts: 9
Joined: Sat Nov 15, 2014 1:24 pm
Has thanked: 1 time

Re: [FAQ] Working with large videos on Android

Postby djw_djw » Wed Dec 10, 2014 3:57 pm

Harry wrote:Due to a limitation in the video library used for overlaying, both raw and overlaid videos must not exceed a size of approximately 2 GB on Android. Although I work on this issue for quite some time already, I could not work around this limitation so far. It is possible to record and handle videos larger than 2 GB, but once you start applying an overlay, you will run into issues.

Recording video
A size of 2 GB roughly means 11 minutes for FullHD videos and 25 minutes for HD videos. This means recording a single video lap will mostly not be a problem. Opposed to this, full session recordings will mostly exceed this limit for FullHD and sometimes for HD.

Workaround: I strongly recommend to use HD in general. This is both beneficial for the size needed and for overlay processing times. LapTimer comes with a standard video resolution setting of "HD". Changing it to "FullHD" in Video View will bring up an additional warning. As a more general recommendation, please consider limiting video recording to dedicated video sessions only and use lap timing / data recording for standard operation.

What to do if the video exceeds 2GB?
As LapTimer does not limit the video size to 2 GB when recording, you may run into situations you find your video to show a size bigger than 2 GB (and get an error message when overlaying). As long as the limitation is not fixed, there is actually only one option to work around: reduce video size "after the fact".

Work around:
To work around, you actually create a smaller version of the video (options below). For the remainder of this post I assume you have your video stored on an external SD card - which makes it accessible on your desktop. In case your smartphone comes with an "internal / emulated" SD card, access differs by manufacturer and is typically supported by some proprietary tools. Furthermore, we assume the (big) video's filename is LapTimer-XXXXXXXX-XXXXXX.mp4. Directory / folder names are omitted in the samples but may need to be added depending on your storage scheme (both SD card and desktop).

  1. Reduce video resolution by converting it to HD: the following command transforms the original video to HD size, sets a standard quality, qualifies the audio stream to be copied and stores the result in a file with postfix "-HD". As the video frames are decoded, resized, and encoded again, this command will require some time to complete.

    Code: Select all

    ffmpeg -i LapTimer-XXXXXXXX-XXXXXX.mp4 -s hd720 -c:v libx264 -crf 23 -c:a copy LapTimer-XXXXXXXX-XXXXXX-HD.mp4
  2. Remove footage from the end of the video: the following command cuts the video length to 4 minutes and stores the result in a file with postfix "-4mins". This command is executed very fast and will not loss quality due to decoding / encoding cycles. This approach will certainly not allow you to overlay laps in the scope cut off. Choosing 4 minutes is a sample and needs to be selected as appropriate.

    Code: Select all

    ffmpeg -i LapTimer-XXXXXXXX-XXXXXX.mp4 -t 00:04:00 -c copy LapTimer-XXXXXXXX-XXXXXX-4mins.mp4
    Please note that removing footage from the beginning is possible too, but will void all time offsets in LapTimer's data recordings. This in turn requires you to re-sync all laps manually.

Once the video with reduced size is created, it needs to be transferred back to the SD card and the smartphone. There are two options again:

  1. Copy the changed file using the original file name: this will overwrite the original video but keep the relation between lap data recordings and the video. Once the SD card is entered again, LapTimer should see the updated video immediately and the overlay can be started. It is certainly possible (and recommended) to store a copy of the original file on the desktop for later use.
  2. Copy the changed file using the new name (i.e. with "-HD" etc postfix) to the same folder the original video is stored in: once back in LapTimer, the laps will still reference the big video. To re-link the laps to the new (smaller) video, in Lap List / Lap Details, tap the video preview row first. This will bring you to the (big) video's "Video Details". Press the "+Video" button in the top right of the screen and select the new video from the list. This will re-link all lap references going to LapTimer-XXXXXXXX-XXXXXX.mp4 so far to use LapTimer-XXXXXXXX-XXXXXX-HD.mp4 (or -4mins) now.

In the work arounds shown above a free command line tool named "ffmpeg" is used. You can download it for any platform from the net. In case you are not familiar with using command line tools, please search the Internet for "Handbrake" - which is a GUI front end for ffmpeg and probably easier to use.

- Harry


Harry, I am sorry, I am lost. Would you please hint me how to get mp4 files from my iPhone to my PC to allow me to process them, make them shorter and re-upload them back? Sending files to Photolibrary results in changing the name of the file. And I am not sure if this is the only problem...


User avatar
bulls23
20 or more Posts ★★★
20 or more Posts ★★★
Posts: 755
Joined: Fri Mar 04, 2011 12:22 pm
Has thanked: 12 times
Been thanked: 36 times

Re: [FAQ] Working with large videos on Android

Postby bulls23 » Wed Dec 10, 2014 4:05 pm

The above limitations are for Android only...in case you didn't realize that.
Videos recorded in any of Harry's Apps should be in .mov file format. An easy and fast way to download / upload files directly to Laptimer is using a tool called "Ifunbox". It's free and you will find lots of infos around in the forum.


texevora
Fewer than 10 Posts
Fewer than 10 Posts
Posts: 2
Joined: Wed Dec 17, 2014 8:43 pm

Re: [FAQ] Working with large videos on Android

Postby texevora » Wed Dec 17, 2014 8:46 pm

Hi, i'm a new user to HLT using a Note3 Android phone. If the raw video file exceeds 2GB, can I not just export the raw video and the telemetry data to my desktop and use a 3rd party overlayer like RaceRender? Or is that not possible either?


User avatar
Harry
Site Admin
Site Admin
Posts: 8944
Joined: Sun Sep 12, 2010 10:32 am
Location: Siegum, Germany
Has thanked: 98 times
Been thanked: 369 times
Contact:

Re: [FAQ] Working with large videos on Android

Postby Harry » Wed Dec 17, 2014 10:42 pm

Yes, as long as the desktop overlay can work with the video (they usually do), that's certainly possible. Export the range of laps you want to overlay to CSV format. I exchange the format regularly with Dashware and TrackVision, they should work out of the box. You will miss some items (bend names or min/max speeds), but get other options in return. Finally, desktop overlayers are more expensive than LapTimer ;-)

- Harry


Image Image Image Image
texevora
Fewer than 10 Posts
Fewer than 10 Posts
Posts: 2
Joined: Wed Dec 17, 2014 8:43 pm

Re: [FAQ] Working with large videos on Android

Postby texevora » Wed Dec 17, 2014 10:48 pm

Understood... Is the 2GB limitation something you are planning to eventually figure out a way to bypass, or is this an unavoidable limitation of Android?



Return to “Outdated”

Who is online

Users browsing this forum: No registered users and 1 guest