Giter VIP home page Giter VIP logo

qgisfmv's Introduction

QGIS Full Motion Video (FMV) #QGISFMV

Build Status Project Stats

Donations

If this plugin is useful for you, consider to donate to the author.Want to buy me a beer (or gadget)? Please use Paypal button or contact me directly.

paypal

Plugin for QGIS 3 which allows to analyze, visualize and process videos inside the QGIS environment. QGIS FMV accepts multiple video formats such as mp4, ts, avi, etc. It is also able to extract video frames, to capture the current frame, to plot bitrate and to observe the video metadata with aerial images and more. It also offers the possibility to create reports with video metadata.

Standards supported:

Table of Contents

Motivation

This development arises after observing that there was no free solution for the metadata extraction and video analysis in real time. All solutions are APIs or private tools such as Esri or ImpleoTv, for this reason, I decided to develop this open source project and, this way, offer this open source alternative to the QGIS community.

Back to top

Dependencies

  • FFMPEG : After downloading it, you should store it in an accessible folder and modify settings.ini with the corresponding path. For example D://FFMPEG or /usr/bin/

  • OpenCV : python3 -m pip install opencv-python

  • opencv-contrib-python : python3 -m pip install opencv-contrib-python

  • MatPlotLib : python3 -m pip install matplotlib

  • Klvdata : customized version of this library. (No need to install it)

The plugin install automatically this requisites,but you can install it using on Windows and Linux:

python3 -m pip install -r requirements.txt

Here is a settings.ini sample Linux configuration file or Windows sample. On windows you can find the settings.ini file at C:\Users<user name>\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\QGIS_FMV.

Back to top

For show video

To see the video you need:

If everything works well the plugin should install these dependencies automatically in both, Windows and Linux.

Back to top

Usage

The use of this application is simple. It only needs a video with metadata, like for example one of these (ESRI copyright) Then, open the plugin where the "video manager" will be shown, open the video and with a double-click, the "player" will be opened. At this moment, you will see that new shapes have been added and you will see the platform position, metadata, etc.

If we don't have a MISB video we can create it from a video file and telemetry file from a DJI for example.

Link to Usage Documentation!

Back to top

Recommended readings

For more information about the Unmanned Air System (UAS) metadata from STANAG 4609

a

Back to top

Installation

The installation can be done from the QGIS Python Plugins Repository or from the zip.

Back to top

Installation on Windows

Windows automatically installs all, with user permission,If an error occurs, you should perform some checks.

Watch the video (Spanish)

Installation on Ubuntu

Ubuntu automatically installs all the dependencies if the user wants, for this his password will be requested.

If it does not install automatically, you should run:

Python dependencies

sudo pip3 install matplotlib python-apt

The installation of OpenCV and OpenCV-contrib requires a lot of time for this reason you will have to install these dependencies using this script

sh install-opencv.sh

FFMPEG

sudo apt-get -y install ffmpeg

GStreamer/QT5 Plugins

sudo apt-get -y install python3-pyqt5.qtmultimedia gst123 libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio libqt5gstreamer-1.0-0 libqt5multimedia5-plugins

You need to restart QGIS after this.

NOTE : If you only see the videos with .mp4 extension, make sure you don't have it installed gstreamer1.0-vaapi. If you have it installed, you must delete it.

sudo apt-get remove gstreamer1.0-vaapi

Installation on Archlinux

Archlinux installation :

pacman -S qgis python-matplotlib opencv ffmpeg

_ Set FFmpeg path in $HOME/.local/share/QGIS/QGIS3/profiles/[profile_name]/python/plugins/QGIS_FMV/settings.ini _

ffmpeg : "/usr/bin/"
ffprobe : "/usr/bin/"

Slides

Back to top

Mentions

If you want to add your presentation simply upload it or send me an email

Back to top

Screenshots

a

Back to top

Features

  • Convert videos to other format
  • Extract metadata from video file
  • Show Platform,Trajectory,Footprint and beams position in a QGIS
  • Possibility of extracting parts of the video
  • Capture of the current frame
  • Extraction of all frames of the video
  • Extract lon/lat/alt cursor coordinates
  • Apply sobel filters, edge detection ...

Back to top

Contributing

Contributions are welcome!

Back to top

Contributing Code

Want to work on the project? Any kind of contribution is welcome!

Follow these steps:

Fork the project.
Create a new branch.
Make your changes and write tests ( if is possible).
Commit your changes to the new branch.
Send a pull request.

See before FMV Coding Standards!

NOTE: If you are use Linux need install pyuic5 and transifex client to compile the UI.

https://command-not-found.com/pyuic5

Debian apt-get install pyqt5-dev-tools

Ubuntu apt-get install pyqt5-dev-tools

Arch Linux pacman -S python-pyqt5

Kali Linux apt-get install pyqt5-dev-tools

Fedora dnf install python2-qt5

Raspbian apt-get install pyqt5-dev-tools

For test stream feature you can simulate stream channel,like this:

ffmpeg -fflags +genpts -stream_loop -1 -re -i "C:\Users\Fran Raga\Desktop\video_test\Cheyenne.ts" -f rtp_mpegts -c copy -map 0:v -map 0:a -map 0:d rtp://127.0.0.1:8888

ffmpeg -i rtp://127.0.0.1:8888 -c copy -map 0:v? -map 0:a? -f rtp_mpegts rtp://127.0.0.1:8898 -map 0:d? -f data -

And transifex client:

pip3 install transifex-client

Code Format

pip install coveralls
pip install pycodestyle

autopep8 --in-place --aggressive  --aggressive -v --recursive deploy/*.py --exclude="*gui/*"

pycodestyle --ignore=E501 code/*.py --statistics --exclude=code/gui/*.py
pycodestyle --ignore=E501,W504 deploy/*.py --statistics

And thanks for your code.

a

Contributing translations

Contributions are welcome!

transifex

Contributors List


Fran Raga

💻📖

ltbam

💻

Eandelin

📖

License

GNU Public License (GPL) Version 3

Free Software, Hell Yeah!

Back to top

qgisfmv's People

Contributors

all4gis avatar bradh avatar calebspencertorch avatar eandelin avatar imgbotapp avatar kikislater avatar ltbam avatar manisandro avatar mhugent avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qgisfmv's Issues

Convert Video

Convert video does not work correctly and does not preserve metadata

Qgis crash

Launching from terminal, then activate plugin crash qgis :

QGIS died on signal 11ptrace: Operation not permitted.
No thread selected
No stack.
gdb returned 0
Aborted (core dumped)

OS = Manjaro Linux 64

$ pacman -Q qgis
qgis 3.2.0-2

$ pacman -Q python-matplotlib
python-matplotlib 2.2.2-2

pip list | grep opencv
opencv-python 3.3.0.10

pip list | grep homography
homography 0.1.5

$ which ffmpeg
/usr/bin/ffmpeg

$ cat fmvConfig.py

********** Properties **********

Layer names

Platform_lyr = "Platform"
Beams_lyr = "Beams"
Footprint_lyr = "Footprint"
Trajectory_lyr = "Trajectory"
Point_lyr = "Drawings"

Group Name

frames_g = "FMV Georeferenced Frames"

FFmpeg path

ffmpeg = "/usr/bin/ffmpeg"
ffprobe = "/usr/bin/ffprobe"

capture du 2018-08-08 18-17-08

Edit : upgraded to opencv-python-3.4.0.12 and still crash

Video Footprint (With elevation model)

When an elevation model is set, the video footprint is not projected correctly. It is still projected on the target elevation plane instead of the DTM.

[FEATURE] Video manager -> Playlist

In some case a video is split in several mpeg or ts files. So it is interesting that the video manager can behave like a playlist and play videos seamlessly one after one.

It can be as simple as an "autoplay" toggle button in the video manager.

Create mosaic not work

TypeError: isinstance expected 2 arguments, got 1

line 612 QgsFmvUtils dst_ds.SetGeoTransform(geotransform)

Using the new geotransform matrix not work GeoreferenceFrame method

I think we should use geotransform.to_affine()

Display axis of view instead of frame center

It is more common and clear to display a layer with the axis of view instead of only a frame center point layer.

If the vertical view axix comes near horizon, then don't draw the footprint. Only draw the axis of view.

Video Working but path and Footprint are not displayed

Can play the sample videos, but does not plot flight path or footprint. Log file error below.

2018-08-07T18:08:52 WARNING CreatePlotsBitrate : Failed! CreatePlotsBitrate.error[str, Exception, str].emit(): argument 2 has unexpected type 'str'

Crash on QGIS 3.8.1, Linux Mint

Hi,
This may be related to #19 (comment).
I tried all possible way of installing the plugin: From the manager and via the folders.
With and without installing the dependencies first. Only the first time when I installed from the manager I was asked for my password, but nevertheless every time I try to load the plugin QGIS crashes. I have even reinstalled QGIS completely, but it did not help.
When I start qgis from the terminal an than load the plugin this happens:
➜ ~ qgis lav filters QGIS died on signal 11Could not attach to process. If your uid matches the uid of the target process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try again as the root user. For more details, see /etc/sysctl.d/10-ptrace.conf ptrace: Vorgang nicht zulässig. No thread selected No stack. gdb returned 0 [1] 17637 abort qgis

I have no idea how to troubleshoot this and would be thankful for any help.

buffer metadata callbak

Metadata callback run always in bakground!

for check is simple,not delete the layer when close dialog and we see how the layers continue to be updated

[BUG] Index Error: Invalid start byte

Describe the bug
Error message when I click on 'extract recording' from the MISB Creator tool:
An error has occurred while executing Python code:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa0 in position 7464: invalid start byte
Traceback (most recent call last):
File "C:/Users/mrocks/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\QGIS_FMV\manager\QgsMultiplexor.py", line 218, in CreateCSV
self.ReadCSVRecordings(input_metadata)
File "C:/Users/mrocks/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\QGIS_FMV\manager\QgsMultiplexor.py", line 577, in ReadCSVRecordings
for row in reader:
File "C:\PROGRA1\QGIS31.4\apps\Python37\lib\csv.py", line 112, in next
row = next(self.reader)
File "C:\PROGRA1\QGIS31.4\apps\Python37\lib\codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa0 in position 7464: invalid start byte

Desktop (please complete the following information):

  • OS: - Windows 10
  • QGIS Version - 3.4.0
  • Plugin Version - 1.9.0 )I think)

Additional context
Video and data file extracted from Mavic Phantom Pro. I've attached the original

.txt file, and the converted .csv file (converted using 'CsvView'.
DJIFlightRecord_2019-10-21_[14-01-53].txt
Oct-21st-2019-02-01PM-Flight-Airdata1111111.zip

Any assistance would be fantastic, my python knowledge is extremely limited I'm afraid.

Marty

[BUG]: IndexError: list index out of range

IndexError: list index out of range
Traceback (most recent call last):
File "C:/../QGIS/QGIS3\profiles\default/python/plugins\QGIS_FMV\manager\QgsMultiplexor.py", line 218, in CreateCSV
self.ReadCSVRecordings(input_metadata)
File "C:/../QGIS/QGIS3\profiles\default/python/plugins\QGIS_FMV\manager\QgsMultiplexor.py", line 593, in ReadCSVRecordings
self.CreateDJICsv(rows_list, csv_raw)
File "C:/../QGIS/QGIS3\profiles\default/python/plugins\QGIS_FMV\manager\QgsMultiplexor.py", line 617, in CreateDJICsv
csv.writer(f_output).writerows(itertools.islice(csv_input, int(values[0]), int(values[-1])))

This appears after clicking the Extract Recording.
Thank you in advance

Buffer size crash

Buffer size not work in large videos.

For reproduce it:
Open a video
advance 1 or 2 minutes using the slider

And the metadata not show,the buffer has not arrived yet I think.

Use this video for test DJI_0047_MISB_F.mp4 (sample folder)

Add Video Manager "location" column

When a video comes in the video manager, it's location should be written in a specific column. We can use a reverse geocoding service for this.

[FEATURE] Multiple Data streams support on STANAG 4609 Videos

Some VsCam creates videos with 2 data streams, the first one may not contain KLV Data, but second one does.
For those kind of video we may need to check every data stream before we can read the good one.

Actually we read KLV with -map 0:d

We may need to try other data stream with: -map 0:d:0 or 0:d:1 as well.

Ruler

Make ruler on video tool

3D

To see it in 3D

FFMPEG download failed

'Missing dependency, Do you want install FFMPEG?'
I clicked yes, but the download no respond. Using QGIS 3.10.3 Windows 10.

[FEATURE] Possible implementation for Streaming

Possible implementation for streaming in QGIS FMV.
We did some research and tests to support rtp streams, following changes would be necessary for a first implementation.

  1. QTMultimedia and FFMPEG need to listen on different ports. Therefore we need a Splitter in front of the stream to separate AV and Data.

                                                                  |-> A+V on port 8889          --> QMediaPlayer 
    

rtp stream [port 8888] -> FFmpeg Splitter |
|->KLV to output stream --> Data Parser

  1. The Splitter can be implemented with FFMPEG as follow:
    example: Receive AV+Data on port 8857. Forward AV on 8858 and return KLV to output stream.

ffmpeg -re -i rtp://127.0.0.1:8857
-vcodec copy -acodec copy
-map 0:0 -map 0:1
-f rtp_mpegts "rtp://127.0.0.1:8858"
-map 0:2
-f data -

  1. Bind QMediaPlayer to port 8858

  2. Read KLV from in Memory Buffer

Start Location not available // Not MISB

Hello,
Thanks in advance for your answers:
under win10 64b using Qgis3.4.9 LTR.
Plugin show (finaly) no message, Installation of dependencies show no erreur.
However i still get "not Misb" in status and "Start location not available" when opening uploded files that assumed to be MSIB compliant.

Any ideas ?
Regards
SShot

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.