B4J Question Perfect little B4J project… [w/ solution]

canalrun

Well-Known Member
Licensed User
Longtime User
Hello,
I recently got an inexpensive Wi-Fi Security Camera.
It stores video 24 hours a day on a Mini SDHC card.

The way it stores the video files – it has a directory for each day, within each directory are several sub-directories separating groups of files, and in each sub-directory are about 50 files each representing 10 minutes or so of video.

Essentially I get over 140 files of video for each day. That's a lot to work with.

The files are in .264 format and the name includes the start and end time for the video.

In order to look at these I would like to concatenate a bunch of the files and then maybe translate the concatenated files to .MP4 format.

This sounds like a perfect little project for B4J.

I would make a list of all the files in a directory/sub- directories, then sort the list by start and end time. That's easy.

The part I'm not familiar with is concatenating multiple .264 video files and translating them to .MP4.

I have seen that libraries such as FFmpeg can help. I am not current with B4J, although I've used it often since it was introduced.

Can anyone offer a suggestion of what to look for in order to concatenate these .264 video files and translate them to an .MP4 file?

Thanks,
Barry.
 
Last edited:

canalrun

Well-Known Member
Licensed User
Longtime User
Another option is to use ffmpeg command line tool. You can run the commands with jShell.

Thanks.
I found a couple older posts where people build command lines for ffmpeg then use jShell to execute those commands. These will be a great help.

By "ffmpeg commandline tool" you are referring to building a command string and executing it using jShell from B4J – there is not a separate B4J tool that constructs ffmpeg command lines?

Barry.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

canalrun

Well-Known Member
Licensed User
Longtime User
Thanks.
I found a couple older posts where people build command lines for ffmpeg then use jShell to execute those commands. These will be a great help.

I have attached the source code for the solution I created for this little project.

You'll need to download and install ffmpeg and acquire video files to make this example actually work, but it should be handy as an example of using JShell with ffmpeg.

The app is a B4J template app (side-by-side listviews with buttons and text fields at the bottom, with a pop-up dialog to display help and some nifty routines) that I use all the time.

My videos are in ".264" raw video file format. Ffmpeg did not like concatenating several of these files and converting directly to an mp4. I had to first concatenate the small .264 files into a large .264 file, then convert the single large .264 file into an mp4.

Barry.
 

Attachments

  • KKMCat.zip
    8 KB · Views: 269
Upvote 0
Top