Help with viewing (and creating) videos

A place to share learning material: written tutorials, videos, etc.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
wandererfan
Veteran
Posts: 6320
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Help with viewing (and creating) videos

Post by wandererfan »

I'm having trouble with videos on the forum, both posted by others and the ones I try to post.

Videos hosted on youtube work reliably.

Videos hosted elsewhere (github, dropbox, etc) often fail to play with one of two messages:
"No Video with supported format and MIME type found"
"Sorry this URL is not supported"

Other times I get a black box with no messages.

I've tried with Firefox and Chromium. Same results.

I can create videos locally (webm and mp4) and they play every time.

Any guesses? Things to check further? Security settings?


FreeCAD info
OS: Linux Mint 19 Tara
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15363 (Git)
Build type: Release
Branch: master
Hash: 9be3e633328335f1172456f5857219b7a08c70a5
Python version: 2.7.15rc1
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Canada (en_CA)
TheMarkster
Veteran
Posts: 5513
Joined: Thu Apr 05, 2018 1:53 am

Re: Help with viewing (and creating) videos

Post by TheMarkster »

wandererfan wrote: Mon Dec 10, 2018 3:06 pm I'm having trouble with videos on the forum, both posted by others and the ones I try to post.

Videos hosted on youtube work reliably.

Videos hosted elsewhere (github, dropbox, etc) often fail to play with one of two messages:
"No Video with supported format and MIME type found"
"Sorry this URL is not supported"

Other times I get a black box with no messages.

I've tried with Firefox and Chromium. Same results.

I can create videos locally (webm and mp4) and they play every time.

Any guesses? Things to check further? Security settings?


FreeCAD info
OS: Linux Mint 19 Tara
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15363 (Git)
Build type: Release
Branch: master
Hash: 9be3e633328335f1172456f5857219b7a08c70a5
Python version: 2.7.15rc1
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Canada (en_CA)
The trick to getting the video hosted on github to play on the forum is get the link to the raw file, not the link to the file where you see it in the listing. Select view raw or something similar and post that url inside the video tags. I have written this python script for automating this process for me:

Code: Select all

import sys, os
import subprocess
"""This is a way for me to generate the url needed for posting the videos to the 
FreeCAD forum boards.  In Windows 10 Explorer I'm able to drag and drop the webm video to
this file, which then creates the url and video tags string, and then copies it to the clipboard.

This greatly improves things because now I don't have to go to github.com each time to get the url.
"""

def modifyThineSelf():
    """This is just to modify the file so it appears at the top of the folder when sorting by modified date."""
    fin = open(__file__, 'r')
    code = fin.read()
    fin.close()
    fout = open(__file__, 'w')
    fout.write(code)
    fout.close()

def copy2clip(txt):
    cmd='echo '+txt.strip()+'|clip'
    return subprocess.check_call(cmd, shell=True)

prepend = "https://raw.githubusercontent.com/mwganson/FreeCAD-videos/master/"

if len(sys.argv) != 2:
    input("Please drag and drop a file or enter filename as command line parameter")
else:
    modifyThineSelf()
    fileName = os.path.basename(sys.argv[1])
    data = "[video]" + prepend + fileName + "[/video]"
    copy2clip(data)

    #Following could be removed as it only pauses the screen and displays the confirmation
    text = input(data + " has been copied to clipboard (press enter to close) ")
It is written for windows, but could be ported to other os without much difficulty by modifying the copy2clip() function. You would also need to modify it to point to your repository instead of mine, obviously. To use the script I just drag and drop my new video on to it in windows explorer. It pops up a box informing me the url it generated was copied to the clipboard, which I then paste into the forum. I use git bash to upload the file to the repository in the usual way:

git add .
git commit -m"message"
git push

This I have also automated in another script.

I have checked github's terms of service and I see nothing in it that forbids using it in this manner. Certainly, if the videos (all documenting FreeCAD) were in the FreeCAD repository github would have no complaint. It can be argued my video repository is an extension of FreeCAD and acting as extended documentation. That would be my argument to them if they told me something.
Post Reply