Skip to content

Instantly share code, notes, and snippets.

@pietrop
pietrop / ffmpeg_mkv_mp4_conversion.md
Created December 12, 2019 17:31 — forked from jamesmacwhite/ffmpeg_mkv_mp4_conversion.md
Easy way to convert MKV to MP4 with ffmpeg

Converting mkv to mp4 with ffmpeg

Essentially just copy the existing video and audio stream as is into a new container, no funny business!

The easiest way to "convert" MKV to MP4, is to copy the existing video and audio streams and place them into a new container. This avoids any encoding task and hence no quality will be lost, it is also a fairly quick process and requires very little CPU power. The main factor is disk read/write speed.

With ffmpeg this can be achieved with -c copy. Older examples may use -vcodec copy -acodec copy which does the same thing.

These examples assume ffmpeg is in your PATH. If not just substitute with the full path to your ffmpeg binary.

Single file conversion example

@pietrop
pietrop / scrape-c-span-captions.js
Last active December 5, 2019 21:04
copy paste script in console to scrape C-Span captions from a video
/**
* To Scrape captions text from C-Span website
*
* Example page
* https://www.c-span.org/video/?465757-1/federal-reserve-chair-powell-announces-interest-rate-cut-signals-pause
*/
// possible function to clean up text
// https://github.com/voxmedia/c-span_opened_captions_server/blob/master/index.js#L61
function formatText(str) {
var ret = str.toLowerCase().replace("\r\n", ' ') // remove random line breaks
@pietrop
pietrop / dpe-add-words-to-paragraphs.sj
Created November 29, 2019 12:42
example of how to interpolate DPE transcripts words with paragraphs
// some DPE transcript
const transcript = {
"words": [
{
"id": 0,
"start": 0.24,
"end": 0.56,
"text": "Wall"
},
{
@pietrop
pietrop / dpe-add-words-to-paragraphs.sj
Created November 29, 2019 12:42
example of how to interpolate DPE transcripts words with paragraphs
// some DPE transcript
const transcript = {
"words": [
{
"id": 0,
"start": 0.24,
"end": 0.56,
"text": "Wall"
},
{
@pietrop
pietrop / interpolateWordsTimesFromSentence.js
Last active December 20, 2018 12:14
originally from https://github.com/pietrop/srtParserComposer and modified from PopcornJs srt parser. https://github.com/mozilla/popcorn-js/blob/master/parsers/parserSRT/popcorn.parserSRT.js - given a setence with start and end timecode it can compute and estimate start and end timings for each word.
/*
* originally from https://github.com/pietrop/srtParserComposer/blob/master/srtJsonToWordLinesJson.js()
* refactored
* Module to convert srtJson to nested array of line word objects.
Line to word timecode accuracty.
Original code modified from Popcorn srt parser.
https://github.com/mozilla/popcorn-js/blob/master/parsers/parserSRT/popcorn.parserSRT.js
input example
```js
@pietrop
pietrop / pull_request_template.md
Created October 29, 2018 10:26 — forked from iaincollins/pull_request_template.md
Pull Request Template

Summary

A sentence describing the reason for the changes in this pull request.

Description

A few sentences / bullet points describing the goals of this change and the implementation.

Link to Issue

@pietrop
pietrop / adr_template.md
Created October 29, 2018 10:25 — forked from iaincollins/adr_template.md
ADR Template

[short title of solved problem and solution]

  • Status: [accepted | superseded by ADR-0005 | deprecated | …]
  • Deciders: [list everyone involved in the decision]
  • Date: [YYYY-MM-DD when the decision was last updated]

Technical Story: [description | ticket/issue URL]

Context and Problem Statement

@pietrop
pietrop / .travis.yml # Linux only
Created August 6, 2018 04:34
Electron Travis CI Linux only automated build `.travis.yml` file
# https://github.com/OpenNewsLabs/autoEdit_2/issues/36
language: node_js
node_js:
- "7"
os: linux
dist: trusty
sudo: required
@pietrop
pietrop / .travis.yml #mac + linux
Created August 6, 2018 04:33
Electron Travis CI Mac + Linux automated build `.travis.yml` file
# https://github.com/OpenNewsLabs/autoEdit_2/issues/36
language: node_js
node_js:
- "7"
os:
- linux
- osx
@pietrop
pietrop / .travis.yml #mac only
Last active August 6, 2018 04:32
Electron Travis CI Mac automated build `.travis.yml` file
# originally from https://github.com/OpenNewsLabs/autoEdit_2/issues/36 see PR for setup instructions with travis github token etc..
# https://github.com/OpenNewsLabs/autoEdit_2/blob/master/package.json
# need to set electron builder mac target to be only zip file, to skip dmg
# https://github.com/OpenNewsLabs/autoEdit_2/blob/master/package.json#L56
# dmg seems to take to long and hang the process
language: node_js
node_js:
- "10"