android的mediaplayer的路径播放问题

player =new MediaPlayer();
try {
player.reset();
player.setDataSource("/sdcard/m01.mp3");
player.prepare();
player.start();

    }catch (Exception e){
        Toast.makeText(this,"异常",Toast.LENGTH_SHORT).show();
    }

            在真机上会弹出异常,是需要root权限吗

3个回答

访问SD卡需要获取Android提供的相应的读写权限。

需要的权限(在AndroidManifest.xml中添加如下代码):

uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"

uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"

访问SD卡需要获取Android提供的相应的读写权限。

需要的权限(在AndroidManifest.xml中添加如下代码):


添加SD卡读写权限后,真机测试也不需要Root,另外真机的.MP3文件路径不一定是/sdcard/m01.mp3,可以检查一下

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Python+OpenCV计算机视觉

Python+OpenCV计算机视觉

android mediaplayer设置了播放路径却没有播放,求解。

点击的下一首播放,调用播放方法。如下图![图片说明](https://img-ask.csdn.net/upload/201705/11/1494469078_490871.png) 能打印出播放路径,就是不播放音乐。有没有大神知道该怎么解决这个问题,求教。

Android视频循环播放,开始正常,循环一段时间后停止。

最近需要做一个视频的循环播放,用于做一个机器的老化测试功能,路径是本地的一个视频,但是在播放一段时间之后会停止并且出现很抱歉,无法播放此视频的对话框。并不是开始就无法播放,而是开始可以正常播放,并且可以循环播放,但是在循环一段时间之后会出现问题。 我的代码是这样写的: private void initVideoModule() { if (logOn) { Log.e(TAG, "start method mVideoModule.initVideoModule()"); } topVideoView = (VideoView) findViewById(R.id.video_top); } @Override public void startTest() { // TODO Auto-generated method stub if (logOn) { Log.e(TAG, "start method mVideoModule.startTest()"); } initVideoModule(); File file = new File("/system/etc/testvideo.mp4"); if(file.exists()){ Log.e("rainbow","testvideo is exists"); topVideoView.setVideoPath(file.getAbsolutePath()); }else{ Log.e("rainbow","testvideo is not exists"); } topVideoView.start(); topVideoView.setOnPreparedListener(new OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { // TODO Auto-generated method stub mp.setLooping(true); mp.setVolume(0.6f, 0.6f); } }); } 现在有一个问题就是:app可以正常启动并循环播放视频,但是当循环一段时间之后,就会停止,然后弹出对话框:很抱歉,无法播放此视频 。这个不是刚启动的时候就会出现,而是刚刚启动视频正常播放,并且能循环播放,但是循环一段时间之后出现的问题。 请问这个问题应该是出在了哪里? 还有如果把循环方法这样写: topVideoView.setOnCompletionListener(new OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { // TODO Auto-generated method stub topVideoView.start(); } } }); 而不在setOnPreparedListener里边设定mp.setLooping(true);这个也能达到循环的效果,它们有什么区别?

关于android播放sd卡中的音乐文件

![手机](https://img-ask.csdn.net/upload/201701/09/1483935883_552719.jpg) MediaPlayer mediaPlayer=new MediaPlayer(); //申请两个权限 if(ContextCompat.checkSelfPermission(this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED){ requestPermissions(new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE},100); } if(ContextCompat.checkSelfPermission(this, android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS)!= PackageManager.PERMISSION_GRANTED){ requestPermissions(new String[]{android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS},200); } try { //设置文件路径 mediaPlayer.setDataSource(Environment.getExternalStorageDirectory().getPath() + File.separator+"music.mp3"); mediaPlayer.prepare(); mediaPlayer.start(); } catch (IOException e) { System.out.println("错误"); e.printStackTrace(); }

使用URL如何播放视频?

我使用媒体播放器,试图从youtube上下载视频和音频流。 使用 url如何实现呢? 我使用的例子是: http://www.youtube.com/watch?v=SgGhtjKWLOE&feature=feedrec 但是得到的 LogCat Error: 01-03 22:22:30.140: INFO/AwesomePlayer(85): setDataSource_l('http://www.youtube.com/watch?v=I3jv0IF9n6A') 01-03 22:22:30.140: INFO/NuHTTPDataSource(85): connect to www.youtube.com:80/watch?v=I3jv0IF9n6A @0 01-03 22:22:30.250: INFO/NuHTTPDataSource(85): connect to m.youtube.com:80/watch?desktop_uri=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DI3jv0IF9n6A&v=I3jv0IF9n6A&gl=US @0 09-04 22:22:30.410: INFO/NuHTTPDataSource(85): connect to m.youtube.com:80/#/watch?desktop_uri=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DI3jv0IF9n6A&v=I3jv0IF9n6A&gl=US @0 01-03 22:22:30.570: INFO/NuHTTPDataSource(85): Chunked transfer encoding applied. 01-03 22:22:30.570: WARN/NuHTTPDataSource(85): Server did not give us the content length! 01-03 22:22:31.000: INFO/NuCachedSource2(85): ERROR_END_OF_STREAM 01-03 22:22:31.630: ERROR/MediaPlayer(8404): error (1, -2147483648) 01-03 22:22:31.630: WARN/System.err(8404): java.io.IOException: Prepare failed.: status=0x1 01-03 22:22:31.630: WARN/System.err(8404): at android.media.MediaPlayer.prepare(Native Method) 01-03 22:22:31.630: WARN/System.err(8404): at com.fttech.example.youtube.example.AccessibleYouTube.watchVideo(AccessibleYouTube.java:139) 01-03 22:22:31.630: WARN/System.err(8404): at java.lang.reflect.Method.invokeNative(Native Method) 01-03 22:22:31.630: WARN/System.err(8404): at java.lang.reflect.Method.invoke(Method.java:491) 01-03 22:22:31.630: WARN/System.err(8404): at android.view.View$1.onClick(View.java:2678) 01-03 22:22:31.630: WARN/System.err(8404): at android.view.View.performClick(View.java:3110) 01-03 22:22:31.630: WARN/System.err(8404): at android.view.View$PerformClick.run(View.java:11928) 01-03 22:22:31.630: WARN/System.err(8404): at android.os.Handler.handleCallback(Handler.java:587) 01-03 22:22:31.630: WARN/System.err(8404): at android.os.Handler.dispatchMessage(Handler.java:92)

android如何根据文件路径获取文件信息

手机里有个文件,知道具体路径xx/xx/xx/xx/1.mp3 怎么通过路径获取1.mp3的所有文件信息

Android获取到了手机音频文件的信息,怎么转换成uri

我已经用getContentResolver().query()方法获取到了歌曲名和路径,怎么把这些信息转换成uri用于MediaPlayer播放

android SD卡权限问题

要写个文件管理器 向SD卡写数据 现在我网上找了找 只有一个可行的办法 就是先要打开一个Activity 大概意识是 用这个Activity可以给SD卡等路径授权 new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);就这个 我想问 有没有其他办法 我不想打开这个东西 因为自己写文件管理器主要就是自己设计app的外观样式 这个Activity的样式我改不了啊

小米手机播放视频报错stop called in state 1,error (-38, 0)

今天写demo,用小米手机播放手机里本地的视频,界面正常,但是视频不出现,在log里报错如下: 01-27 10:53:46.530: E/MediaPlayer-JNI(21091): QCMediaPlayer mediaplayer NOT present 01-27 10:53:46.700: E/MediaPlayer-JNI(21091): QCMediaPlayer mediaplayer NOT present 01-27 10:53:46.820: E/MediaPlayer(21091): stop called in state 1 01-27 10:53:46.820: E/MediaPlayer(21091): error (-38, 0) 01-27 10:53:46.830: E/MediaPlayer(21091): start called in state 0 01-27 10:53:46.840: E/MediaPlayer(21091): Attempt to perform seekTo in wrong state: mPlayer=0x0, mCurrentState=0 01-27 10:53:46.880: E/MediaPlayer(21091): Error (-38,0) 01-27 10:53:46.920: E/MediaPlayer(21091): Should have subtitle controller already set 代码如下: try { player = new MediaPlayer(); // 重置为初始状态 player.reset(); // 设置音乐流的类型 player.setAudioStreamType(AudioManager.STREAM_MUSIC); // 设置video影片以surfaceviewholder播放 player.setDisplay(holder); // 设置路径 player.setDataSource(Environment.getExternalStorageDirectory() .getAbsolutePath() + "/VideoCache/1453791771643.mp4"); player.prepareAsync(); if (player != null) { player.stop(); } player.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { player.start(); } }); } catch (Exception e) { Log.e("HHHHHHHHHHHHHHHHHH", e.toString()); e.printStackTrace(); } 手机里还有个视频文件能播放,这个就不行,郁闷。

Android 声道切换和音频输出的问题

audiomanager下的 setWiredHeadsetOn已经弃用了,请问有无替代的接口,我想实现在Android手机同时接蓝牙音箱和有线耳机时,音频从蓝牙音箱输出。现在的现象是音频一直从耳机输出。

Android拍视频预览的界面被拉伸

最近 Android 需要做一个拍视频保存然后上传的功能,基本功能实现了,但是有一个小 bug,就是预览的时候界面明显被拉长了,但是各种预览设置的参数也都试过了,都没有用,来请教一下。 #代码如下: ##1. Activity ``` public class RecordActivity extends AppCompatActivity implements SurfaceHolder.Callback { private SurfaceView mSurfaceView; private SurfaceHolder mSurfaceHolder; private Button btnStartStop; private boolean isRecording = false; // 标记是否已经在录制 private MediaRecorder mRecorder; // 音视频录制类 private Camera mCamera = null; // 相机 private List<Camera.Size> mSupportedPreviewSizes = null; private Camera.Size mPreviewSize; private Camera.Size mSize = null;// 相机的尺寸 private int mCameraFacing = Camera.CameraInfo.CAMERA_FACING_BACK; // 默认后置摄像头 private static final SparseIntArray orientations = new SparseIntArray(); // 手机旋转对应的调整角度 static { orientations.append(Surface.ROTATION_0, 90); orientations.append(Surface.ROTATION_90, 0); orientations.append(Surface.ROTATION_180, 270); orientations.append(Surface.ROTATION_270, 180); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); initWindow(); setContentView(R.layout.activity_record); initViews(); } /** * 初始化窗口 */ private void initWindow() { requestWindowFeature(Window.FEATURE_NO_TITLE); // 去掉标题栏 getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); // 设置全屏 // 设置竖屏显示 setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); // 选择支持半透明模式,在有 surfaceView 的 activity 中使用。 getWindow().setFormat(PixelFormat.TRANSLUCENT); } /** * 视图对象初始化 */ private void initViews() { mSurfaceView = (SurfaceView) findViewById(R.id.surfaceview); btnStartStop = (Button) findViewById(R.id.btnStartStop); btnStartStop.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (!isRecording) { startRecord(); } else { stopRecord(); } } }); SurfaceHolder holder = mSurfaceView.getHolder(); // 取得holder holder.setFormat(PixelFormat.TRANSPARENT); holder.setKeepScreenOn(true); holder.addCallback(this); // holder加入回调接口 } /** * 初始化相机 */ private void initCamera() { /** * 默认打开后置摄像头 */ if (Camera.getNumberOfCameras() == 2) { mCamera = Camera.open(mCameraFacing); } else { mCamera = Camera.open(); } CameraSizeComparator sizeComparator = new CameraSizeComparator(); Camera.Parameters parameters = mCamera.getParameters(); if (mSize == null) { mSupportedPreviewSizes = parameters.getSupportedPreviewSizes(); Collections.sort(mSupportedPreviewSizes, sizeComparator); for (int num = 0; num < mSupportedPreviewSizes.size(); num++) { Camera.Size size = mSupportedPreviewSizes.get(num); if (size.width >= 1000 && size.height >= 1000) { this.mSize = size; break; } } mSize = mSupportedPreviewSizes.get(0); /** * 增加对聚焦模式的判断 */ List<String> focusModesList = parameters.getSupportedFocusModes(); if (focusModesList.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) { parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO); } else if (focusModesList.contains(Camera.Parameters.FOCUS_MODE_AUTO)) { parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO); } mCamera.setParameters(parameters); } int rotation = getWindowManager().getDefaultDisplay().getRotation(); int orientation = orientations.get(rotation); mCamera.setDisplayOrientation(orientation); } @Override protected void onResume() { super.onResume(); initCamera(); } @Override public void onPause() { releaseCamera(); super.onPause(); } /** * 开始录制 */ private void startRecord() { if (mRecorder == null) { mRecorder = new MediaRecorder(); // 创建MediaRecorder } if (mCamera != null) { mCamera.stopPreview(); mCamera.unlock(); mRecorder.setCamera(mCamera); } try { // 设置音频采集方式 mRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER); // 设置视频的采集方式 mRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA); /* mRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); // 设置文件的输出格式 mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); // 设置audio的编码格式 mRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264); // 设置video的编码格式 mRecorder.setVideoEncodingBitRate(10 * 1024 * 1024); // 设置录制的视频编码比特率 mRecorder.setVideoFrameRate(30); // 设置录制的视频帧率 mRecorder.setVideoSize(1920, 1080); // 设置相机分辨率 */ // 设置要捕获的视频的宽度和高度 // mSurfaceHolder.setFixedSize(optimalSize.width, optimalSize.height); mRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH)); // 设置记录会话的最大持续时间(毫秒) mRecorder.setMaxDuration(180 * 1000); mRecorder.setPreviewDisplay(mSurfaceHolder.getSurface()); /** * 获取外部路径,然后将视频保存进去 */ String path = Environment.getExternalStorageDirectory().getPath(); if (path != null) { File dir = new File(path + "/crafts_videos"); if (!dir.exists()) { dir.mkdir(); } /** * 将 currentTimeMillis() 作为文件名 */ path = dir + "/" + System.currentTimeMillis() + ".mp4"; mRecorder.setOutputFile(path); //设置输出文件的路径 mRecorder.prepare(); //准备录制 mRecorder.start(); //开始录制 isRecording = true; btnStartStop.setText("停止"); } } catch (Exception e) { e.printStackTrace(); } } /** * 停止录制 */ private void stopRecord() { try { mRecorder.stop(); // 停止录制 mRecorder.reset(); // 重置 btnStartStop.setText("开始"); } catch (Exception e) { e.printStackTrace(); } isRecording = false; } /** * 释放 MediaRecorder */ private void releaseMediaRecorder() { if (mRecorder != null) { mRecorder.release(); mRecorder = null; } } /** * 释放相机资源 */ private void releaseCamera() { try { if (mCamera != null) { mCamera.stopPreview(); mCamera.setPreviewCallback(null); mCamera.unlock(); mCamera.release(); } } catch (RuntimeException e) { } finally { mCamera = null; } } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { // 将holder,这个holder为开始在onCreate里面取得的holder,将它赋给mSurfaceHolder mSurfaceHolder = holder; if (mCamera == null) { return; } try { //设置显示 mCamera.setPreviewDisplay(holder); mCamera.startPreview(); } catch (Exception e) { e.printStackTrace(); releaseCamera(); finish(); } } @Override public void surfaceCreated(SurfaceHolder holder) { // 将holder,这个holder为开始在onCreate里面取得的holder,将它赋给mSurfaceHolder mSurfaceHolder = holder; try { mCamera.setPreviewDisplay(mSurfaceHolder); mCamera.startPreview(); } catch (IOException e) { e.printStackTrace(); } } @Override public void surfaceDestroyed(SurfaceHolder holder) { // surfaceDestroyed的时候同时对象设置为null if (isRecording && mCamera != null) { mCamera.lock(); } mSurfaceView = null; mSurfaceHolder = null; releaseMediaRecorder(); releaseCamera(); } private class CameraSizeComparator implements Comparator<Camera.Size> { public int compare(Camera.Size lhs, Camera.Size rhs) { if (lhs.width == rhs.width) { return 0; } else if (lhs.width > rhs.width) { return 1; } else { return -1; } } } } ``` ##2. 布局 ``` <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <SurfaceView android:id="@+id/surfaceview" android:layout_width="match_parent" android:layout_height="match_parent" /> <Button android:id="@+id/btnStartStop" android:layout_width="60dp" android:layout_height="40dip" android:layout_centerHorizontal="true" android:layout_alignParentBottom="true" android:text="开始" /> </RelativeLayout> ``` ##3. 权限 ``` <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> ``` 求大神解答

使用videoview时显示无法播放此视频

![图片说明](https://img-ask.csdn.net/upload/201709/16/1505544994_121732.png) ExtMediaPlayer-JNI: env->IsInstanceOf fails MediaPlayer-JNI: JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0 一般是因为什么原因会出现这个错误呢

Android自己写的播放器怎么从外部打开?

我自己写了一个mediaplayer播放器,怎么打开本地视频时,选择用我的播放器来播放? 把选择的路径传进我的mediaplayer里呢?

android 如何获取raw文件下音频的名称和时长?

我在res/raw文件下放了8个很短的音频,想把它们的名称和时长获取出来显示在一个listview中,如何获取它们的名称和时长呢?

安卓音乐播放器 路径设置错误? 求帮忙看一下。。。

public class MainActivity extends Activity implements AdapterView.OnItemClickListener { private MediaPlayer mediaPlayer; private List<String> musicList; private int Index = -1; private String MUSIC_PATH = new String("/storage/emulated/0/kgmusic/download"); ListView listView; @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_NO_TITLE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = getWindow(); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(Color.TRANSPARENT); } setContentView(R.layout.activity_main); mediaPlayer = new MediaPlayer(); System.out.println(Environment.getExternalStorageDirectory().toString()); findView(); musiclist(); start(); stop(); pause(); lastmusic(); nextMusic(); listView.setOnItemClickListener(this); Log.e("KeyEvent", "KEYCODE_BACK"); // seekbar(); } //获取按钮 void findView() { viewHolder.start = (Button) findViewById(R.id.start); viewHolder.stop = (Button) findViewById(R.id.stop); viewHolder.next = (Button) findViewById(R.id.next); viewHolder.pause = (Button) findViewById(R.id.pause); viewHolder.last = (Button) findViewById(R.id.last); listView = (ListView) findViewById(R.id.android_list); viewHolder.seekBar = (SeekBar) findViewById(R.id.seekbar); viewHolder.current_time = (TextView) findViewById(R.id.current_time); viewHolder.total_time = (TextView) findViewById(R.id.total_time); } private void musiclist() { musicList = new ArrayList<>(); File musicfile = new File(MUSIC_PATH); if (musicfile.listFiles(new MusicFilter()).length >= 0) { for (File file : musicfile.listFiles(new MusicFilter())) { musicList.add(file.getName().replace(".mp3","")); } ListAdapter listAdapter = new jukeboxv2.bmvod.net.testplayer.ListAdapter(this,musicList); listView.setAdapter(listAdapter); } } private void playmusic(String path) { try { mediaPlayer.reset(); mediaPlayer.setDataSource(path); mediaPlayer.prepare(); mediaPlayer.start(); } catch (IOException e) { e.printStackTrace(); } mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { nextMusic(); } }); } private void stop() { viewHolder.stop.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mediaPlayer.isPlaying()) { mediaPlayer.stop(); } } }); } private void start() { viewHolder.start.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { playmusic(MUSIC_PATH + musicList.get(Index)); } }); } private void pause() { viewHolder.pause.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mediaPlayer.isPlaying()) { mediaPlayer.pause(); } else { mediaPlayer.start(); } } }); } private void lastmusic() { viewHolder.last.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (Index != 0) { if (--Index >= 0) { Index = musicList.size(); } else { playmusic(MUSIC_PATH + musicList.get(Index)); } } else { playmusic(MUSIC_PATH + musicList.get(Index)); } } }); } private void nextMusic() { viewHolder.next.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (++Index > musicList.size()) { Index = 0; } else { playmusic(MUSIC_PATH + musicList.get(Index)); } } }); } private void seekbar() { int progress = viewHolder.seekBar.getProgress(); int musicmaxlength = mediaPlayer.getDuration(); int seekbarmax = viewHolder.seekBar.getMax(); mediaPlayer.seekTo(musicmaxlength * progress / seekbarmax); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) {//med Index = position; playmusic(MUSIC_PATH + musicList.get(Index)); } ``` ``` java.io.IOException: setDataSource failed. 错误 请问是什么原因呢?

安卓录像问题。报错Media server died.

public class MainActivity extends Activity { MediaRecorder recorder= null; Button startButton = null; Button endtButton = null; SurfaceView face = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); startButton=(Button) findViewById(R.id.end); endtButton= (Button) findViewById(R.id.start); face= (SurfaceView) findViewById(R.id.surfaceView); face.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); face.getHolder().setFixedSize(176, 144); face.getHolder().setKeepScreenOn(true); startButton.setOnClickListener(ButtonClickDo); endtButton.setOnClickListener(ButtonClickDo); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } public void startRecord() throws Throwable, IOException{ File f = new File( Environment.getExternalStorageDirectory() ,System.currentTimeMillis()+".3gp"); recorder = new MediaRecorder(); recorder.setAudioSource(MediaRecorder.AudioSource.MIC); recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA); recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); recorder.setVideoSize(320, 240); recorder.setVideoFrameRate(5); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_WB); recorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264); recorder.setOutputFile(f.getAbsolutePath()); recorder.setPreviewDisplay(face.getHolder().getSurface()); System.out.println("路径"+ f.getAbsolutePath()); recorder.prepare(); recorder.start(); } public void stopRecord(){ if(recorder!=null){ recorder.stop(); recorder.release(); recorder=null; } } private OnClickListener ButtonClickDo = new OnClickListener() { @Override public void onClick(View v) { Integer id = v.getId(); System.out.println("id为:"+ id +"结果" +(endtButton.getId()==id)); if(endtButton.getId()==id){ try { startRecord(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Throwable e) { // TODO Auto-generated catch block e.printStackTrace(); } } else{ stopRecord(); } } }; } 这段代码可以正常的录像, 发到手机内存里 。但是我把 recorder.setPreviewDisplay(face.getHolder().getSurface()); 这句话给注释掉就报 Media server died. 。拍出来的东西只有23KB 怎么拍都只有23KB 不能播放 说文件损坏, 请问是怎么回事。 我想达到 录像 但不显示录像的画面。 怎么操作

Android5.1下将APK移入SD卡后,再开启该APK,拔掉SD卡,系统就会自动重启。

Android5.1下将APK移入SD卡后,再开启该APK,这个时候拔掉SD卡,系统就会自动重启,怎么解决?求帮忙! 部分相应的log信息: 01-02 07:58:05.654 D/com.diguayouxi(12056): native_parm_sign:[{"packageName":"com.qualcomm.display"},{"packageName":"com.gd.mobicore.pa"},{"packageName":"com.coo 01-02 07:58:06.028 W/AudioSystem( 8204): AudioFlinger not published, waiting... 01-02 07:58:06.130 W/Vold ( 270): com.diguayouxi-2 unmount attempt 2 failed (Device or resource busy) 01-02 07:58:06.329 E/ProcessKiller( 270): Process system_server (8455) has open file /mnt/asec/com.diguayouxi-2/base.apk 01-02 07:58:06.332 E/ProcessKiller( 270): Process com.android.systemui (8611) has open file /mnt/asec/com.diguayouxi-2/base.apk 01-02 07:58:06.384 I/ActivityManager( 8455): Waited long enough for: ServiceRecord{31805c1b u0 com.diguayouxi/.mgmt.service.AppService} 01-02 07:58:06.433 E/ProcessKiller( 270): Process com.diguayouxi (12056) has open file /mnt/asec/com.diguayouxi-2/base.apk 01-02 07:58:06.528 I/ServiceManager( 8204): Waiting for service media.audio_flinger... 01-02 07:58:07.446 W/Vold ( 270): com.diguayouxi-2 unmount attempt 3 failed (Device or resource busy) 01-02 07:58:07.529 I/ServiceManager( 8204): Waiting for service media.audio_flinger... 01-02 07:58:07.610 E/ProcessKiller( 270): Process system_server (8455) has open file /mnt/asec/com.diguayouxi-2/base.apk 01-02 07:58:07.610 W/ProcessKiller( 270): Sending SIGHUP to process 8455 01-02 07:58:07.615 E/ProcessKiller( 270): Process com.android.systemui (8611) has open file /mnt/asec/com.diguayouxi-2/base.apk 01-02 07:58:07.615 W/ProcessKiller( 270): Sending SIGHUP to process 8611 01-02 07:58:07.651 W/AudioFlinger( 8224): power manager service died !!! 01-02 07:58:07.652 W/AudioFlinger( 8224): power manager service died !!! 01-02 07:58:07.659 I/ServiceManager( 269): service 'permission' died 01-02 07:58:07.659 I/ServiceManager( 269): service 'wifip2p' died 01-02 07:58:07.659 I/ServiceManager( 269): service 'assetatlas' died 01-02 07:58:07.659 I/ServiceManager( 269): service 'sensorservice' died 01-02 07:58:07.659 I/ServiceManager( 269): service 'hardware' died 01-02 07:58:07.659 I/ServiceManager( 269): service 'account' died 01-02 07:58:07.659 I/ServiceManager( 269): service 'gfxinfo' died 01-02 07:58:07.659 I/ServiceManager( 269): service 'content' died 01-02 07:58:07.659 I/ServiceManager( 269): service 'consumer_ir' died 01-02 07:58:07.659 I/ServiceManager( 269): service 'network_management' died 01-02 07:58:07.659 I/ServiceManager( 269): service 'batterystats' died 01-02 07:58:24.455 V/WindowManager(12575): addAppToken: AppWindowToken{350af120 token=Token{35412823 ActivityRecord{1a4f9d52 u0 com.cyanogenmod.trebuchet/com.android.launcher3.Launcher t43}}} to stack=0 task=43 at 0 01-02 07:58:24.504 I/ActivityManager(12575): Start proc 13177:com.cyanogenmod.trebuchet/u0a17 for activity com.cyanogenmod.trebuchet/com.android.launcher3.Launcher 01-02 07:58:24.514 I/SystemServer(12575): Enabled StrictMode for system server main thread. 01-02 07:58:24.514 W/art (12575): Long monitor contention event with owner method=void com.android.server.am.ActivityManagerService.systemReady(java.lang.Runnable) from ActivityManagerService.java:11380 waiters=1 for 305ms 01-02 07:58:24.547 I/ActivityManager(12575): Start proc 13197:com.android.printspooler/u0a59 for service com.android.printspooler/.model.PrintSpoolerService 01-02 07:58:24.547 W/art (12575): Long monitor contention event with owner method=void com.android.server.am.ActivityManagerService.systemReady(java.lang.Runnable) from ActivityManagerService.java:11380 waiters=2 for 261ms 01-02 07:58:24.550 W/art (12575): Long monitor contention event with owner method=void com.android.server.am.ActivityManagerService.systemReady(java.lang.Runnable) from ActivityManagerService.java:11380 waiters=3 for 237ms 01-02 07:58:24.566 W/ResourcesManager(13061): Asset path '/system/framework/com.quicinc.cne.jar' does not exist or contains no resources. 01-02 07:58:24.570 W/InputAttributes(12920): No editor info for this field. Bug?

在listView列表中点击歌曲,没有播放音乐,日志也打印不出来

ListContent类用来获取和设置歌曲的信息 ``` public class ListContent { private int imageId; private String song; private int duration; private String songPath; public ListContent() { } public ListContent(int imageId,String song,int duration,String songPath) { this.imageId = imageId; this.song = song; this.duration = duration; this.songPath = songPath; } //获得歌曲的图片,歌名,时长,路径 public int getImageId(){ return imageId; } public String getSong(){ return song; } public int getDuration(){ return duration; } //设置歌曲的图片,歌名,时长,路径 public String getSongPath() { return songPath; } public int setImageId(int ImageId) { return this.imageId = ImageId; } public String setSong(String song) { return this.song = song; } public int setDuration(int duration) { return this.duration = duration; } public String setSongPath(String songPath) { return this.songPath; } } ``` GetMedia类用来获取手机中歌曲的标题,时长,路径 ``` public class GetMedia { public static List<ListContent> getSongInfo(Context context){ List<ListContent> songInfos = new ArrayList<ListContent>(); Cursor cursor = context.getContentResolver().query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,null,null,null,MediaStore.Audio.Media.DEFAULT_SORT_ORDER); //cursor.moveToFirst(); while(cursor.moveToNext()) { ListContent songInfo = new ListContent(); //获取歌曲的标题 String songName = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.TITLE)); //MediaStore.Audio.Media.DURATION 音频文件的持续时间,以毫秒为单位 int songDuration = cursor.getInt(cursor.getColumnIndex(MediaStore.Audio.Media.DURATION)); String songPath = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.DATA));//获得歌曲的路径 int isMusic = cursor.getInt(cursor.getColumnIndex(MediaStore.Audio.Media.IS_MUSIC)); if(isMusic != 0) { songInfo.setImageId(R.drawable.first_song); songInfo.setSong(songName); songInfo.setDuration(songDuration); songInfo.setSongPath(songPath); songInfos.add(songInfo); } } cursor.close(); return songInfos; } } ``` 主活动HomeActivity `````` ``` public class HomeActivity extends Activity implements OnItemClickListener{ private List<ListContent> listContent; private MediaPlayer mediaPlayer = new MediaPlayer(); private Button previous; private Button repeat; private Button play; private Button shuffle; private Button next; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.home_layout); //静态方法应该使用ClassName.staticMethod()的形式使用 listContent = GetMedia.getSongInfo(HomeActivity.this); SongListAdapter songListAdapter = new SongListAdapter(HomeActivity.this,R.layout.song_item,listContent); ListView listView = (ListView) findViewById(R.id.home_list); listView.setAdapter(songListAdapter); listView.setOnItemClickListener(this); previous = (Button) findViewById(R.id.previous); repeat = (Button) findViewById(R.id.repeat); play = (Button) findViewById(R.id.play); shuffle = (Button) findViewById(R.id.previoshuffleus); next = (Button) findViewById(R.id.next); } //监听listView @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { ListContent songListContent = listContent.get(position);//获得被点击的对象 try { mediaPlayer.setDataSource(songListContent.getSongPath());//指定音频的路径 //想打印出音频的路径,但日志没有显示 String mySong = songListContent.getSongPath(); Log.d("HomeActivity",mySong); mediaPlayer.prepareAsync(); }catch (Exception e) { e.printStackTrace(); } mediaPlayer.start();//播放音乐 } } ```

为何音乐播放器代码在esclipse中没报错,点击按钮却没有实现功能,上图上代码,求前辈们指教

![图片说明](https://img-ask.csdn.net/upload/201604/24/1461461690_603209.png)![![图片说明](https://img-ask.csdn.net/upload/201604/24/1461461584_552949.png)图片说明](https://img-ask.csdn.net/upload/201604/24/1461461571_443206.png) Mainactivity package com.example.music; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.database.Cursor; import android.os.Bundle; import android.provider.MediaStore.Audio.Media; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.AdapterView; import android.widget.Button; import android.widget.ListView; import android.widget.SimpleAdapter; import android.widget.AdapterView.OnItemClickListener; public class MainActivity extends Activity implements OnClickListener { List<Object> musiclists = new ArrayList<Object>(); List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); Button play_pause, stop, onplay, downplay, close, exit; ActivityReceiver activityReceiver; public static final String CTL_ACTION = "org.crazyit.action.CTL_ACTION"; public static final String UPDATE_ACTION = "org.crazyit.action.UPDATE_ACTION"; Intent intentservice; // 定义音乐的播放状态 ,0X11 代表停止 ,0x12代表播放,0x13代表暂停 int status = 0x11; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); UIinit(); logic(); musicList(); activityReceiver = new ActivityReceiver(); IntentFilter filter = new IntentFilter(); filter.addAction(UPDATE_ACTION); registerReceiver(activityReceiver, filter); intentservice = new Intent(this, MusicService.class); startService(intentservice); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } public void UIinit() { play_pause = (Button) this.findViewById(R.id.play_pause); stop = (Button) this.findViewById(R.id.stop); onplay = (Button) this.findViewById(R.id.onplay); close = (Button) this.findViewById(R.id.close); exit = (Button) this.findViewById(R.id.exit); downplay = (Button) this.findViewById(R.id.downplay); } public void logic() { play_pause.setOnClickListener(this); stop.setOnClickListener(this); onplay.setOnClickListener(this); downplay.setOnClickListener(this); close.setOnClickListener(this); exit.setOnClickListener(this); } @Override public void onClick(View source) { Intent intent = new Intent(CTL_ACTION); switch (source.getId()) { case R.id.play_pause: { intent.putExtra("control", 1); break; } case R.id.stop: { intent.putExtra("control", 2); break; } case R.id.onplay: { intent.putExtra("control", 3); break; } case R.id.downplay: { intent.putExtra("control", 4); break; } case R.id.close: { this.finish(); break; } case R.id.exit: { stopService(intentservice); this.finish(); break; } } sendBroadcast(intent); } public class ActivityReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { // 获取Intent中的update消息,update代表播放状态 int update = intent.getIntExtra("update", -1); switch (update) { case 0x11: { play_pause.setText("播放"); status = 0x11; break; } // 控制系统进入播放状态 case 0x12: { // 播放状态下设置使用按钮 play_pause.setText("暂停"); // 设置当前状态 status = 0x12; break; } // 控制系统进入暂停状态 case 0x13: { play_pause.setText("播放"); status = 0x13; break; } } } } /* 播放列表 */ public void musicList() { // 取得指定位置的文件设置显示到播放列表 String[] music = new String[] { Media._ID, Media.DISPLAY_NAME, Media.TITLE, Media.DURATION, Media.ARTIST, Media.DATA }; Cursor cursor = getContentResolver().query(Media.EXTERNAL_CONTENT_URI, music, null, null, null); while (cursor.moveToNext()) { Music temp = new Music(); temp.setFilename(cursor.getString(1)); temp.setTitle(cursor.getString(2)); temp.setDuration(cursor.getInt(3)); temp.setArtist(cursor.getString(4)); temp.setData(cursor.getString(5)); musiclists.add(temp); Map<String, Object> map = new HashMap<String, Object>(); map.put("name", cursor.getString(1)); map.put("artist", cursor.getString(4)); list.add(map); } ListView listview = (ListView) findViewById(R.id.musics); SimpleAdapter adapter = new SimpleAdapter(this, list, R.layout.musicsshow, new String[] { "name", "artist" }, new int[] { R.id.name, R.id.artist }); listview.setAdapter(adapter); listview.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int current, long id) { Intent intent=new Intent(CTL_ACTION); intent.putExtra("control", 5); intent.putExtra("current", current); sendBroadcast(intent); } }); } } TitanMusic.java package com.example.titan; public class TitanMusic { private String filename; private String Title; private int duration; private String artist; private String location; public String getFilename() { return filename; } public void setFilename(String filename) { this.filename = filename; } public String getTitle() { return Title; } public void setTitle(String title) { Title = title; } public int getDuration() { return duration; } public void setDuration(int duration) { this.duration = duration; } public String getArtist() { return artist; } public void setArtist(String artist) { this.artist = artist; } public String getData() { return location; } public void setData(String location) { this.location = location; } // {MediaStore.Audio.Media._ID, MediaStore.Audio.Media.DISPLAY_NAME, // MediaStore.Audio.Media.TITLE, MediaStore.Audio.Media.DURATION, // MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media.DATA } TitanMusicService.java package com.example.titan; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import android.app.Service; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.database.Cursor; import android.media.MediaPlayer; import android.media.MediaPlayer.OnCompletionListener; import android.os.IBinder; import android.provider.MediaStore.Audio.Media; import android.util.Log; public class TitanMusicService extends Service { List<Object> musiclists = new ArrayList<Object>(); List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); MyReceiver serviceReceiver; MediaPlayer mPlayer; int status = 0x11; //歌曲下标 int current = 0; int count = 0; int flog = 0; //String filename; @Override public IBinder onBind(Intent arg0) { return null; } @Override public void onDestroy() { flog=0; mPlayer.stop(); mPlayer.release(); super.onDestroy(); } @Override public void onCreate() { flog=1; musicList(); count = list.size(); Log.e("Service", "onStart"); serviceReceiver = new MyReceiver(); IntentFilter filter = new IntentFilter(); filter.addAction(MainActivity.CTL_ACTION); registerReceiver(serviceReceiver, filter); mPlayer = new MediaPlayer(); mPlayer.setOnCompletionListener(new OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { current++; if (current >= count) { current = 0; } String filename = ((TitanMusic) musiclists.get(current)).getData(); playMusic(filename); } }); super.onCreate(); } @Override public void onStart(Intent intent, int startId) { if(flog==2){ Intent sendIntent = new Intent(MainActivity.UPDATE_ACTION); sendIntent.putExtra("update", status); //sendIntent.putExtra("current", current); sendBroadcast(sendIntent); } flog=2; } private void playMusic(String path) { try { /* 重置MediaPlayer */ mPlayer.reset(); /* 设置要播放的文件的路径 */ mPlayer.setDataSource(path); /* 准备播放 */ mPlayer.prepare(); /* 开始播放 */ mPlayer.start(); mPlayer.setOnCompletionListener(new OnCompletionListener() { public void onCompletion(MediaPlayer arg0) { //播放完成一首之后进行下一首 current--; if (current < 0) { current = count; } playMusic( ((TitanMusic) musiclists.get(current)).getData()); status = 0x12; } }); }catch (IOException e){} } /* 播放列表 */ public void musicList() { // 取得指定位置的文件设置显示到播放列表 String[] music = new String[] { Media._ID, Media.DISPLAY_NAME, Media.TITLE, Media.DURATION, Media.ARTIST, Media.DATA }; Cursor cursor = getContentResolver().query(Media.EXTERNAL_CONTENT_URI, music, null, null, null); while (cursor.moveToNext()) { TitanMusic temp = new TitanMusic(); temp.setFilename(cursor.getString(1)); temp.setTitle(cursor.getString(2)); temp.setDuration(cursor.getInt(3)); temp.setArtist(cursor.getString(4)); temp.setData(cursor.getString(5)); musiclists.add(temp); Map<String, Object> map = new HashMap<String, Object>(); map.put("name", cursor.getString(1)); map.put("artist", cursor.getString(4)); list.add(map); } } public class MyReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { int control = intent.getIntExtra("control", -1); switch (control) { case 1: { // 如果原来处于停止的状态 if (status == 0x11) { playMusic( ((TitanMusic) musiclists.get(current)).getData()); status = 0x12; } // 原来处于播放状态 else if (status == 0x12) { mPlayer.pause(); status = 0x13; } // 原来处于暂停状态 else if (status == 0x13) { mPlayer.start(); status = 0x12; } break; } case 2: { // 如果原来正在播放或暂停 if (status == 0x12 || status == 0x13) { mPlayer.stop(); status = 0x11; } break; } case 3: { current--; if (current < 0) { current = count; } playMusic( ((TitanMusic) musiclists.get(current)).getData()); status = 0x12; break; } case 4: { current++; if (current > count) { current = 0; } playMusic( ((TitanMusic) musiclists.get(current)).getData()); status = 0x12; break; } case 5: { current = intent.getIntExtra("current", -1);; playMusic( ((TitanMusic) musiclists.get(current)).getData()); status = 0x12; break; } } Intent sendIntent = new Intent(MainActivity.UPDATE_ACTION); sendIntent.putExtra("update", status); // sendIntent.putExtra("current", current); sendBroadcast(sendIntent); } } } 布局代码: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <Button android:id="@+id/onplay" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="上一首" /> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="20dp" android:orientation="horizontal" > <Button android:id="@+id/play_pause" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="播放" /> <Button android:id="@+id/stop" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="停止" /> </LinearLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <Button android:id="@+id/downplay" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:text="下一首" /> </RelativeLayout> </LinearLayout> <!-- <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="音乐列表" android:textColor="#ff0000ff" android:textSize="30sp" /> --> <ListView android:id="@+id/musics" android:layout_width="match_parent" android:layout_height="257dp" android:layout_weight="1.53" > </ListView> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <Button android:id="@+id/close" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="最小化" /> <Button android:id="@+id/exit" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:text="退出" /> </RelativeLayout> </LinearLayout> </LinearLayout> 歌曲布局: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <TextView android:id="@+id/name" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="20dp" /> <TextView android:id="@+id/artist" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="20dp" /> </LinearLayout> ``` ```

ffmpeg实现web上视频转码为mp4格式用video标签却无法播放

1.问题描述:调用ffmpeg将avi格式视频转码->mp4格式,使用最简单的<video>标签进行播放只能播放声音,没有画面(黑屏)。而暴风影音等本地视频播放软件却能够正常播放转码后的视频。 2.环境:SSH框架准备实现视频上传后的自动转码并且能够网页内播放,火狐浏览器。 3.已知mp4格式分为两种,其中H264类型才能进行html播放,但按照转码命令说已经转码成:视频H264、音频aac格式了,但是仍然是黑屏(有声音)。 4.未知:(1)转码时显示的相关命令行具体意义。(2)网上所说用格式工厂进行转码即可,有没有能够通过代码调用的视频转码方法予以解决呢? 5.以下为问题截图: (1)视频转码Java代码: ``` List<String> convert = new ArrayList<String>(); convert.add(ffmpegPath); // 添加转换工具路径 convert.add("-i"); // 添加参数"-i",该参数指定要转换的文件 convert.add(sourceVideoPath); // 添加要转换格式的视频文件的路径 convert.add("-acodec"); convert.add("aac"); convert.add("-vcodec"); convert.add("libx264"); convert.add("-y"); convert.add(targetFolder+fileRealNameNoExtension+targetExtension); ``` (2)转码时的输出: ``` ffmpeg version N-93678-g4b7166c9d5 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 8.3.1 (GCC) 20190414 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt libavutil 56. 26.100 / 56. 26.100 libavcodec 58. 52.100 / 58. 52.100 libavformat 58. 27.103 / 58. 27.103 libavdevice 58. 7.100 / 58. 7.100 libavfilter 7. 50.100 / 7. 50.100 libswscale 5. 4.100 / 5. 4.100 libswresample 3. 4.100 / 3. 4.100 libpostproc 55. 4.100 / 55. 4.100 Input #0, avi, from 'E:\Test\projectVideos\temp\1557994804863.avi': Metadata: genre : Other track : 1 encoder : Lavf54.63.104 Duration: 00:00:16.80, start: 0.000000, bitrate: 2286 kb/s Stream #0:0: Video: h264 (Main) (H264 / 0x34363248), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 2151 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, mono, fltp, 128 kb/s Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264)) Stream #0:1 -> #0:1 (mp3 (mp3float) -> aac (native)) Press [q] to stop, [?] for help [libx264 @ 0000000002ebf4c0] using SAR=1/1 [libx264 @ 0000000002ebf4c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX [libx264 @ 0000000002ebf4c0] profile Progressive High, level 4.0, 4:2:0, 8-bit [libx264 @ 0000000002ebf4c0] 264 - core 157 r2970 5493be8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 Output #0, mp4, to 'E:\Test\projectVideos\encvideos\1557994804863.mp4': Metadata: genre : Other track : 1 encoder : Lavf58.27.103 Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc Metadata: encoder : Lavc58.52.100 libx264 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1 Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 69 kb/s Metadata: encoder : Lavc58.52.100 aac frame= 1 fps=0.0 q=0.0 size= 0kB time=00:00:00.06 bitrate= 5.5kbits/s speed=0.138x frame= 46 fps= 23 q=0.0 size= 0kB time=00:00:01.88 bitrate= 0.2kbits/s speed=0.936x frame= 64 fps= 25 q=28.0 size= 0kB time=00:00:02.57 bitrate= 0.1kbits/s speed=1.02x frame= 88 fps= 29 q=28.0 size= 0kB time=00:00:03.55 bitrate= 0.1kbits/s speed=1.17x frame= 108 fps= 31 q=28.0 size= 0kB time=00:00:04.34 bitrate= 0.1kbits/s speed=1.23x frame= 133 fps= 33 q=28.0 size= 0kB time=00:00:05.34 bitrate= 0.1kbits/s speed=1.32x frame= 155 fps= 34 q=28.0 size= 0kB time=00:00:06.22 bitrate= 0.1kbits/s speed=1.35x frame= 171 fps= 33 q=28.0 size= 0kB time=00:00:06.87 bitrate= 0.1kbits/s speed=1.33x frame= 186 fps= 33 q=28.0 size= 0kB time=00:00:07.47 bitrate= 0.1kbits/s speed=1.32x frame= 195 fps= 31 q=28.0 size= 0kB time=00:00:07.82 bitrate= 0.0kbits/s speed=1.25x frame= 206 fps= 30 q=28.0 size= 0kB time=00:00:08.26 bitrate= 0.0kbits/s speed=1.22x frame= 214 fps= 29 q=28.0 size= 0kB time=00:00:08.59 bitrate= 0.0kbits/s speed=1.17x frame= 223 fps= 28 q=28.0 size= 0kB time=00:00:08.96 bitrate= 0.0kbits/s speed=1.14x frame= 229 fps= 27 q=28.0 size= 0kB time=00:00:09.19 bitrate= 0.0kbits/s speed=1.09x frame= 232 fps= 25 q=28.0 size= 0kB time=00:00:09.28 bitrate= 0.0kbits/s speed=1.01x frame= 235 fps= 24 q=28.0 size= 256kB time=00:00:09.42 bitrate= 222.5kbits/s speed=0.965x frame= 240 fps= 23 q=28.0 size= 256kB time=00:00:09.63 bitrate= 217.7kbits/s speed=0.928x frame= 243 fps= 22 q=28.0 size= 256kB time=00:00:09.72 bitrate= 215.6kbits/s speed=0.894x frame= 247 fps= 21 q=28.0 size= 256kB time=00:00:09.89 bitrate= 212.1kbits/s speed=0.856x frame= 253 fps= 21 q=28.0 size= 512kB time=00:00:10.12 bitrate= 414.3kbits/s speed=0.832x frame= 258 fps= 20 q=28.0 size= 512kB time=00:00:10.33 bitrate= 406.0kbits/s speed=0.812x frame= 264 fps= 20 q=28.0 size= 512kB time=00:00:10.56 bitrate= 397.0kbits/s speed=0.791x frame= 268 fps= 19 q=28.0 size= 768kB time=00:00:10.72 bitrate= 586.5kbits/s speed=0.773x frame= 272 fps= 19 q=28.0 size= 768kB time=00:00:10.91 bitrate= 576.5kbits/s speed=0.753x frame= 278 fps= 19 q=28.0 size= 768kB time=00:00:11.14 bitrate= 564.5kbits/s speed=0.743x frame= 281 fps= 18 q=28.0 size= 768kB time=00:00:11.26 bitrate= 558.7kbits/s speed=0.725x frame= 286 fps= 18 q=28.0 size= 1024kB time=00:00:11.47 bitrate= 731.3kbits/s speed=0.715x frame= 291 fps= 17 q=28.0 size= 1024kB time=00:00:11.67 bitrate= 718.3kbits/s speed=0.701x frame= 296 fps= 17 q=25.0 size= 1024kB time=00:00:11.86 bitrate= 707.0kbits/s speed=0.687x frame= 303 fps= 17 q=28.0 size= 1280kB time=00:00:12.14 bitrate= 863.5kbits/s speed=0.681x frame= 308 fps= 17 q=28.0 size= 1280kB time=00:00:12.35 bitrate= 848.9kbits/s speed=0.67x frame= 312 fps= 16 q=28.0 size= 1280kB time=00:00:12.51 bitrate= 837.8kbits/s speed=0.661x frame= 319 fps= 16 q=28.0 size= 1280kB time=00:00:12.79 bitrate= 819.6kbits/s speed=0.658x frame= 341 fps= 17 q=28.0 size= 1280kB time=00:00:13.65 bitrate= 768.0kbits/s speed=0.684x frame= 362 fps= 18 q=28.0 size= 1280kB time=00:00:14.48 bitrate= 723.7kbits/s speed=0.708x frame= 391 fps= 19 q=28.0 size= 1280kB time=00:00:15.67 bitrate= 669.0kbits/s speed=0.746x frame= 419 fps= 19 q=28.0 size= 1280kB time=00:00:16.67 bitrate= 629.0kbits/s speed=0.774x frame= 419 fps= 19 q=-1.0 Lsize= 1538kB time=00:00:16.71 bitrate= 753.7kbits/s speed=0.753x video:1480kB audio:43kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.976535% [libx264 @ 0000000002ebf4c0] frame I:2 Avg QP:13.37 size: 32816 [libx264 @ 0000000002ebf4c0] frame P:143 Avg QP:14.70 size: 6977 [libx264 @ 0000000002ebf4c0] frame B:274 Avg QP:13.65 size: 1647 [libx264 @ 0000000002ebf4c0] consecutive B-frames: 9.8% 7.6% 4.3% 78.3% [libx264 @ 0000000002ebf4c0] mb I I16..4: 38.7% 53.1% 8.1% [libx264 @ 0000000002ebf4c0] mb P I16..4: 17.5% 18.5% 0.2% P16..4: 5.5% 0.4% 0.2% 0.0% 0.0% skip:57.7% [libx264 @ 0000000002ebf4c0] mb B I16..4: 2.0% 0.7% 0.0% B16..8: 3.7% 0.2% 0.0% direct: 2.9% skip:90.5% L0:49.2% L1:48.4% BI: 2.4% [libx264 @ 0000000002ebf4c0] 8x8 transform intra:48.1% inter:84.8% [libx264 @ 0000000002ebf4c0] coded y,uvDC,uvAC intra: 3.9% 31.3% 4.5% inter: 0.7% 5.4% 0.2% [libx264 @ 0000000002ebf4c0] i16 v,h,dc,p: 22% 68% 4% 6% [libx264 @ 0000000002ebf4c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 27% 42% 0% 0% 0% 0% 0% 0% [libx264 @ 0000000002ebf4c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 28% 24% 2% 4% 3% 4% 2% 3% [libx264 @ 0000000002ebf4c0] i8c dc,h,v,p: 48% 39% 11% 2% [libx264 @ 0000000002ebf4c0] Weighted P-Frames: Y:23.1% UV:22.4% [libx264 @ 0000000002ebf4c0] ref P L0: 65.5% 9.2% 23.1% 1.9% 0.3% [libx264 @ 0000000002ebf4c0] ref B L0: 71.1% 28.4% 0.5% [libx264 @ 0000000002ebf4c0] ref B L1: 98.8% 1.2% [libx264 @ 0000000002ebf4c0] kb/s:723.03 [aac @ 0000000002dc0980] Qavg: 47784.133 生成mp4视频为:E:\Test\projectVideos\temp\1557994804863.mp4 ``` (3)播放时的截图 ![图片说明](https://img-ask.csdn.net/upload/201905/16/1557997780_707491.png) (4) 播放视频jsp代码(使用的是video-js,但测试时也试了一下不加视频插件直接<video>标签播放,结果一样) ``` <video id="playVideo" class="video-js vjs-default-skin" controls ="true" preload="auto" width="960" height="480" poster="/images/${VIDEO.vpicture}" data-setup='{}'> <source src="/videos/${VIDEO.vpath}" type='video/mp4' /> </video> ``` ("/videos"为虚拟路径 实为本地存储地址) 希望好心人能够予以慷慨解答!~ 补充:在转wmv格式到MP4格式时出现了 ``` ConverVideoTest说:传入工具类的源视频为:E:\Test\projectVideos\temp\1558578421815.wmv ----接收到文件(E:\Test\projectVideos\temp\1558578421815.wmv)需要转换------- ----开始转文件(E:\Test\projectVideos\temp\1558578421815.wmv)-------------------------- 源视频类型为:wmv 可以转换,统一转为mp4文件 调用了ffmpeg.exe工具 该文件夹存在。 ffmpeg输入的命令:E:\ffmpeg\bin\ffmpeg.exe-iE:\Test\projectVideos\temp\1558578421815.wmv-acodecaac-vcodeclibx264-yE:\Test\projectVideos\encvideos\1558578421815.mp4 ffmpeg version N-93678-g4b7166c9d5 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 8.3.1 (GCC) 20190414 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt libavutil 56. 26.100 / 56. 26.100 libavcodec 58. 52.100 / 58. 52.100 libavformat 58. 27.103 / 58. 27.103 libavdevice 58. 7.100 / 58. 7.100 libavfilter 7. 50.100 / 7. 50.100 libswscale 5. 4.100 / 5. 4.100 libswresample 3. 4.100 / 3. 4.100 libpostproc 55. 4.100 / 55. 4.100 Input #0, asf, from 'E:\Test\projectVideos\temp\1558578421815.wmv': Metadata: DeviceConformanceTemplate: M1 WMFSDKNeeded : 0.0.0.0000 WM/WMADRCPeakReference: 7851 WM/WMADRCPeakTarget: 7851 WM/WMADRCAverageReference: 1027 WM/WMADRCAverageTarget: 1027 WMFSDKVersion : 12.0.7601.17514 IsVBR : 0 Duration: 00:00:16.58, bitrate: 1969 kb/s Stream #0:0(chi): Audio: wmapro (b[1][0][0] / 0x0162), 48000 Hz, stereo, fltp, 256 kb/s Stream #0:1(chi): Video: vc1 (Advanced) (WVC1 / 0x31435657), yuv420p, 1352x696 [SAR 1:1 DAR 169:87], 3400 kb/s, 30 tbr, 1k tbn, 60 tbc Stream mapping: Stream #0:1 -> #0:0 (vc1 (native) -> h264 (libx264)) Stream #0:0 -> #0:1 (wmapro (native) -> aac (native)) Press [q] to stop, [?] for help [libx264 @ 0000000000531c80] using SAR=1/1 [libx264 @ 0000000000531c80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX [libx264 @ 0000000000531c80] profile Progressive High, level 3.2, 4:2:0, 8-bit [libx264 @ 0000000000531c80] 264 - core 157 r2970 5493be8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 frame= 11 fps=0.0 q=0.0 size= 0kB time=-577014:32:22.77 bitrate= -0.0kbits/s dup=1 drop=0 speed=N/A frame= 52 fps= 48 q=0.0 size= 0kB time=-577014:32:22.77 bitrate= -0.0kbits/s dup=1 drop=0 speed=N/A frame= 85 fps= 54 q=0.0 size= 0kB time=-577014:32:22.77 bitrate= -0.0kbits/s dup=1 drop=0 speed=N/A frame= 145 fps= 64 q=0.0 size= 0kB time=-577014:32:22.77 bitrate= -0.0kbits/s dup=47 drop=0 speed=N/A frame= 171 fps= 61 q=0.0 size= 0kB time=-577014:32:22.77 bitrate= -0.0kbits/s dup=55 drop=0 speed=N/A Too many packets buffered for output stream 0:0. [libx264 @ 0000000000531c80] frame I:2 Avg QP:15.28 size: 56950 [libx264 @ 0000000000531c80] frame P:34 Avg QP:14.18 size: 1252 [libx264 @ 0000000000531c80] frame B:93 Avg QP:15.53 size: 140 [libx264 @ 0000000000531c80] consecutive B-frames: 3.1% 1.6% 2.3% 93.0% [libx264 @ 0000000000531c80] mb I I16..4: 14.9% 79.5% 5.6% [libx264 @ 0000000000531c80] mb P I16..4: 0.7% 1.1% 0.0% P16..4: 4.1% 1.4% 1.3% 0.0% 0.0% skip:91.4% [libx264 @ 0000000000531c80] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 3.6% 0.0% 0.0% direct: 0.0% skip:96.4% L0:36.8% L1:63.2% BI: 0.0% [libx264 @ 0000000000531c80] 8x8 transform intra:74.4% inter:80.1% [libx264 @ 0000000000531c80] coded y,uvDC,uvAC intra: 38.4% 33.4% 20.3% inter: 0.5% 0.2% 0.0% [libx264 @ 0000000000531c80] i16 v,h,dc,p: 61% 25% 9% 6% [libx264 @ 0000000000531c80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 32% 31% 21% 2% 3% 3% 3% 3% 3% [libx264 @ 0000000000531c80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 32% 14% 4% 5% 5% 5% 4% 6% [libx264 @ 0000000000531c80] i8c dc,h,v,p: 76% 13% 8% 4% [libx264 @ 0000000000531c80] Weighted P-Frames: Y:0.0% UV:0.0% [libx264 @ 0000000000531c80] ref P L0: 85.1% 6.8% 6.5% 1.6% [libx264 @ 0000000000531c80] ref B L0: 48.1% 47.5% 4.4% [libx264 @ 0000000000531c80] ref B L1: 93.2% 6.8% [libx264 @ 0000000000531c80] kb/s:315.41 **Conversion failed!** 生成mp4视频为:E:\Test\projectVideos\temp1558578421815.mp4 ===========视频转码结束,开始截图================= 该文件夹存在。 截图命令:E:\ffmpeg\bin\ffmpeg.exe-ss00:00:01-iE:\Test\projectVideos\temp\1558578421815.wmv-y-fimage2-s154x90E:\Test\projectVideos\images\1558578421815.jpg ffmpeg version N-93678-g4b7166c9d5 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 8.3.1 (GCC) 20190414 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt libavutil 56. 26.100 / 56. 26.100 libavcodec 58. 52.100 / 58. 52.100 libavformat 58. 27.103 / 58. 27.103 libavdevice 58. 7.100 / 58. 7.100 libavfilter 7. 50.100 / 7. 50.100 libswscale 5. 4.100 / 5. 4.100 libswresample 3. 4.100 / 3. 4.100 libpostproc 55. 4.100 / 55. 4.100 Input #0, asf, from 'E:\Test\projectVideos\temp\1558578421815.wmv': Metadata: DeviceConformanceTemplate: M1 WMFSDKNeeded : 0.0.0.0000 WM/WMADRCPeakReference: 7851 WM/WMADRCPeakTarget: 7851 WM/WMADRCAverageReference: 1027 WM/WMADRCAverageTarget: 1027 WMFSDKVersion : 12.0.7601.17514 IsVBR : 0 Duration: 00:00:16.58, bitrate: 1969 kb/s Stream #0:0(chi): Audio: wmapro (b[1][0][0] / 0x0162), 48000 Hz, stereo, fltp, 256 kb/s Stream #0:1(chi): Video: vc1 (Advanced) (WVC1 / 0x31435657), yuv420p, 1352x696 [SAR 1:1 DAR 169:87], 3400 kb/s, 30 tbr, 1k tbn, 60 tbc Stream mapping: Stream #0:1 -> #0:0 (vc1 (native) -> mjpeg (native)) Press [q] to stop, [?] for help [swscaler @ 0000000002ecd4c0] deprecated pixel format used, make sure you did set range correctly Output #0, image2, to 'E:\Test\projectVideos\images\1558578421815.jpg': Metadata: DeviceConformanceTemplate: M1 WMFSDKNeeded : 0.0.0.0000 WM/WMADRCPeakReference: 7851 WM/WMADRCPeakTarget: 7851 WM/WMADRCAverageReference: 1027 WM/WMADRCAverageTarget: 1027 WMFSDKVersion : 12.0.7601.17514 IsVBR : 0 encoder : Lavf58.27.103 Stream #0:0(chi): Video: mjpeg, yuvj420p(pc), 154x90 [SAR 2535:2233 DAR 169:87], q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc Metadata: encoder : Lavc58.52.100 mjpeg Side data: cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1 [image2 @ 0000000000628e00] Could not get frame filename number 2 from pattern 'E:\Test\projectVideos\images\1558578421815.jpg'. Use '-frames:v 1' for a single image, or '-update' option, or use a pattern such as %03d within the filename. av_interleaved_write_frame(): Invalid argument frame= 2 fps=0.0 q=1.6 size=N/A time=00:00:00.06 bitrate=N/A speed=0.102x frame= 2 fps=0.0 q=1.6 Lsize=N/A time=00:00:00.06 bitrate=N/A speed=0.097x video:3kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown Conversion failed! 截图进程结束 截图成功! ``` 即出现了Conversion failed!!!

2019 Python开发者日-培训

2019 Python开发者日-培训

150讲轻松搞定Python网络爬虫

150讲轻松搞定Python网络爬虫

设计模式(JAVA语言实现)--20种设计模式附带源码

设计模式(JAVA语言实现)--20种设计模式附带源码

YOLOv3目标检测实战:训练自己的数据集

YOLOv3目标检测实战:训练自己的数据集

java后台+微信小程序 实现完整的点餐系统

java后台+微信小程序 实现完整的点餐系统

三个项目玩转深度学习(附1G源码)

三个项目玩转深度学习(附1G源码)

初级玩转Linux+Ubuntu(嵌入式开发基础课程)

初级玩转Linux+Ubuntu(嵌入式开发基础课程)

2019 AI开发者大会

2019 AI开发者大会

玩转Linux:常用命令实例指南

玩转Linux:常用命令实例指南

一学即懂的计算机视觉(第一季)

一学即懂的计算机视觉(第一季)

4小时玩转微信小程序——基础入门与微信支付实战

4小时玩转微信小程序——基础入门与微信支付实战

Git 实用技巧

Git 实用技巧

Python数据清洗实战入门

Python数据清洗实战入门

使用TensorFlow+keras快速构建图像分类模型

使用TensorFlow+keras快速构建图像分类模型

实用主义学Python(小白也容易上手的Python实用案例)

实用主义学Python(小白也容易上手的Python实用案例)

程序员的算法通关课:知己知彼(第一季)

程序员的算法通关课:知己知彼(第一季)

MySQL数据库从入门到实战应用

MySQL数据库从入门到实战应用

机器学习初学者必会的案例精讲

机器学习初学者必会的案例精讲

手把手实现Java图书管理系统(附源码)

手把手实现Java图书管理系统(附源码)

极简JAVA学习营第四期(报名以后加助教微信:eduxy-1)

极简JAVA学习营第四期(报名以后加助教微信:eduxy-1)

.net core快速开发框架

.net core快速开发框架

玩转Python-Python3基础入门

玩转Python-Python3基础入门

Python数据挖掘简易入门

Python数据挖掘简易入门

微信公众平台开发入门

微信公众平台开发入门

程序员的兼职技能课

程序员的兼职技能课

Windows版YOLOv4目标检测实战:训练自己的数据集

Windows版YOLOv4目标检测实战:训练自己的数据集

HoloLens2开发入门教程

HoloLens2开发入门教程

微信小程序开发实战

微信小程序开发实战

Java8零基础入门视频教程

Java8零基础入门视频教程

相关热词 c# 开发接口 c# 中方法上面的限制 c# java 时间戳 c#单元测试入门 c# 数组转化成文本 c#实体类主外键关系设置 c# 子函数 局部 c#窗口位置设置 c# list 查询 c# 事件 执行顺序
立即提问