Difference between revisions of "VideoEncodingTips"

From TAMI
Jump to navigationJump to search
(merged streaming and videoecoding)
Line 1: Line 1:
= MTS to webm =
+
=encoding=
 +
== MTS to webm ==
  
 
Used ffmpeg to concatenate the files without reencoding (codec copy):
 
Used ffmpeg to concatenate the files without reencoding (codec copy):
Line 19: Line 20:
 
  ffmpeg -i whole.webm -ss 00:12:55 -to 20:07 -codec copy 03_EWB_Oren.webm
 
  ffmpeg -i whole.webm -ss 00:12:55 -to 20:07 -codec copy 03_EWB_Oren.webm
  
= cropping with ffmpeg =
+
== cropping with ffmpeg ==
 
  ffmpeg -i atlassian_jira_workflow_graph_view_guides_demonstration_20150305_orig.webm -vf "crop=1920:1200:0:0" test.webm
 
  ffmpeg -i atlassian_jira_workflow_graph_view_guides_demonstration_20150305_orig.webm -vf "crop=1920:1200:0:0" test.webm
  
= cropping with gstreamer =
+
== cropping with gstreamer ==
 
  gst-launch-0.10 -v filesrc location=./atlassian_jira_workflow_graph_view_guides_demonstration_20150305_orig.webm ! decodebin ! ffmpegcolorspace ! videocrop top=0 left=0 right=1920 bottom=0 ! vp8enc ! webmmux ! filesink location=whole.webm
 
  gst-launch-0.10 -v filesrc location=./atlassian_jira_workflow_graph_view_guides_demonstration_20150305_orig.webm ! decodebin ! ffmpegcolorspace ! videocrop top=0 left=0 right=1920 bottom=0 ! vp8enc ! webmmux ! filesink location=whole.webm
 +
 +
 +
=Streaming=
 +
==icecast2/ogg==
 +
[http://icecast.org/ Icecast2] is a streaming media server
 +
 +
===how to===
 +
* <b>you can stream to a server located at port 8000 </b>- like http://tami.org.il:8000/
 +
  ## to configure
 +
  # sudo vim /etc/icecast.xml
 +
  ## to manage service
 +
  # systemctl enable/stop/restart icecast
 +
 +
tested audio streaming using [http://butt.sourceforge.net/ BUTT] on windows<br>
 +
tested video streaming using ffmpeg2theora | oggfwd on arch<br>
 +
 +
example of video streaming
 +
# -p preview is 288Kbps video
 +
# -v 4 = 500Kbps
 +
ffmpeg2theora --no-skeleton -p preview --noaudio  video_source.mp4 -o /dev/stdout | oggfwd tami.org.il 8000 password /mount_name
 +
 +
 +
example of video encoding from mp4 to ogg (ogv)
 +
# ffmpeg -i input.mp4 -codec:v libtheora -qscale:v 7 -codec:a libvorbis -qscale:a 5 output.ogv
 +
 +
example of streaming from local to server, you need oggfwd for this.
 +
# this example will show at tami.org.il:8000/channel
 +
# cat zimmertlv-92244715-streamReady.ogv | oggfwd  tami.org.il 8000 password /shannel
 +
 +
=== insperation ===
 +
*[http://radio.7chan.org:8000/CH7 channel7] runs an icecast2 server which ... stream ogg theora vorbis encoded videos to, using a program called ezstream
 +
*[http://x264dev.multimedia.cx/archives/249 x264: the best low-latency video streaming platform in the world]
 +
 +
*[http://www.rudiswiki.de/wiki9/AndroidFPView instrcutions to build your telepercnse gimp]
 +
*[https://bbs.archlinux.org/viewtopic.php?id=178617 mplayer tips on using without X]
 +
 +
 +
===alternatives and addons ===
 +
*[http://www.mltframework.org MLT] Author, manage, and run multitrack audio/video compositions
 +
* [https://obsproject.com/ Open Broadcaster Software]  open source software for live streaming and recording
 +
* [https://obsproject.com/forum/threads/private-rtmp-server-preconfigured-virtualbox-image.5873/ Private RTMP server] preconfigured obs virtualbox image
 +
*[https://wiki.xiph.org/GST_cookbook gstreamer examples] for streaming, but where is the vp8 to icecast :/
 +
* the holy grail, vp8+gstreamer+icecast
 +
* [http://icecast.org/ezstream/ Ezstream] is a command line source client for Icecast media streaming servers.
 +
* ffmpeg2theora- [http://v2v.cc/~j/ffmpeg2theora/examples.html examples] and [http://v2v.cc/~j/oggfwd/ small helper]
 +
* Streaming howto for [http://en.flossmanuals.net/FFmpeg2Theora/StreamingDV/ linux] and [http://www.youtube.com/watch?v=LJNyJMcjgy8 windows]

Revision as of 00:04, 10 March 2015

encoding

MTS to webm

Used ffmpeg to concatenate the files without reencoding (codec copy):

ffmpeg -f concat -i files -c copy whole.mts

where files contains:

file 00001.MTS
file 00002.MTS

etc.

Used gstreamer to convert to webm. This was after failed (i.e. success but garbage output - small random squares) attempts with both mencoder and ffmpeg:

gst-launch-0.10 filesrc location=whole.mts ! decodebin name=demux ! queue ! ffmpegcolorspace ! vp8enc ! webmmux name=mux ! filesink location=whole.webm demux. ! queue ! progressreport ! audioconvert ! audioresample ! vorbisenc ! mux.

Then used ffmpeg to cut without copy, this is almost instantaneous on a SSD drive (whole.webm is 914M):

ffmpeg -i whole.webm -ss 00:12:55 -to 20:07 -codec copy 03_EWB_Oren.webm

cropping with ffmpeg

ffmpeg -i atlassian_jira_workflow_graph_view_guides_demonstration_20150305_orig.webm -vf "crop=1920:1200:0:0" test.webm

cropping with gstreamer

gst-launch-0.10 -v filesrc location=./atlassian_jira_workflow_graph_view_guides_demonstration_20150305_orig.webm ! decodebin ! ffmpegcolorspace ! videocrop top=0 left=0 right=1920 bottom=0 ! vp8enc ! webmmux ! filesink location=whole.webm


Streaming

icecast2/ogg

Icecast2 is a streaming media server

how to

 ## to configure
 # sudo vim /etc/icecast.xml
 ## to manage service
 # systemctl enable/stop/restart icecast

tested audio streaming using BUTT on windows
tested video streaming using ffmpeg2theora | oggfwd on arch

example of video streaming

# -p preview is 288Kbps video
# -v 4 = 500Kbps
ffmpeg2theora --no-skeleton -p preview --noaudio  video_source.mp4 -o /dev/stdout | oggfwd tami.org.il 8000 password /mount_name


example of video encoding from mp4 to ogg (ogv)

# ffmpeg -i input.mp4 -codec:v libtheora -qscale:v 7 -codec:a libvorbis -qscale:a 5 output.ogv

example of streaming from local to server, you need oggfwd for this.

# this example will show at tami.org.il:8000/channel
# cat zimmertlv-92244715-streamReady.ogv | oggfwd  tami.org.il 8000 password /shannel

insperation


alternatives and addons