
Recherche avancée
Autres articles (14)
-
Ajouter notes et légendes aux images
7 février 2011, parPour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
Modification lors de l’ajout d’un média
Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...) -
Emballe médias : à quoi cela sert ?
4 février 2011, parCe plugin vise à gérer des sites de mise en ligne de documents de tous types.
Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ; -
Les formats acceptés
28 janvier 2010, parLes commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
ffmpeg -codecs ffmpeg -formats
Les format videos acceptés en entrée
Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
Les formats vidéos de sortie possibles
Dans un premier temps on (...)
Sur d’autres sites (4570)
-
VP8 : a retrospective
I’ve been working the past few weeks to help finish up the ffmpeg VP8 decoder, the first community implementation of On2′s VP8 video format. Now that I’ve written a thousand or two lines of assembly code and optimized a good bit of the C code, I’d like to look back at VP8 and comment on a variety of things — both good and bad — that slipped the net the first time, along with things that have changed since the time of that blog post.
These are less-so issues related to compression — that issue has been beaten to death, particularly in MSU’s recent comparison, where x264 beat the crap out of VP8 and the VP8 developers pulled a Pinocchio in the developer comments. But that was expected and isn’t particularly interesting, so I won’t go into that. VP8 doesn’t have to be the best in the world in order to be useful.
When the ffmpeg VP8 decoder is complete (just a few more asm functions to go), we’ll hopefully be able to post some benchmarks comparing it to libvpx.
1. The spec, er, I mean, bitstream guide.
Google has reneged on their claim that a spec existed at all and renamed it a “bitstream guide”. This is probably after it was found that — not merely was it incomplete — but at least a dozen places in the spec differed wildly from what was actually in their own encoder and decoder software ! The deblocking filter, motion vector clamping, probability tables, and many more parts simply disagreed flat-out with the spec. Fortunately, Ronald Bultje, one of the main authors of the ffmpeg VP8 decoder, is rather skilled at reverse-engineering, so we were able to put together a matching implementation regardless.
Most of the differences aren’t particularly important — they don’t have a huge effect on compression or anything — but make it vastly more difficult to implement a “working” VP8 decoder, or for that matter, decide what “working” really is. For example, Google’s decoder will, if told to “swap the ALT and GOLDEN reference frames”, overwrite both with GOLDEN, because it first sets GOLDEN = ALT, and then sets ALT = GOLDEN. Is this a bug ? Or is this how it’s supposed to work ? It’s hard to tell — there isn’t a spec to say so. Google says that whatever libvpx does is right, but I doubt they intended this.
I expect a spec will eventually be written, but it was a bit obnoxious of Google — both to the community and to their own developers — to release so early that they didn’t even have their own documentation ready.
2. The TM intra prediction mode.
One thing I glossed over in the original piece was that On2 had added an extra intra prediction mode to the standard batch that H.264 came with — they replaced Planar with “TM pred”. For i4x4, which didn’t have a Planar mode, they just added it without replacing an old one, resulting in a total of 10 modes to H.264′s 9. After understanding and writing assembly code for TM pred, I have to say that it is quite a cool idea. Here’s how it works :
1. Let us take a block of size 4×4, 8×8, or 16×16.
2. Define the pixels bordering the top of this block (starting from the left) as T[0], T[1], T[2]…
3. Define the pixels bordering the left of this block (starting from the top) as L[0], L[1], L[2]…
4. Define the pixel above the top-left of the block as TL.
5. Predict every pixel <X,Y> in the block to be equal to clip3( T[X] + L[Y] – TL, 0, 255).
It’s effectively a generalization of gradient prediction to the block level — predict each pixel based on the gradient between its top and left pixels, and the topleft. According to the VP8 devs, it’s chosen by the encoder quite a lot of the time, which isn’t surprising ; it seems like a pretty good idea. As just one more intra pred mode, it’s not going to do magic for compression, but it’s a cool idea and elegantly simple.
3. Performance and the deblocking filter.
On2 advertised for quite some that VP8′s goal was to be significantly faster to decode than H.264. When I saw the spec, I waited for the punchline, but apparently they were serious. There’s nothing wrong with being of similar speed or a bit slower — but I was rather confused as to the fact that their design didn’t match their stated goal at all. What apparently happened is they had multiple profiles of VP8 — high and low complexity profiles. They marketed the performance of the low complexity ones while touting the quality of the high complexity ones, a tad dishonest. More importantly though, practically nobody is using the low complexity modes, so anyone writing a decoder has to be prepared to handle the high complexity ones, which are the default.
The primary time-eater here is the deblocking filter. VP8, being an H.264 derivative, has much the same problem as H.264 does in terms of deblocking — it spends an absurd amount of time there. As I write this post, we’re about to finish some of the deblocking filter asm code, but before it’s committed, up to 70% or more of total decoding time is spent in the deblocking filter ! Like H.264, it suffers from the 4×4 transform problem : a 4×4 transform requires a total of 8 length-16 and 8 length-8 loopfilter calls per macroblock, while Theora, with only an 8×8 transform, requires half that.
This problem is aggravated in VP8 by the fact that the deblocking filter isn’t strength-adaptive ; if even one 4×4 block in a macroblock contains coefficients, every single edge has to be deblocked. Furthermore, the deblocking filter itself is quite complicated ; the “inner edge” filter is a bit more complex than H.264′s and the “macroblock edge” filter is vastly more complicated, having two entirely different codepaths chosen on a per-pixel basis. Of course, in SIMD, this means you have to do both and mask them together at the end.
There’s nothing wrong with a good-but-slow deblocking filter. But given the amount of deblocking one needs to do in a 4×4-transform-based format, it might have been a better choice to make the filter simpler. It’s pretty difficult to beat H.264 on compression, but it’s certainly not hard to beat it on speed — and yet it seems VP8 missed a perfectly good chance to do so. Another option would have been to pick an 8×8 transform instead of 4×4, reducing the amount of deblocking by a factor of 2.
And yes, there’s a simple filter available in the low complexity profile, but it doesn’t help if nobody uses it.
4. Tree-based arithmetic coding.
Binary arithmetic coding has become the standard entropy coding method for a wide variety of compressed formats, ranging from LZMA to VP6, H.264 and VP8. It’s simple, relatively fast compared to other arithmetic coding schemes, and easy to make adaptive. The problem with this is that you have to come up with a method for converting non-binary symbols into a list of binary symbols, and then choosing what probabilities to use to code each one. Here’s an example from H.264, the sub-partition mode symbol, which is either 8×8, 8×4, 4×8, or 4×4. encode_decision( context, bit ) writes a binary decision (bit) into a numbered context (context).
8×8 : encode_decision( 21, 0 ) ;
8×4 : encode_decision( 21, 1 ) ; encode_decision( 22, 0 ) ;
4×8 : encode_decision( 21, 1 ) ; encode_decision( 22, 1 ) ; encode_decision( 23, 1 ) ;
4×4 : encode_decision( 21, 1 ) ; encode_decision( 22, 1 ) ; encode_decision( 23, 0 ) ;
As can be seen, this is clearly like a Huffman tree. Wouldn’t it be nice if we could represent this in the form of an actual tree data structure instead of code ? On2 thought so — they designed a simple system in VP8 that allowed all binarization schemes in the entire format to be represented as simple tree data structures. This greatly reduces the complexity — not speed-wise, but implementation-wise — of the entropy coder. Personally, I quite like it.
5. The inverse transform ordering.
I should at some point write a post about common mistakes made in video formats that everyone keeps making. These are not issues that are patent worries or huge issues for compression — just stupid mistakes that are repeatedly made in new video formats, probably because someone just never asked the guy next to him “does this look stupid ?” before sticking it in the spec.
One common mistake is the problem of transform ordering. Every sane 2D transform is “separable” — that is, it can be done by doing a 1D transform vertically and doing the 1D transform again horizontally (or vice versa). The original iDCT as used in JPEG, H.263, and MPEG-1/2/4 was an “idealized” iDCT — nobody had to use the exact same iDCT, theirs just had to give very close results to a reference implementation. This ended up resulting in a lot of practical problems. It was also slow ; the only way to get an accurate enough iDCT was to do all the intermediate math in 32-bit.
Practically every modern format, accordingly, has specified an exact iDCT. This includes H.264, VC-1, RV40, Theora, VP8, and many more. Of course, with an exact iDCT comes an exact ordering — while the “real” iDCT can be done in any order, an exact iDCT usually requires an exact order. That is, it specifies horizontal and then vertical, or vertical and then horizontal.
All of these transforms end up being implemented in SIMD. In SIMD, a vertical transform is generally the only option, so a transpose is added to the process instead of doing a horizontal transform. Accordingly, there are two ways to do it :
1. Transpose, vertical transform, transpose, vertical transform.
2. Vertical transform, transpose, vertical transform, transpose.
These may seem to be equally good, but there’s one catch — if the transpose is done first, it can be completely eliminated by merging it into the coefficient decoding process. On many modern CPUs, particularly x86, transposes are very expensive, so eliminating one of the two gives a pretty significant speed benefit.
H.264 did it way 1).
VC-1 did it way 1).
Theora (inherited from VP3) did it way 1).
But no. VP8 has to do it way 2), where you can’t eliminate the transpose. Bah. It’s not a huge deal ; probably only 1-2% overall at most speed-wise, but it’s just a needless waste. What really bugs me is that VP3 got it right — why in the world did they screw it up this time around if they got it right beforehand ?
RV40 is the other modern format I know that made this mistake.
(NB : You can do transforms without a transpose, but it’s generally not worth it unless the intermediate needs 32-bit math, as in the case of the “real” iDCT.)
6. Not supporting interlacing.
THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU.
Interlacing was the scourge of H.264. It weaseled its way into every nook and cranny of the spec, making every decoder a thousand lines longer. H.264 even included a highly complicated — and effective — dedicated interlaced coding scheme, MBAFF. The mere existence of MBAFF, despite its usefulness for broadcasters and others still stuck in the analog age with their 1080i, 576i , and 480i content, was a blight upon the video format.
VP8 has once and for all avoided it.
And if anyone suggests adding interlaced support to the experimental VP8 branch, find a straightjacket and padded cell for them before they cause any real damage.
-
Youtube Watch Me Android application closing unexpectedly
18 septembre 2015, par KichuI create android application from https://github.com/youtube/yt-watchme.
When I try to create the event using the "CREATE LIVE EVENT" button.It throws some following error. I think it’s happening due to the camera permission issue.
ERROR :
09-17 11:43:53.582 32383-32383/com.google.android.apps.watchme E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.google.android.apps.watchme, PID: 32383
java.lang.NoSuchMethodError: com.google.android.apps.watchme.StreamerActivity.checkSelfPermission
at com.google.android.apps.watchme.StreamerActivity.startStreaming(StreamerActivity.java:174)
at com.google.android.apps.watchme.StreamerActivity.access$200(StreamerActivity.java:46)
at com.google.android.apps.watchme.StreamerActivity$1.onServiceConnected(StreamerActivity.java:63)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1110)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1127)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5097)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)Any one please suggest . How can I solve this issue.
Thanks In Advance
Code Update :
Manifest file XML
<manifest package="com.google.android.apps.watchme">
<application>
<activity>
<action></action>
<category></category>
</activity>
<activity></activity>
<service></service>
</application>
</manifest>Stream Activity File
/*
* Copyright (c) 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.watchme;
import android.Manifest;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.pm.PackageManager;
import android.hardware.Camera;
import android.os.Bundle;
import android.os.IBinder;
import android.os.PowerManager;
import android.support.design.widget.Snackbar;
import android.support.v4.app.ActivityCompat;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ToggleButton;
import com.google.android.apps.watchme.util.Utils;
import com.google.android.apps.watchme.util.YouTubeApi;
import java.util.ArrayList;
import java.util.List;
/**
* @author Ibrahim Ulukaya <ulukaya@google.com>
* <p></p>
* StreamerActivity class which previews the camera and streams via StreamerService.
*/
public class StreamerActivity extends Activity {
// CONSTANTS
// TODO: Stop hardcoding this and read values from the camera's supported sizes.
public static final int CAMERA_WIDTH = 640;
public static final int CAMERA_HEIGHT = 480;
private static final int REQUEST_CAMERA_MICROPHONE = 0;
// Member variables
private StreamerService streamerService;
private ServiceConnection streamerConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName className, IBinder service) {
Log.d(MainActivity.APP_NAME, "onServiceConnected");
streamerService = ((StreamerService.LocalBinder) service).getService();
restoreStateFromService();
startStreaming();
}
@Override
public void onServiceDisconnected(ComponentName className) {
Log.e(MainActivity.APP_NAME, "onServiceDisconnected");
// This should never happen, because our service runs in the same process.
streamerService = null;
}
};
private PowerManager.WakeLock wakeLock;
private Preview preview;
private String rtmpUrl;
private String broadcastId;
@Override
public void onCreate(Bundle savedInstanceState) {
Log.d(MainActivity.APP_NAME, "onCreate");
super.onCreate(savedInstanceState);
broadcastId = getIntent().getStringExtra(YouTubeApi.BROADCAST_ID_KEY);
//Log.v(MainActivity.APP_NAME, broadcastId);
rtmpUrl = getIntent().getStringExtra(YouTubeApi.RTMP_URL_KEY);
if (rtmpUrl == null) {
Log.w(MainActivity.APP_NAME, "No RTMP URL was passed in; bailing.");
finish();
}
Log.i(MainActivity.APP_NAME, String.format("Got RTMP URL '%s' from calling activity.", rtmpUrl));
setContentView(R.layout.streamer);
preview = (Preview) findViewById(R.id.surfaceViewPreview);
if (!bindService(new Intent(this, StreamerService.class), streamerConnection,
BIND_AUTO_CREATE | BIND_DEBUG_UNBIND)) {
Log.e(MainActivity.APP_NAME, "Failed to bind StreamerService!");
}
final ToggleButton toggleButton = (ToggleButton) findViewById(R.id.toggleBroadcasting);
toggleButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (toggleButton.isChecked()) {
streamerService.startStreaming(rtmpUrl);
} else {
streamerService.stopStreaming();
}
}
});
}
@Override
protected void onResume() {
Log.d(MainActivity.APP_NAME, "onResume");
super.onResume();
if (streamerService != null) {
restoreStateFromService();
}
}
@Override
protected void onPause() {
Log.d(MainActivity.APP_NAME, "onPause");
super.onPause();
if (preview != null) {
preview.setCamera(null);
}
if (streamerService != null) {
streamerService.releaseCamera();
}
}
@Override
protected void onDestroy() {
Log.d(MainActivity.APP_NAME, "onDestroy");
super.onDestroy();
if (streamerConnection != null) {
unbindService(streamerConnection);
}
stopStreaming();
if (streamerService != null) {
streamerService.releaseCamera();
}
}
private void restoreStateFromService() {
preview.setCamera(Utils.getCamera(Camera.CameraInfo.CAMERA_FACING_FRONT));
}
private void startStreaming() {
Log.d(MainActivity.APP_NAME, "startStreaming");
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
wakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, this.getClass().getName());
wakeLock.acquire();
if (!streamerService.isStreaming()) {
String cameraPermission = Manifest.permission.CAMERA;
String microphonePermission = Manifest.permission.RECORD_AUDIO;
int hasCamPermission = checkSelfPermission(cameraPermission);
int hasMicPermission = checkSelfPermission(microphonePermission);
List<string> permissions = new ArrayList<string>();
if (hasCamPermission != PackageManager.PERMISSION_GRANTED) {
permissions.add(cameraPermission);
if (ActivityCompat.shouldShowRequestPermissionRationale(this,
Manifest.permission.CAMERA)) {
// Provide rationale in Snackbar to request permission
Snackbar.make(preview, R.string.permission_camera_rationale,
Snackbar.LENGTH_INDEFINITE).show();
} else {
// Explain in Snackbar to turn on permission in settings
Snackbar.make(preview, R.string.permission_camera_explain,
Snackbar.LENGTH_INDEFINITE).show();
}
}
if (hasMicPermission != PackageManager.PERMISSION_GRANTED) {
permissions.add(microphonePermission);
if (ActivityCompat.shouldShowRequestPermissionRationale(this,
Manifest.permission.RECORD_AUDIO)) {
// Provide rationale in Snackbar to request permission
Snackbar.make(preview, R.string.permission_microphone_rationale,
Snackbar.LENGTH_INDEFINITE).show();
} else {
// Explain in Snackbar to turn on permission in settings
Snackbar.make(preview, R.string.permission_microphone_explain,
Snackbar.LENGTH_INDEFINITE).show();
}
}
if (!permissions.isEmpty()) {
String[] params = permissions.toArray(new String[permissions.size()]);
ActivityCompat.requestPermissions(this, params, REQUEST_CAMERA_MICROPHONE);
} else {
// We already have permission, so handle as normal
streamerService.startStreaming(rtmpUrl);
}
}
}
/**
* Callback received when a permissions request has been completed.
*/
@Override
public void onRequestPermissionsResult(int requestCode,
String permissions[], int[] grantResults) {
switch (requestCode) {
case REQUEST_CAMERA_MICROPHONE: {
Log.i(MainActivity.APP_NAME, "Received response for camera with mic permissions request.");
// We have requested multiple permissions for contacts, so all of them need to be
// checked.
if (Utils.verifyPermissions(grantResults)) {
// permissions were granted, yay! do the
// streamer task you need to do.
streamerService.startStreaming(rtmpUrl);
} else {
Log.i(MainActivity.APP_NAME, "Camera with mic permissions were NOT granted.");
Snackbar.make(preview, R.string.permissions_not_granted,
Snackbar.LENGTH_SHORT)
.show();
}
break;
}
// other 'switch' lines to check for other
// permissions this app might request
}
return;
}
private void stopStreaming() {
Log.d(MainActivity.APP_NAME, "stopStreaming");
if (wakeLock != null) {
wakeLock.release();
wakeLock = null;
}
if (streamerService.isStreaming()) {
streamerService.stopStreaming();
}
}
public void endEvent(View view) {
Intent data = new Intent();
data.putExtra(YouTubeApi.BROADCAST_ID_KEY, broadcastId);
if (getParent() == null) {
setResult(Activity.RESULT_OK, data);
} else {
getParent().setResult(Activity.RESULT_OK, data);
}
finish();
}
}
</string></string>Update ERROR CODE :
08:57:14.447 18829-18829/com.google.android.apps.watchme E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.google.android.apps.watchme, PID: 18829
java.lang.UnsatisfiedLinkError: Couldn't load ffmpeg from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.google.android.apps.watchme-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.google.android.apps.watchme-1, /vendor/lib, /system/lib]]]: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:358)
at java.lang.System.loadLibrary(System.java:526)
at com.google.android.apps.watchme.Ffmpeg.<clinit>(Ffmpeg.java:26)
at com.google.android.apps.watchme.VideoStreamingConnection.open(VideoStreamingConnection.java:71)
at com.google.android.apps.watchme.StreamerService.startStreaming(StreamerService.java:80)
at com.google.android.apps.watchme.StreamerActivity.startStreaming(StreamerActivity.java:212)
at com.google.android.apps.watchme.StreamerActivity.access$200(StreamerActivity.java:47)
at com.google.android.apps.watchme.StreamerActivity$1.onServiceConnected(StreamerActivity.java:64)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1110)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1127)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5097)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
</clinit> -
Youtue Watch Me Android application closing unexpectedly
18 septembre 2015, par KichuI create android application from https://github.com/youtube/yt-watchme.
When I try to create the event using the "CREATE LIVE EVENT" button.It throws some following error. I think it’s happening due to the camera permission issue.
ERROR :
09-17 11:43:53.582 32383-32383/com.google.android.apps.watchme E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.google.android.apps.watchme, PID: 32383
java.lang.NoSuchMethodError: com.google.android.apps.watchme.StreamerActivity.checkSelfPermission
at com.google.android.apps.watchme.StreamerActivity.startStreaming(StreamerActivity.java:174)
at com.google.android.apps.watchme.StreamerActivity.access$200(StreamerActivity.java:46)
at com.google.android.apps.watchme.StreamerActivity$1.onServiceConnected(StreamerActivity.java:63)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1110)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1127)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5097)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)Any one please suggest . How can I solve this issue.
Thanks In Advance
Code Update :
Manifest file XML
<manifest package="com.google.android.apps.watchme">
<application>
<activity>
<action></action>
<category></category>
</activity>
<activity></activity>
<service></service>
</application>
</manifest>Stream Activity File
/*
* Copyright (c) 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.watchme;
import android.Manifest;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.pm.PackageManager;
import android.hardware.Camera;
import android.os.Bundle;
import android.os.IBinder;
import android.os.PowerManager;
import android.support.design.widget.Snackbar;
import android.support.v4.app.ActivityCompat;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ToggleButton;
import com.google.android.apps.watchme.util.Utils;
import com.google.android.apps.watchme.util.YouTubeApi;
import java.util.ArrayList;
import java.util.List;
/**
* @author Ibrahim Ulukaya <ulukaya@google.com>
* <p></p>
* StreamerActivity class which previews the camera and streams via StreamerService.
*/
public class StreamerActivity extends Activity {
// CONSTANTS
// TODO: Stop hardcoding this and read values from the camera's supported sizes.
public static final int CAMERA_WIDTH = 640;
public static final int CAMERA_HEIGHT = 480;
private static final int REQUEST_CAMERA_MICROPHONE = 0;
// Member variables
private StreamerService streamerService;
private ServiceConnection streamerConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName className, IBinder service) {
Log.d(MainActivity.APP_NAME, "onServiceConnected");
streamerService = ((StreamerService.LocalBinder) service).getService();
restoreStateFromService();
startStreaming();
}
@Override
public void onServiceDisconnected(ComponentName className) {
Log.e(MainActivity.APP_NAME, "onServiceDisconnected");
// This should never happen, because our service runs in the same process.
streamerService = null;
}
};
private PowerManager.WakeLock wakeLock;
private Preview preview;
private String rtmpUrl;
private String broadcastId;
@Override
public void onCreate(Bundle savedInstanceState) {
Log.d(MainActivity.APP_NAME, "onCreate");
super.onCreate(savedInstanceState);
broadcastId = getIntent().getStringExtra(YouTubeApi.BROADCAST_ID_KEY);
//Log.v(MainActivity.APP_NAME, broadcastId);
rtmpUrl = getIntent().getStringExtra(YouTubeApi.RTMP_URL_KEY);
if (rtmpUrl == null) {
Log.w(MainActivity.APP_NAME, "No RTMP URL was passed in; bailing.");
finish();
}
Log.i(MainActivity.APP_NAME, String.format("Got RTMP URL '%s' from calling activity.", rtmpUrl));
setContentView(R.layout.streamer);
preview = (Preview) findViewById(R.id.surfaceViewPreview);
if (!bindService(new Intent(this, StreamerService.class), streamerConnection,
BIND_AUTO_CREATE | BIND_DEBUG_UNBIND)) {
Log.e(MainActivity.APP_NAME, "Failed to bind StreamerService!");
}
final ToggleButton toggleButton = (ToggleButton) findViewById(R.id.toggleBroadcasting);
toggleButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (toggleButton.isChecked()) {
streamerService.startStreaming(rtmpUrl);
} else {
streamerService.stopStreaming();
}
}
});
}
@Override
protected void onResume() {
Log.d(MainActivity.APP_NAME, "onResume");
super.onResume();
if (streamerService != null) {
restoreStateFromService();
}
}
@Override
protected void onPause() {
Log.d(MainActivity.APP_NAME, "onPause");
super.onPause();
if (preview != null) {
preview.setCamera(null);
}
if (streamerService != null) {
streamerService.releaseCamera();
}
}
@Override
protected void onDestroy() {
Log.d(MainActivity.APP_NAME, "onDestroy");
super.onDestroy();
if (streamerConnection != null) {
unbindService(streamerConnection);
}
stopStreaming();
if (streamerService != null) {
streamerService.releaseCamera();
}
}
private void restoreStateFromService() {
preview.setCamera(Utils.getCamera(Camera.CameraInfo.CAMERA_FACING_FRONT));
}
private void startStreaming() {
Log.d(MainActivity.APP_NAME, "startStreaming");
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
wakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, this.getClass().getName());
wakeLock.acquire();
if (!streamerService.isStreaming()) {
String cameraPermission = Manifest.permission.CAMERA;
String microphonePermission = Manifest.permission.RECORD_AUDIO;
int hasCamPermission = checkSelfPermission(cameraPermission);
int hasMicPermission = checkSelfPermission(microphonePermission);
List<string> permissions = new ArrayList<string>();
if (hasCamPermission != PackageManager.PERMISSION_GRANTED) {
permissions.add(cameraPermission);
if (ActivityCompat.shouldShowRequestPermissionRationale(this,
Manifest.permission.CAMERA)) {
// Provide rationale in Snackbar to request permission
Snackbar.make(preview, R.string.permission_camera_rationale,
Snackbar.LENGTH_INDEFINITE).show();
} else {
// Explain in Snackbar to turn on permission in settings
Snackbar.make(preview, R.string.permission_camera_explain,
Snackbar.LENGTH_INDEFINITE).show();
}
}
if (hasMicPermission != PackageManager.PERMISSION_GRANTED) {
permissions.add(microphonePermission);
if (ActivityCompat.shouldShowRequestPermissionRationale(this,
Manifest.permission.RECORD_AUDIO)) {
// Provide rationale in Snackbar to request permission
Snackbar.make(preview, R.string.permission_microphone_rationale,
Snackbar.LENGTH_INDEFINITE).show();
} else {
// Explain in Snackbar to turn on permission in settings
Snackbar.make(preview, R.string.permission_microphone_explain,
Snackbar.LENGTH_INDEFINITE).show();
}
}
if (!permissions.isEmpty()) {
String[] params = permissions.toArray(new String[permissions.size()]);
ActivityCompat.requestPermissions(this, params, REQUEST_CAMERA_MICROPHONE);
} else {
// We already have permission, so handle as normal
streamerService.startStreaming(rtmpUrl);
}
}
}
/**
* Callback received when a permissions request has been completed.
*/
@Override
public void onRequestPermissionsResult(int requestCode,
String permissions[], int[] grantResults) {
switch (requestCode) {
case REQUEST_CAMERA_MICROPHONE: {
Log.i(MainActivity.APP_NAME, "Received response for camera with mic permissions request.");
// We have requested multiple permissions for contacts, so all of them need to be
// checked.
if (Utils.verifyPermissions(grantResults)) {
// permissions were granted, yay! do the
// streamer task you need to do.
streamerService.startStreaming(rtmpUrl);
} else {
Log.i(MainActivity.APP_NAME, "Camera with mic permissions were NOT granted.");
Snackbar.make(preview, R.string.permissions_not_granted,
Snackbar.LENGTH_SHORT)
.show();
}
break;
}
// other 'switch' lines to check for other
// permissions this app might request
}
return;
}
private void stopStreaming() {
Log.d(MainActivity.APP_NAME, "stopStreaming");
if (wakeLock != null) {
wakeLock.release();
wakeLock = null;
}
if (streamerService.isStreaming()) {
streamerService.stopStreaming();
}
}
public void endEvent(View view) {
Intent data = new Intent();
data.putExtra(YouTubeApi.BROADCAST_ID_KEY, broadcastId);
if (getParent() == null) {
setResult(Activity.RESULT_OK, data);
} else {
getParent().setResult(Activity.RESULT_OK, data);
}
finish();
}
}
</string></string>Update ERROR CODE :
08:57:14.447 18829-18829/com.google.android.apps.watchme E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.google.android.apps.watchme, PID: 18829
java.lang.UnsatisfiedLinkError: Couldn't load ffmpeg from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.google.android.apps.watchme-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.google.android.apps.watchme-1, /vendor/lib, /system/lib]]]: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:358)
at java.lang.System.loadLibrary(System.java:526)
at com.google.android.apps.watchme.Ffmpeg.<clinit>(Ffmpeg.java:26)
at com.google.android.apps.watchme.VideoStreamingConnection.open(VideoStreamingConnection.java:71)
at com.google.android.apps.watchme.StreamerService.startStreaming(StreamerService.java:80)
at com.google.android.apps.watchme.StreamerActivity.startStreaming(StreamerActivity.java:212)
at com.google.android.apps.watchme.StreamerActivity.access$200(StreamerActivity.java:47)
at com.google.android.apps.watchme.StreamerActivity$1.onServiceConnected(StreamerActivity.java:64)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1110)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1127)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5097)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
</clinit>