
Recherche avancée
Médias (91)
-
Chuck D with Fine Arts Militia - No Meaning No
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Paul Westerberg - Looking Up in Heaven
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Le Tigre - Fake French
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Thievery Corporation - DC 3000
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Dan the Automator - Relaxation Spa Treatment
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Gilberto Gil - Oslodum
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
Autres articles (78)
-
D’autres logiciels intéressants
12 avril 2011, parOn ne revendique pas d’être les seuls à faire ce que l’on fait ... et on ne revendique surtout pas d’être les meilleurs non plus ... Ce que l’on fait, on essaie juste de le faire bien, et de mieux en mieux...
La liste suivante correspond à des logiciels qui tendent peu ou prou à faire comme MediaSPIP ou que MediaSPIP tente peu ou prou à faire pareil, peu importe ...
On ne les connais pas, on ne les a pas essayé, mais vous pouvez peut être y jeter un coup d’oeil.
Videopress
Site Internet : (...) -
MediaSPIP Player : problèmes potentiels
22 février 2011, parLe lecteur ne fonctionne pas sur Internet Explorer
Sur Internet Explorer (8 et 7 au moins), le plugin utilise le lecteur Flash flowplayer pour lire vidéos et son. Si le lecteur ne semble pas fonctionner, cela peut venir de la configuration du mod_deflate d’Apache.
Si dans la configuration de ce module Apache vous avez une ligne qui ressemble à la suivante, essayez de la supprimer ou de la commenter pour voir si le lecteur fonctionne correctement : /** * GeSHi (C) 2004 - 2007 Nigel McNie, (...) -
L’agrémenter visuellement
10 avril 2011MediaSPIP est basé sur un système de thèmes et de squelettes. Les squelettes définissent le placement des informations dans la page, définissant un usage spécifique de la plateforme, et les thèmes l’habillage graphique général.
Chacun peut proposer un nouveau thème graphique ou un squelette et le mettre à disposition de la communauté.
Sur d’autres sites (5001)
-
Compress video with ffmpeg4android library
30 mars 2015, par Huy TowerI tried to follow ffmpeg4android library, and I get the problem when compressing the video, as the Log image below.
I use intent to transfer to Compressing Media class,
Intent intent = new Intent(this, CompressingMedia.class);
intent.putExtra("file_path", mLlItems.get(0).getPath());
startActivity(intent);This is the class was transfered to :
public class CompressingMedia extends BaseWizard {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
Log.d(Prefs.TAG, "path " + intent.getExtras().getString("file_path"));
// /storage/emulated/0/DCIM/Camera/VID_20140312_090612.mp4
String command = "ffmpeg -y -i " + intent.getExtras().getString("file_path") +
" -strict experimental -s 320x240 -r 15 -aspect 3:4 -ab 12288 -vcodec mpeg4 -b 2097152 -sample_fmt s16 /sdcard/out.mp4";
// if you want to change the default work location (/sdcard/videokit/) use the uncomment the below method.
// It must be defined before calling the copyLicenseAndDemoFilesFromAssetsToSDIfNeeded method,
// in order for this method to copy the assets to the correct location.
// setWorkingFolder("/sdcard/videokit/");
// this will copy the license file and the demo video file.
// to the videokit work folder location.
// without the license file the library will not work.
copyLicenseAndDemoFilesFromAssetsToSDIfNeeded();
commandStr = command;
setCommand(commandStr);
runTranscoing();
}
}Although I received the notification Transcoding Successfully, but it looks like the capacity of file after compressing is always be 0. (the log in the bottom of images)
I don’t know the result as image below is good or not, I can not get the expected result - The video was compressed totally successfully.
Someone know why after compressing the file is always be 0, please tell me. Thanks.
This is the Log Cat :
03-13 14:49:45.655 : I/ActivityManager(6065) : Timeline :
Activity_launch_request id:app.cloudstringers time:3821235903-13 14:49:45.665 : V/Home(6065) : Global ID is 000400010007 ;Sell is 3
03-13 14:49:45.770 : D/ffmpeg4android(6065) : path
/storage/emulated/0/videokit/out.mp403-13 14:49:45.770 : I/ffmpeg4android(6065) : workingFolderPath :
/sdcard/videokit/03-13 14:49:45.775 : D/ffmpeg4android(6065) : Working directory exists,
not coping assests (license file and demo videos)03-13 14:49:45.785 : D/ffmpeg4android(6065) : output directory exists.
03-13 14:49:45.785 : I/ffmpeg4android(6065) : Command is set
03-13 14:49:45.785 : I/ffmpeg4android(6065) : set
remoteNotificationIconId : 003-13 14:49:45.785 : D/ffmpeg4android(6065) : Client Cannot unbind -
service not bound03-13 14:49:45.785 : D/ffmpeg4android(6065) : Client stopService()
03-13 14:49:45.790 : W/ContextImpl(6065) : Implicit intents with
startService are not safe : Intent
act=com.netcompss.ffmpeg4android.FFMpegRemoteServiceBridge
android.content.ContextWrapper.stopService:499
com.netcompss.ffmpeg4android_client.BaseWizard.stopService:451
com.netcompss.ffmpeg4android_client.BaseWizard.runTranscoing:28503-13 14:49:45.795 : I/ffmpeg4android(6065) :
!!!!!!!!!!!!!!!!!!services.size() : 103-13 14:49:45.795 : I/ffmpeg4android(6065) : putting Base categoty
03-13 14:49:45.810 : D/ffmpeg4android(6065) : started :
com.netcompss.ffmpeg4android.FFMpegRemoteServiceBridge03-13 14:49:45.810 : D/ffmpeg4android(6065) : Client startService()
03-13 14:49:45.810 : D/ffmpeg4android(6065) : bindService() called
03-13 14:49:45.815 : W/ContextImpl(6065) : Implicit intents with
startService are not safe : Intent
act=com.netcompss.ffmpeg4android.FFMpegRemoteServiceBridge
android.content.ContextWrapper.bindService:517
com.netcompss.ffmpeg4android_client.BaseWizard.bindService:462
com.netcompss.ffmpeg4android_client.BaseWizard.runTranscoing:28803-13 14:49:45.820 : D/ffmpeg4android(6065) : Client bindService()
03-13 14:49:45.935 : I/ffmpeg4android(6616) : =======service onCreate() :
Stopping forground (to overcome 2.3.x bug)03-13 14:49:45.935 : I/ffmpeg4android(6616) : =======service
onBind()=======03-13 14:49:45.940 : I/ffmpeg4android(6616) : ===onStartCommand called
03-13 14:49:45.940 : I/ffmpeg4android(6616) : ===onStartCommand cat :
Base03-13 14:49:45.940 : D/ffmpeg4android(6616) : onStartCommand,
START_STICKY, base Command03-13 14:49:45.955 : I/ffmpeg4android(6616) : get
remoteNotificationIconId : 003-13 14:49:45.955 : I/ffmpeg4android(6616) : notifIcon is set
03-13 14:49:45.955 : I/ffmpeg4android(6616) : Start RemoteService with
notification id : 532603-13 14:49:45.965 : I/ffmpeg4android(6616) : Run called.
03-13 14:49:45.965 : D/ffmpeg4android(6616) : Sleeping, waiting for
command03-13 14:49:45.970 : D/ffmpeg4android(6065) : Client
onServiceConnected()03-13 14:49:45.970 : I/ffmpeg4android(6065) : invokeService called
03-13 14:49:45.970 : I/Videokit(6065) : licenseCheck in path :
/sdcard/videokit03-13 14:49:45.970 : I/Videokit(6065) : isLicExistsComplex...
03-13 14:49:45.970 : I/Videokit(6065) : trying to open
/sdcard/videokit/ffmpeglicense.lic03-13 14:49:45.970 : I/Videokit(6065) : license file found...
03-13 14:49:45.970 : I/Videokit(6065) : time decoded : 1394535283
03-13 14:49:45.970 : I/Videokit(6065) : timeStrDec 1394535283 is a valid
number.03-13 14:49:45.970 : I/Videokit(6065) : time diff : 161702
03-13 14:49:45.970 : I/Videokit(6065) : You used 1 of your 15 trial
days.03-13 14:49:45.970 : I/ffmpeg4android(6065) : setting remote
notification info03-13 14:49:45.970 : D/ffmpeg4android(6616) : command items num : 21
03-13 14:49:45.970 : D/ffmpeg4android(6616) : command : ffmpeg -y -i
/storage/emulated/0/videokit/out.mp4 -strict experimental -s 320x240
-r 15 -aspect 3:4 -ab 12288 -vcodec mpeg4 -b 2097152 -sample_fmt s16 /sdcard/out.mp403-13 14:49:45.970 : D/ffmpeg4android(6616) : workingFolder from remote :
/sdcard/videokit03-13 14:49:45.970 : D/ffmpeg4android(6065) : deleteing :
/sdcard/videokit/vk.log isdeleted : true03-13 14:49:45.975 : D/ffmpeg4android(6065) : deleteing :
/sdcard/videokit/ffmpeg4android.log isdeleted : false03-13 14:49:45.975 : D/ffmpeg4android(6065) : deleteing :
/sdcard/videokit/videokit.log isdeleted : true03-13 14:49:45.980 : D/ffmpeg4android(6065) : Client invokeService()
03-13 14:49:45.980 : D/ffmpeg4android(6065) : Acquire wake lock
03-13 14:49:46.265 : D/ffmpeg4android(6616) : Sleeping, waiting for
command03-13 14:49:46.295 : D/ffmpeg4android(6065) : TranscodeBackground
doInBackground started03-13 14:49:46.295 : I/ffmpeg4android(6616) : =======remote service
runTranscoding ======03-13 14:49:46.340 : V/HomeAsync(6065) : TOTAL_SPACE is
1 ;AVAILABLE_SPACE is 0.45103-13 14:49:46.345 : I/ActivityManager(6065) : Timeline : Activity_idle
id : android.os.BinderProxy@423deed8 time:3821304503-13 14:49:46.345 : I/ActivityManager(6065) : Timeline : Activity_idle
id : android.os.BinderProxy@420323a0 time:3821304503-13 14:49:46.565 : D/dalvikvm(6616) : Trying to load lib
/data/app-lib/app.cloudstringers-2/libvideokit.so 0x41b285f003-13 14:49:46.570 : D/dalvikvm(6616) : Added shared lib
/data/app-lib/app.cloudstringers-2/libvideokit.so 0x41b285f003-13 14:49:46.570 : I/Videokit(6616) : Loading native library compiled
at 21:59:53 Oct 23 201303-13 14:49:46.575 : I/ffmpeg4android(6616) : ===============Running
command from thread path : /sdcard/videokit03-13 14:49:46.575 : I/Videokit(6616) : vk ffmpeg sdcardPath :
/sdcard/videokit03-13 14:49:46.575 : I/Videokit(6616) : licenseCheck in path :
/sdcard/videokit03-13 14:49:46.575 : I/Videokit(6616) : isLicExistsComplex...
03-13 14:49:46.575 : I/Videokit(6616) : trying to open
/sdcard/videokit/ffmpeglicense.lic03-13 14:49:46.575 : I/Videokit(6616) : license file found...
03-13 14:49:46.575 : I/ffmpeg4android(6616) :
=======ProgressBackgroundRemote doInBackground=========03-13 14:49:46.575 : I/Videokit(6616) : time decoded : 1394535283
03-13 14:49:46.575 : I/Videokit(6616) : timeStrDec 1394535283 is a valid
number.03-13 14:49:46.575 : I/Videokit(6616) : time diff : 161703
03-13 14:49:46.575 : I/Videokit(6616) : You used 1 of your 15 trial
days.03-13 14:49:46.575 : D/Videokit(6616) : license check rc : 0
03-13 14:49:46.575 : D/Videokit(6616) : run() called verion 2.0
03-13 14:49:46.575 : D/Videokit(6616) : run passing off to main()
03-13 14:49:46.800 : D/ffmpeg4android(6065) : onServiceDisconnected
03-13 14:49:48.640 : I/ffmpeg4android(6065) : Got real duration :
00:00:07.7803-13 14:49:48.640 : I/ffmpeg4android(6065) : ==== getting
currentVkLogSize from VK03-13 14:49:48.640 : D/ffmpeg4android(6065) : currentVkLogSize : 5751
03-13 14:49:48.645 : I/ffmpeg4android(6065) : No ffmpeg4android_log
file, using vk log03-13 14:49:48.645 : I/line(6065) : _rate, rate, width or height
03-13 14:49:48.650 : I/line(6065) : Statistics : 0 seeks, 0 writeouts
03-13 14:49:48.650 : I/line(6065) : Statistics : 72873 bytes read, 2
seeks03-13 14:49:48.650 : D/ffmpeg4android(6065) : currentTimeStr : exit
03-13 14:49:48.650 : D/ffmpeg4android(6065) : ============Found one of
the exit tokens in the log============03-13 14:49:48.650 : I/ffmpeg4android(6065) : onProgressUpdate : 100
03-13 14:49:48.650 : D/ffmpeg4android(6065) : Releasing wake lock
03-13 14:49:48.650 : D/ffmpeg4android(6065) : TranscodeBackground
onPostExecute03-13 14:49:48.700 : D/ffmpeg4android(6065) : /sdcard/videokit/null
length in bytes : 003-13 14:49:48.700 : D/ffmpeg4android(6065) : showNotifications
03-13 14:49:48.700 : W/ffmpeg4android(6065) : output file is not set use
the setOutputFilePath method to set the full output file path03-13 14:49:48.705 : I/ffmpeg4android(6065) : FFMPEG finished.
03-13 14:49:48.710 : D/ffmpeg4android(6065) : releaseService()
03-13 14:49:48.710 : D/ffmpeg4android(6065) : Client stopService()
03-13 14:49:48.710 : W/ContextImpl(6065) : Implicit intents with
startService are not safe : Intent
act=com.netcompss.ffmpeg4android.FFMpegRemoteServiceBridge
android.content.ContextWrapper.stopService:499
com.netcompss.ffmpeg4android_client.BaseWizard.stopService:451
com.netcompss.ffmpeg4android_client.BaseWizard.handleServiceFinished:513 -
Recording video on Android using JavaCV (Updated 2014 02 17)
25 septembre 2014, par Fabio BergmannI’m trying to record a video in Android using the JavaCV lib.
I need to record the video in 640x360.I have installed everything as described in README.txt file and I followed the example as below :
https://code.google.com/p/javacv/source/browse/samples/RecordActivity.java
In this example, the video size is this :
private int imageWidth = 320 ;
private int imageHeight = 240 ;In my case, I need to record a video in 640x360 H.264.
(UPDATE) I have reverted my code and kept exactly like in the example, just changing imageWidth and imageHeight to 640x360.
Now I’m getting the video like this image :
http://bergmann.net.br/img/screenshot_video_error.pngHere is my code :
import static com.googlecode.javacv.cpp.opencv_core.IPL_DEPTH_8U;
import java.io.IOException;
import java.nio.ShortBuffer;
import android.app.Activity;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.hardware.Camera;
import android.hardware.Camera.PreviewCallback;
import android.media.AudioFormat;
import android.media.AudioRecord;
import android.media.MediaRecorder;
import android.os.Bundle;
import android.os.PowerManager;
import android.util.Log;
import android.view.Display;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import com.autosonvideo.helpers.Helpers;
import com.autosonvideo.logic.CameraHelpers;
import com.googlecode.javacv.FFmpegFrameRecorder;
import com.googlecode.javacv.cpp.opencv_core.IplImage;
public class FFmpegRecordActivity extends Activity implements OnClickListener {
private final static String CLASS_LABEL = "RecordActivity";
private final static String LOG_TAG = CLASS_LABEL;
private PowerManager.WakeLock mWakeLock;
private String ffmpeg_link;
long startTime = 0;
boolean recording = false;
private volatile FFmpegFrameRecorder recorder;
private boolean isPreviewOn = false;
private int sampleAudioRateInHz = 44100;
private int imageWidth = 640;
private int imageHeight = 480;
private int finalImageWidth = 640;
private int finalImageHeight = 360;
private int frameRate = 30;
/* audio data getting thread */
private AudioRecord audioRecord;
private AudioRecordRunnable audioRecordRunnable;
private Thread audioThread;
volatile boolean runAudioThread = true;
/* video data getting thread */
private Camera cameraDevice;
private CameraView cameraView;
private IplImage yuvIplimage = null;
/* layout setting */
private final int bg_screen_bx = 232;
private final int bg_screen_by = 128;
private final int bg_screen_width = 700;
private final int bg_screen_height = 500;
private final int bg_width = 1123;
private final int bg_height = 715;
private final int live_width = 1280;
private final int live_height = 960;
private int screenWidth, screenHeight;
private Button btnRecorderControl;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
setContentView(R.layout.main);
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK,
CLASS_LABEL);
mWakeLock.acquire();
initLayout();
initRecorder();
}
@Override
protected void onResume() {
super.onResume();
if (mWakeLock == null) {
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK,
CLASS_LABEL);
mWakeLock.acquire();
}
}
@Override
protected void onPause() {
super.onPause();
if (mWakeLock != null) {
mWakeLock.release();
mWakeLock = null;
}
}
@Override
protected void onDestroy() {
super.onDestroy();
recording = false;
if (cameraView != null) {
cameraView.stopPreview();
cameraDevice.release();
cameraDevice = null;
}
if (mWakeLock != null) {
mWakeLock.release();
mWakeLock = null;
}
}
private void initLayout() {
/* get size of screen */
Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE))
.getDefaultDisplay();
screenWidth = display.getWidth();
screenHeight = display.getHeight();
RelativeLayout.LayoutParams layoutParam = null;
LayoutInflater myInflate = null;
myInflate = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
RelativeLayout topLayout = new RelativeLayout(this);
setContentView(topLayout);
LinearLayout preViewLayout = (LinearLayout) myInflate.inflate(
R.layout.main, null);
layoutParam = new RelativeLayout.LayoutParams(screenWidth, screenHeight);
topLayout.addView(preViewLayout, layoutParam);
/* add control button: start and stop */
btnRecorderControl = (Button) findViewById(R.id.recorder_control);
btnRecorderControl.setText("Start");
btnRecorderControl.setOnClickListener(this);
/* add camera view */
int display_width_d = (int) (1.0 * bg_screen_width * screenWidth / bg_width);
int display_height_d = (int) (1.0 * bg_screen_height * screenHeight / bg_height);
int prev_rw, prev_rh;
if (1.0 * display_width_d / display_height_d > 1.0 * live_width
/ live_height) {
prev_rh = display_height_d;
prev_rw = (int) (1.0 * display_height_d * live_width / live_height);
} else {
prev_rw = display_width_d;
prev_rh = (int) (1.0 * display_width_d * live_height / live_width);
}
layoutParam = new RelativeLayout.LayoutParams(prev_rw, prev_rh);
layoutParam.topMargin = (int) (1.0 * bg_screen_by * screenHeight / bg_height);
layoutParam.leftMargin = (int) (1.0 * bg_screen_bx * screenWidth / bg_width);
cameraDevice = Camera.open();
Log.i(LOG_TAG, "cameara open");
cameraView = new CameraView(this, cameraDevice);
topLayout.addView(cameraView, layoutParam);
Log.i(LOG_TAG, "cameara preview start: OK");
}
// ---------------------------------------
// initialize ffmpeg_recorder
// ---------------------------------------
private void initRecorder() {
Log.w(LOG_TAG, "init recorder");
if (yuvIplimage == null) {
yuvIplimage = IplImage.create(finalImageWidth, finalImageHeight,
IPL_DEPTH_8U, 2);
Log.i(LOG_TAG, "create yuvIplimage");
}
ffmpeg_link = CameraHelpers.getOutputMediaFile(
CameraHelpers.MEDIA_TYPE_VIDEO).toString();
Log.i(LOG_TAG, "ffmpeg_url: " + ffmpeg_link);
recorder = new FFmpegFrameRecorder(ffmpeg_link, finalImageWidth,
finalImageHeight, 1);
recorder.setFormat("mp4");
recorder.setSampleRate(sampleAudioRateInHz);
// Set in the surface changed method
recorder.setFrameRate(frameRate);
Log.i(LOG_TAG, "recorder initialize success");
audioRecordRunnable = new AudioRecordRunnable();
audioThread = new Thread(audioRecordRunnable);
}
public void startRecording() {
try {
recorder.start();
startTime = System.currentTimeMillis();
recording = true;
audioThread.start();
} catch (FFmpegFrameRecorder.Exception e) {
e.printStackTrace();
}
}
public void stopRecording() {
runAudioThread = false;
if (recorder != null && recording) {
recording = false;
Log.v(LOG_TAG,
"Finishing recording, calling stop and release on recorder");
try {
recorder.stop();
recorder.release();
} catch (FFmpegFrameRecorder.Exception e) {
e.printStackTrace();
}
recorder = null;
}
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (recording) {
stopRecording();
}
finish();
return true;
}
return super.onKeyDown(keyCode, event);
}
// ---------------------------------------------
// audio thread, gets and encodes audio data
// ---------------------------------------------
class AudioRecordRunnable implements Runnable {
@Override
public void run() {
android.os.Process
.setThreadPriority(android.os.Process.THREAD_PRIORITY_URGENT_AUDIO);
// Audio
int bufferSize;
short[] audioData;
int bufferReadResult;
bufferSize = AudioRecord
.getMinBufferSize(sampleAudioRateInHz,
AudioFormat.CHANNEL_IN_MONO,
AudioFormat.ENCODING_PCM_16BIT);
audioRecord = new AudioRecord(MediaRecorder.AudioSource.MIC,
sampleAudioRateInHz, AudioFormat.CHANNEL_IN_MONO,
AudioFormat.ENCODING_PCM_16BIT, bufferSize);
audioData = new short[bufferSize];
Log.d(LOG_TAG, "audioRecord.startRecording()");
audioRecord.startRecording();
/* ffmpeg_audio encoding loop */
while (runAudioThread) {
// Log.v(LOG_TAG,"recording? " + recording);
bufferReadResult = audioRecord.read(audioData, 0,
audioData.length);
if (bufferReadResult > 0) {
Log.v(LOG_TAG, "bufferReadResult: " + bufferReadResult);
// If "recording" isn't true when start this thread, it
// never get's set according to this if statement...!!!
// Why? Good question...
if (recording) {
try {
recorder.record(ShortBuffer.wrap(audioData, 0,
bufferReadResult));
// Log.v(LOG_TAG,"recording " + 1024*i + " to " +
// 1024*i+1024);
} catch (FFmpegFrameRecorder.Exception e) {
Log.v(LOG_TAG, e.getMessage());
e.printStackTrace();
}
}
}
}
Log.v(LOG_TAG, "AudioThread Finished, release audioRecord");
/* encoding finish, release recorder */
if (audioRecord != null) {
audioRecord.stop();
audioRecord.release();
audioRecord = null;
Log.v(LOG_TAG, "audioRecord released");
}
}
}
// ---------------------------------------------
// camera thread, gets and encodes video data
// ---------------------------------------------
class CameraView extends SurfaceView implements SurfaceHolder.Callback,
PreviewCallback {
private SurfaceHolder mHolder;
private Camera mCamera;
public CameraView(Context context, Camera camera) {
super(context);
Log.w("camera", "camera view");
mCamera = camera;
mHolder = getHolder();
mHolder.addCallback(CameraView.this);
mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
mCamera.setPreviewCallback(CameraView.this);
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
try {
stopPreview();
mCamera.setPreviewDisplay(holder);
} catch (IOException exception) {
mCamera.release();
mCamera = null;
}
}
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
Log.v(LOG_TAG, "Setting imageWidth: " + imageWidth
+ " imageHeight: " + imageHeight + " frameRate: "
+ frameRate);
Camera.Parameters camParams = mCamera.getParameters();
camParams.setPreviewSize(imageWidth, imageHeight);
Log.v(LOG_TAG,
"Preview Framerate: " + camParams.getPreviewFrameRate());
camParams.setPreviewFrameRate(frameRate);
mCamera.setParameters(camParams);
startPreview();
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
try {
mHolder.addCallback(null);
mCamera.setPreviewCallback(null);
} catch (RuntimeException e) {
// The camera has probably just been released, ignore.
}
}
public void startPreview() {
if (!isPreviewOn && mCamera != null) {
isPreviewOn = true;
mCamera.startPreview();
}
}
public void stopPreview() {
if (isPreviewOn && mCamera != null) {
isPreviewOn = false;
mCamera.stopPreview();
}
}
@Override
public void onPreviewFrame(byte[] data, Camera camera) {
/* get video data */
if (yuvIplimage != null && recording) {
// yuvIplimage.getByteBuffer().put(data);
final int startY = 640 * (480 - 360) / 2;
final int lenY = 640 * 360;
yuvIplimage.getByteBuffer().put(data, startY, lenY);
final int startVU = 640 * 480 + 320 * 2 * (240 - 180) / 2;
final int lenVU = 320 * 180 * 2;
yuvIplimage.getByteBuffer().put(data, startVU, lenVU);
Log.v(LOG_TAG, "Writing Frame");
try {
long t = 1000 * (System.currentTimeMillis() - startTime);
if (t > recorder.getTimestamp()) {
recorder.setTimestamp(t);
}
recorder.record(yuvIplimage);
} catch (FFmpegFrameRecorder.Exception e) {
Log.v(LOG_TAG, e.getMessage());
e.printStackTrace();
}
}
}
}
@Override
public void onClick(View v) {
if (!recording) {
startRecording();
Log.w(LOG_TAG, "Start Button Pushed");
btnRecorderControl.setText("Stop");
} else {
// This will trigger the audio recording loop to stop and then set
// isRecorderStart = false;
stopRecording();
Log.w(LOG_TAG, "Stop Button Pushed");
btnRecorderControl.setText("Start");
}
}
} -
Revision 6a4e2ddabc : Properly merge two different real time modes —rt —cpu-used=-5 uses the progre
31 janvier 2014, par Yaowu XuChanged Paths :
Modify /vp9/encoder/vp9_encodeframe.c
Modify /vp9/encoder/vp9_onyx_if.c
Modify /vp9/encoder/vp9_onyx_int.h
Modify /vp9/encoder/vp9_rdopt.c
Properly merge two different real time modes— rt —cpu-used=-5 uses the progressive rtc mode
— rt —cpu-used=-6 uses the new super fast rtc modeChange-Id : Id6469ca996100cdf794a0e42d76430161f22f976