Page 1 of 3 123 LastLast
Results 1 to 10 of 27

Thread: Best way to manipulate video files over LAN/web with Linux

  1. #1
    Join Date
    Nov 2008
    Beans
    19

    Best way to manipulate video files over LAN/web with Linux

    Being newish to Linux, recently successfully installed Surveillance camera program: Motion. Now researching to make myself a little GUI which I can use over my local network (i.e.: same GUI accessed by multiple PC's on LAN). The GUI is very simple: Display a listbox or similar with filenames of video files (sometimes over 100 in a folder) saved by Motion. Listbox should have multi-select option. I then need 3 buttons: 1-Play selected files 2-Move selected files to another folder 3-delete the files.

    I was able to produce this using Python and tkinter (which I never heard of past last week). Then I realized that the tkinter GUI has to be played on the local PC. It is able to play the mkv files in succession as selected via MPlayer Current research points toward Python/ Flask/ PHP.

    Would Python/ Flask/ PHP be the best way to go to keep it secure but simple for my simple mind?

    Any help would be appreciated.

  2. #2
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Best way to manipulate video files over LAN/web with Linux

    Webapps are a security nightmare.
    I'd use remote X11 or just mount the remote storage over NFS or sshfs to my local workstation.

    ssh -X thefu@ip command

    ssh has all the connectivity needed to connect between Unix systems. It really is sad that Windows hasn't prepared people with that type of security tools. So sad.

    I certainly wouldn't bother creating a menu. Any file manager can support right-click options, if you want a GUI. A little bash would create a TUI that is easy, simple, in perhaps 30 minutes. Don't get me wrong, if the bash becomes longer than 1 pg of code, I'd switch to perl/ruby/python too. Doubt this would. xenity can make little TUIs, BTW.

    But if you want a webapp, flask/python isn't the wore idea - besides the security parts.

  3. #3
    Join Date
    Nov 2008
    Beans
    19

    Re: Best way to manipulate video files over LAN/web with Linux

    Hey TheFu,
    TY tons for answering.
    I do have ssh set up on the local machines and that works. I can easily view the files over the LAN with it, though, my wife is NOT happy about needing to get to the files this way.
    We currently use BlueIris which simply shows the recorded video clips and click on the clip, and it shows. Etc Etc .
    So, switching over to Linux (Mint), the only program option is a command line program (Motion - which I love), but I need to write something to view the recorded files with simple left right clicks, hopefully speedup slow down, that kind of stuff.
    Again, already concocted something with Python and tKinter, but with all the research online, it does not appear possible to view the program over LAN (or Web).
    Also, eventually I would like to see the cameras (with button options/ viewing options) when we are traveling.
    I have some experience with Python, some Flask, but nothing to create listboxes supporting population of folder content. I have not found Flask can create multi select listboxes to be placed on an HTML form?)
    Would PHP/ Flask/ Python be a bad combo? What I wish to create would, BTW, not be listed somewhere on the web, only for my access.

  4. #4
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Best way to manipulate video files over LAN/web with Linux

    Ah - the wife. In that case, setup a DLNA server and let her use a DLNA client to view all the files. There are many, free, F/LOSS, options. And the bonus is that these can be limited if you pick the right server software.

    For access when traveling, you'll want to run a VPN at home to provide remote access. This isn't THAT hard. OpenVPN or wireguard really do work. For you, you can use an ssh tunnel as a SOCKS proxy and access the DLNA server's web interface from anywhere. I've posted a SOCKS ssh script here a few times.

    Would PHP/ Flask/ Python be a bad combo? What I wish to create would, BTW, not be listed somewhere on the web, only for my access.
    It completely depends on your ability to create secure code. I've been programming for 30+ yrs - all sorts. I've written a commercial video server for clients. For my needs at home, I'd never bother. The wheel has already been invented. Rygel, JellyFin, DLNA, VLC, Kodi, are just a few ways for access to be provided. There is plex too, if you want to have every button and file accessed reported to someone else (not you).

    Anything you can access on the web without using an encrypted, key-based authentication, will be found by others, no matter what you do. I had a private photo gallery just for family decades ago. Within a few weeks, google was indexing all those photos. I was pissed. Once google found it, all the other web indexers found it too. Google honors the robots.txt but almost none of the the others do. Some were abusive to my bandwidth ($$$), re-indexing the full site 6 times daily. In short, if it can be found, it will. Obscurity doesn't work.

  5. #5
    Join Date
    Nov 2008
    Beans
    19

    Re: Best way to manipulate video files over LAN/web with Linux

    Ouch,
    that sounds as bleak as one should imagine nowadays - privacy is certainly gone (hence my need to change all my PC-OS's).
    TY tons for your suggestions and your input - I will read up on the above mentioned tomorrow!
    Nothing is simple, yes?

  6. #6
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    15,566
    Distro
    Kubuntu 20.04 Focal Fossa

    Re: Best way to manipulate video files over LAN/web with Linux

    Code:
    sudo apt install minidlna
    Edit /etc/minidlna.conf with "sudo nano /etc/minidlna.conf" and set the "V=" line to point to the directory where the video files are stored.

    Code:
    sudo systemctl start minidlna
    sudo systemctl enable minidlna
    Wait a bit while minidlna indexes the files. This can take awhile if there are a lot of them. You can follow the process with
    Code:
    tail -f /var/log/minidlna.log
    Now you can see the files from any DLNA-compliant device. I use BubbleUPnP on my Android phone with MXPlayer to view the files. My LG TV has a DLNA client built in; so does my Roku device. On Linux or Android, you can use VLC which has a built-in DLNA client. Don't know anything about iThings.

    For access from outside you can probably forward a port back through your router to the DLNA server's port 8200 where minidlna is listening. You'll want to consider the security implications of this first. At a minimum don't use port 8200 on the router. Choose some arbitrary number between 10000 and 60000 and forward that back to the server's port 8200.
    Last edited by SeijiSensei; February 9th, 2021 at 06:57 PM.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  7. #7
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Best way to manipulate video files over LAN/web with Linux

    MiniDLNA is great, unless you need transcoded video per device. If the created videos are all h.264/aac in an mp4 container, then transcoding probably isn't needed.

    BubbleUPnP isn't bad; used it for a few years. I switched to VLC as my android client. Sometimes use Kodi on Android too. Both do DNLA fine and both play anything.

    DLNA is a LAN broadcast protocol, so you won't be able to use DLNA over the internet. At least it never worked for me. For that, you'll need some media streaming server ... like Jellyfin or Plex with a web interface that you connect into when away. If you start with Jellyfin, you won't feel the need to use plex. It isn't hard to setup jellyfin - took me about 10 minutes last week. Jellyfin is 100% F/LOSS and won't do anything anti-privacy unless you setup those connections. MiniDLNA won't either.
    There is also Rygel - the DLNA server that Ubuntu has advertised. Rygel is a little flaky in my testing, but eventually I got it working. Minidlna was much easier. Plex and Jellyfin are more massive, but those systems really want to be media servers for clients that like to see Movie and TV metadata as you browse what to playback. The last week or so, I've been maintaining both Plex and Jellyfin servers here. There are just a few annoying issues with Jellyfin to me, but the privacy aspects and built-in transcoding as-each-client-requires is very nice.

    Jellyfin allows multiple users, so different content can be seen by different users. Perhaps you don't want the kids to have access to the security videos? Most DLNA servers don't have any logins. Anyone on the network with a DLNA client can access all the content.

  8. #8
    Join Date
    Jul 2005
    Location
    I think I'm here! Maybe?
    Beans
    Hidden!
    Distro
    Xubuntu 20.04 Focal Fossa

    Re: Best way to manipulate video files over LAN/web with Linux

    I use minidlna on my laptop to stream music, videos and photographs mainly to my LG smart TV, and it works brilliantly for what I need from it. I have also tried rygel but like TheFu I find it a bit lacking and flaky so I no longer use it; it is not a default installed package in Xubuntu but is now included as default I believe in Ubuntu so probably wirth trying. I generally use VLC on all client devices for viewing the DLNA media, whether it's another computer, or Android tablet or phone; the LG TV just sees the laptop in its smartshare utility with no additional app being necessary.

    There are a few filetypes that are seen but will not play, for example I record TV programmes onto a USB external drive.
    They are recorded as .ts files, (mpeg2 transport stream) and will not play in any way and as TheFu says, minidlna can not transcode on the fly, so I use thunar's custom actions system to convert them using ffmpeg in a few seconds to .mkv or .mp4 files, both of which play very well. I have no idea whether other Ubuntu DE versions have similar custom actions from right clicking files but it is incredibly useful to me for this and the many other uses to which I put it.

    In the past I used plexmedia-server on my main desktop machine to stream media again mainly to the same LG smart TV but about a year ago I moved to Emby-Mediaserver and found it better than Plex; you may find Plex better but each to their own! I have also tried jellyfin the open-source fork developed from Emby when that moved to closed-source and whilst it is pretty good it is not yet as polished as Emby (or Plex), and does not yet have an app for the LG TV, so for now I stay with Emby which does have an app, but I will keep trying jellyfin. Plex, Emby and Jellyfin will all transcode on the fly but I usually convert any of those recorded .ts files to mkv (or mp4) as they are both usually smaller files than the original.

    Sorry if this is a long winded post but I thought it worth pointing out the possibilities, and how many different ways there are, many of which have been mentioned already by others but which I have never used.
    I have never needed to use, nor set up any of my systems to stream media over remote connections so can not add anything more about that.
    Last edited by ajgreeny; February 9th, 2021 at 09:06 PM.

  9. #9
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    15,566
    Distro
    Kubuntu 20.04 Focal Fossa

    Re: Best way to manipulate video files over LAN/web with Linux

    A web server like Apache is probably the easiest and safest way to go for external access. Make sure you use at least Basic authentication so a username and pasword will be required. You can force the Apache server to list the available files in any order you choose. For descending by timesamp you would use:
    Code:
    <VirtualHost *:80>
    ServerName     myvideos.example.com
    [etc.]
    
    Alias /Videos/ /path/to/the/Videos/directory/
    Directory <"/path/to/the/Videos/directory/">
      AuthType Basic
      AuthName "Authentication Required"
      AuthUserFile "/path/to/.htpasswd"
      Require valid-user
    
      Order allow,deny
      Allow from all
    
      IndexOrderDefault Descending Date
    </Directory>
    
    </VirtualHost>
    I recommend using certbot with Let's Encrypt to provide SSL encryption as well. certbot will create a configuration file based on what you have for port 80, and replace 80 with 443 in the <VirtualHost> declaration.

    Once again hide the service from snooping eyes by forwarding a high-numbered port back to port 443 on the web server (80 if you don't use SSL).

    If you go this route, you can view the videos while on your local network with only a web browser. The most recent recording will be at the top of the list.
    Last edited by SeijiSensei; February 9th, 2021 at 10:09 PM.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  10. #10
    Join Date
    Nov 2008
    Beans
    19

    Re: Best way to manipulate video files over LAN/web with Linux

    Doing a quick search on miniDLNA, it looks like a great little streaming app.
    Though I do not see how it is programmable?
    I am looking more for a program language which allows me to control the functions of buttons, have a multi-select file list etc etc.
    Again, would like to use Python, and, possibly with Flask if I can figure out security and the ability to populate a list box with file name references contained in a single folder.

Page 1 of 3 123 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •