Video upload and streaming

Slides:



Advertisements
Similar presentations
Introduction to Macromedia Director 8.5 – Lingo
Advertisements

H.264 Series Camera Object Detection with NAS server Configuration IP Surveillance Internet Camera Copyright © PLANET Technology Corporation.
Layout Library Story line Preview screen Tool selection menu.
Royalty Free Music for Schools Do You Have the To Do a Podcast?
Cosc 5/4730 Multimedia Part 1: Audio media. PLAYING AUDIO Android android.media.
Using Eclipse. Getting Started There are three ways to create a Java project: 1:Select File > New > Project, 2 Select the arrow of the button in the upper.
NUS.SOC.CS Roger Zimmermann Project Create a DASH-compliant (Dynamic Adaptive Streaming over HTTP) streaming system.
1 Configuring Internet- related services (April 22, 2015) © Abdou Illia, Spring 2015.
Cosc 5/4730 Game Design. A short game design primer. A game or animation is built on an animation loop. – Instance variables of “objects” are updated.
Embedding Movies Embedding Movies on a Web Page Streaming Video Converting File Types Exporting FLA as a Movie Embedding Movies in Flash.
Android Programming Beomjoo Seo Sep., 12 CS5248 Fall 2012.
CS371m - Mobile Computing Audio.
By Jesus Juarez. This will be your first initial screen when you run or start the program. But only what’s inside the red outlined box will be recorded!
 Video and Audio Files can be played online just by selecting them  Video are flash files and will not work with Quicktime (Apple) or Windows Media.
Android Development (Basics)
Flash Video Flash ActionScript 3.0 Introduction to Thomas Lövgren, Flash developer
HOW TO DO YOUR PHOTO ESSAY Using software that is very simple to use and easy to access.
Web Proxy Server. Proxy Server Introduction Returns status and error messages. Handles http CGI requests. –For more information about CGI please refer.
Multimedia.
JSP and Servlets Lecture notes by Theodoros Anagnostopoulos.
Chien-Chung Shen Manifest and Activity Chien-Chung Shen
Using Multimedia on the Web
Teaching With the Tubes How to use YouTube and TeacherTube videos to supplement instruction Presented by Farmington Technology Department.
Copyright ©: SAMSUNG & Samsung Hope for Youth. All rights reserved Tutorials Software: Building apps Suitable for: Advanced.
CS5103 Software Engineering Lecture 08 Android Development II.
CS378 - Mobile Computing Web - WebView and Web Services.
Back to content Final Presentation Mr. Phay Sok Thea, class “2B”, group 3, Networking Topic: Mail Client “Outlook Express” *At the end of the presentation.
Introduction to Android Programming (CS5248 Fall 2015) Aditya Kulkarni August 26, 2015 *Based on slides from Paresh Mayami.
Chapter 3 Vector Class. Agenda Design and Implementation of Vector class – add, get, set remove, copy, equals, ensureCapacity Hangman using Vector class.
Home Media Network Hard Drive Training for Update to 2.0 By Erik Collett Revised for Firmware Update.
VoiceThread:. With VoiceThread, group conversations are collected and shared in one place from anywhere in the world. All with no software to install.
Networking: Part 2 (Accessing the Internet). The UI Thread When an application is launched, the system creates a “main” UI thread responsible for handling.
Creating Multimedia Interaction with Windows Media Technologies 7.
Outline Overview Video Format Conversion Connection with An authentication Streaming media Transferring media.
Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging.
Tracking Tasks and Processes. GET_TASK Make a new app, WatchProcesses – Add permission GET_TASK This permission allows the app to collect lots of information.
Android Hello World 1. Click on Start and type eclipse into the textbox 2.
Camera. Make new project – CameraFun – Give permission to use camera write_external _storage Make two buttons – id takePictureButton – id showLastPicButton.
Nfs or ftp server Server 1 Server 2 ClinCapture web app SAS script SAS REST notification service [SAS RNS] (can be run as standalone app) upload / download.
Installing BioPerl – how to add a repository to the PPM Start  All Programs  Active Perl…  Perl Package manager (If you don’t see a screen like the.
Back to the Basics - Video Nick Kwiatkowski Michigan Flex Users Group.
IMovie 10 Overview. Importing Files from a Video Camera into iMovie 1.Plug the camera into a wall outlet using the power supply. (Some cameras will not.
HW#9 Clues CSCI 571 Fall, HW#9 Prototype
Managing File Resource Using File Server Resource Manager Chapter 9 Advance Computer Network Lecture Sorn Pisey
CS378 - Mobile Computing Audio.
FTP COMMANDS OBJECTIVES. General overview. Introduction to FTP server. Types of FTP users. FTP commands examples. FTP commands in action (example of use).
Integrity Check As You Well Know, It Is A Violation Of Academic Integrity To Fake The Results On Any.
Cosc 5/4735 YouTube API. YouTube The YouTube Android Player API enables you to incorporate video playback functionality into your Android applications.
Perl Subroutines User Input Perl on linux Forks and Pipes.
How to Rip and Convert Blu-ray to MOV Videos on Mac to Play Blu-ray Movies on iTunes From:
Lecture 8: FTP into CS System Topics: FTP connect, browse, upload, download Date: Mar 8, 2016.
Download & Convert Videos 1.How to Download Videos from YouTube & other Web sites; and 2.Convert them to WMV format so can be edited in Windows Movie Maker.
Java for android Development Nasrullah Khan. Using instanceof in Android Development the classes such as Button, TextView, and CheckBox, which represent.
Uploading, Encoding and Tracking Files.  Introduction  Source vs. Published File Types  Streaming vs. Downloaded files  The Upload Tab  Playlists.
Clojure.  Follow instructions on lynda.com  Can install all this in other ways, but this is the easiest way to get a development environment working.
Introduction to Android Programming
Mobile Device Development
Y.-H. Chen International College Ming-Chuan University Fall, 2004
Development Environment
Using Video, and Flash Components, and Printing Flash Content
Lecture 7: Service Topics: Services, Playing Media.
Android Studio, Android System Basics and Git
How to Convert VOB to MP4 with VOB to MP4 Converter
Android Topics Asynchronous Callsbacks
Android Developer Fundamentals V2
Lecture 7: Service Topics: Services, Broadcast Receiver, Playing Media.
Working with Libraries
Android Development Tools
Internet TV+ Now, You can watch internet media contents via URL
Presentation transcript:

Video upload and streaming Record video Android camera Looxcie Upload video http put Thread Video streaming Streaming server Video formatting Playing a video stream

Record video Recording with phone’s camera is in another lecture Looxcie records video and holds it in the camera. Looxcie app pulls the video from camera to phone

ftp package New app – VideoStreamer ftp package Add user permission: Internet ftp package Download apache commons.net package from http://commons.apache.org/net/download_net.cgi Get binary Decompress Add package Right on the src directory of the newly made app Select build path -> configure build path Click add external jar. Browse to commons-net-2.2.jar Select “Order and Export” tab Click commons-net-2.2.jar

Using ftp Make new class, FTPHelper Add member function, uploadFile FTPClient ftpClient = new FTPClient(); ftpClient.connect( "128.4.35.59" ); ftpClient.login( "ftpuser", "ftpuser" ); System.out.println("Connected to 128.4.35.59"); System.out.print(ftpClient.getReplyString()); BufferedInputStream buffIn = null; buffIn = new BufferedInputStream(new FileInputStream("/mnt/sdcard/my_mov.mp4")); result = ftpClient.storeFile("my_vov.mp4", buffIn); if (result) { Log.e("DebugInfo","ftp trasnfer returned true"); } else { Log.e("DebugInfo","ftp trasnfer returned false"); }

In VideoStreamer class At the end of onCreate, add FTP ftp = new FTP(); ftp.uploadFile(); Run If the file is very large, this will fail because the UI thread cannot take too long You must use theads

threads asyncTask - easy threads In VideoStreamer class, add new class private class UploadFileTask extends AsyncTask {} Let eclipse add unimplemented methods Move from onCreate to doInBackground FTP ftp = new FTP(); ftp.uploadFile(); In onCreate, add new UploadFileTask().execute(); Run.

Video Server Popular video servers Darwin Wowza Apple version Open source version Supports many formats including quicktime I couldn’t get it working on windows Wowza Not open source Free (for a small number of users/downloaders)

Try it Take video with phone Pull file from phone (in /mnt/sdcard/DCIM/Camera/*.3gp) Put file in C:\Program Files (x86)\Wowza Media Systems\Wowza Media Server 2.2.3\content Open VLC Select menu: media -> network stream enter rtsp://128.4.35.53:1935/vod/mp4:Vid3.mp4 Where Vid3.mp4 is the name Does not work

Streaming Video Format It is not always possible to stream a video captured by any video camera Wowza Media Server and Flash only support H.264 (AVC1, MPEG4 Part 10), AAC (MP4A, AAC, AAC+, HE-AAC) and MP3 in an MP4 file. http://www.wowzamedia.com/forums/content.php?107-GSpot-Tool-to-inspect-MP4-%28QuickTime-container%29-video-audio-codecs The format can be checked Gspot: http://www.headbands.com/gspot/ Shows the format details

transcoding MS Expression can also make video files that can be streamed. But this requires manual effort, whereas ffmpeg can be run from command line or a script Ffmpeg can be used to transcode read a video file compressed in one set of codecs and recompress in another set Transcoding is very slow Works better if the source is low bit-rate. On phone video, select low rate Using ffmpeg is tricky The following perl code transcode.pl #!/usr/bin/perl d:\\uploadedContent\\ffmpeg\\bin\\ffmpeg.exe -i $ARGV[0] -strict experimental -acodec aac -ab 32k -vcodec libx264 -fpre libx264-medium.ffpreset -b 512k $ARGV[0].mp4 Call via>> perl transode.pl filename.3gp These parameters can be adjusted Try it: Take video with camera Pull from phone, move to directory where ffmpeg is located (might need to copy FFPreset files to this directory) Run perl code Wait Move file to directory View with vlc

Video streaming on android Change the VideoStreaming Activity so that it implements SurfaceHolder.Callback Add member variables private SurfaceView mPreview; private SurfaceHolder holder; private MediaPlayer mMediaPlayer; Add surface view to layout. Call it SurfaceView At the end of onCreate, mPreview = (SurfaceView) findViewById(R.id.SurfaceView); holder = mPreview.getHolder(); holder.addCallback(this); holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); Add button, StartVideo Add callback Button startButton = (Button)findViewById(R.id.StartVideo); startButton.setOnClickListener(new View.OnClickListener() {}); In onClick, add playVideo(); Make public void playVideo() { if (mMediaPlayer != null) { mMediaPlayer.release(); mMediaPlayer = null; } mMediaPlayer = new MediaPlayer(); //mMediaPlayer.setDataSource("/mnt/sdcard/DCIM/Camera/VID_20110502_143808.3gp"); // some file mMediaPlayer.setDataSource("rtsp://128.4.35.53:1935/vod/mp4:Vid3.mp4"); // some stream //mMediaPlayer.setDataSource("rtsp://128.4.35.53:1935/vod/mp4:sample.mp4"); mMediaPlayer.setDisplay(holder); mMediaPlayer.prepare(); mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mMediaPlayer.start(); Run It takes a long time. But should run

improvements Lots of things can be improved with callbacks Put progress bar to give the user feedback as video is starting In layout, add ProgressBar Add member variable ProgressBar progressBar; In onCreate, progressBar = (ProgressBar)findViewById(R.id.ProgressBar01); progressBar.setVisibility(View.INVISIBLE); In playVideo At the beginning, add progressBar.setVisibility(View.VISIBLE); After mMediaPlayer = new MediaPlayer();, add mMediaPlayer.setOnPreparedListener(new OnPreparedListener() {}); In onPrepared, add mMediaPlayer.start(); Change mMediaPlayer.prepare(); to mMediaPlayer.prepareAsync(); Remove mMediaPlayer.start(); Now run, and progress bar shows that something is happening But if an error occurs, the progress bar never stops Need to add more callbacks setOnErrorListener(android.media.MediaPlayer.OnErrorListener) to catch errors setOnCompletionListener(OnCompletionListener)., when it finished, to clean up screen or something setOnBufferingUpdateListener to track the buffer, this gives a percent