How to embed a video into GitHub README.md?

后端 未结 6 877
旧巷少年郎
旧巷少年郎 2020-12-02 03:31

Is it possible to embed a flash video into README.md on GitHub? It isn\'t showing up: https://github.com/mattdipasquale/PicSciP

相关标签:
6条回答
  • 2020-12-02 04:10

    I strongly recommend placing the video in a project website created with GitHub Pages instead of the readme, like described in VonC's answer; it will be a lot better than any of these ideas. But if you need a quick fix just like I needed, here are some suggestions.

    Use a gif

    See aloisdg's answer, result is awesome, gifs are rendered on github's readme ;)

    Use a video player picture

    You could trick the user into thinking the video is on the readme page with a picture. It sounds like an ad trick, it's not perfect, but it works and it's funny ;).

    Example:

    [![Watch the video](https://i.imgur.com/vKb2F1B.png)](https://youtu.be/vt5fpE0bzSY)
    

    Result:

    Use youtube's preview picture

    You can also use the picture generated by youtube for your video.

    For youtube urls in the form of:

    https://www.youtube.com/watch?v=<VIDEO ID>
    https://youtu.be/<VIDEO URL>
    

    The preview urls are in the form of:

    https://img.youtube.com/vi/<VIDEO ID>/maxresdefault.jpg
    https://img.youtube.com/vi/<VIDEO ID>/hqdefault.jpg
    

    Example:

    [![Watch the video](https://img.youtube.com/vi/T-D1KVIuvjA/maxresdefault.jpg)](https://youtu.be/T-D1KVIuvjA)
    

    Result:

    Use asciinema

    If your use case is something that runs in a terminal, asciinema lets you record a terminal session and has nice markdown embedding.

    Hit share button and copy the markdown snippet.

    Example:

    [![asciicast](https://asciinema.org/a/113463.png)](https://asciinema.org/a/113463)
    

    Result:

    0 讨论(0)
  • 2020-12-02 04:11

    This is an old post but I was looking for an answer and I found this: https://gifs.com. Just upload the video, then it creates a gif we can add easily in a github markdown. I tried it, the quality of the gif is a good one.

    0 讨论(0)
  • 2020-12-02 04:16

    just to extend @GabLeRoux's answer:

    [<img src="https://img.youtube.com/vi/<VIDEO ID>/maxresdefault.jpg" width="50%">](https://youtu.be/<VIDEO ID>)
    

    this way you will be able to adjust the size of the thumbnail image in the README.md file on you Github repo.

    0 讨论(0)
  • 2020-12-02 04:19

    For simple animations you can use an animated gif. I'm using one in this README file for instance.

    0 讨论(0)
  • 2020-12-02 04:25

    The "Github Flavored Markdown" doesn't support this kind of feature for any page:

    An old support thread "Embed YouTube videos in markdown files" stated:

    With pages.github.io, yes, everywhere else, no.

    (Note: as detailed in "Github Top-Level Project Page", github.io is the new domain for user and organization pages since April 2013.
    The page GitHub publication is presented here)

    This could be a feature request like the syntax highlighting was.

    For instance: "HTML5 video in markdown" (August 2010):

    Is there any way to implement a HTML5 video into the README.markdown file?

    Not currently but we might be expanding what you can do with the READMEs in the future.

    In the meantime, you can do this with GitHub Pages and our Wikis.


    Benjamin Oakes confirms in the comments (May 2012):

    I sent in a support request. The response was that embedding videos is not supported.

    0 讨论(0)
  • 2020-12-02 04:34

    I combine Alexandre Jasmin and Gab Le Roux answers like this:

    [![Demo CountPages alpha](https://share.gifyoutube.com/KzB6Gb.gif)](https://www.youtube.com/watch?v=ek1j272iAmc)
    

    Demo:

    You can see this demo on github.

    I used gifyoutube here, but I recommend using a local gif converter (like ffmpeg, see how) instead of an online one.

    To record your screen to gif directly, you may want to check ScreenToGif.

    0 讨论(0)
提交回复
热议问题