【直播技术探讨第二章】视频的采集(音频穿插,待续)

音视频开发之旅(五) -----变声 FMOD和soundTouch使用和对比 音视频开发(五) 变声 FMOD和soundTouch 对比 1前言 这边先穿插一下变声相关的知识 ,这一章主要讲音频的处理。对音频修改的具体使用工具是 fmod和soundTouch ,按照惯例先给出源码。 github直通车 2声音基础概念 2.1原理 声音是一种波动,当演奏乐器、拍打一扇门或者敲击桌面时,声音的振动会引起介质——空气分子有节奏的振动,使周围的空气产生疏密变化,形成疏密相间的纵波,这就产生了声波,这种现象会一直延续到振动消失为止。 声音总可以被分解为不同频率不同强度正弦波的叠加。这种变换 阅读详情

【直播技术探讨第二章】

视频的采集,那到底怎么采集呢?小白努力中。。

 

采集是整个视频推流过程中的第一个环节,它从系统的采集设备中获取原始视频数据,将其输出到下一个环节。视频的采集涉及两方面数据的采集:音频采集和图像采集,它们分别对应两种完全不同的输入源和数据格式。

·        音频采集 
音频数据既能与图像结合组合成视频数据,也能以纯音频的方式采集播放,后者在很多成熟的应用场景如在线电台和语音电台等起着非常重要的作用。音频的采集过程主要通过设备将环境中的模拟信号采集成 PCM编码的原始数据,然后编码压缩成 MP3等格式的数据分发出去。常见的音频压缩格式有:MP3,AAC,HE-AAC,Opus,FLAC,Vorbis (Ogg),Speex和 AMR等。 
音频采集和编码主要面临的挑战在于:延时敏感、卡顿敏感、噪声消除(Denoise)、回声消除(AEC)、静音检测(VAD)和各种混音算法等。

·        图像采集 
将图像采集的图片结果组合成一组连续播放的动画,即构成视频中可肉眼观看的内容。图像的采集过程主要由摄像头等设备拍摄成 YUV编码的原始数据,然后经过编码压缩成 H.264等格式的数据分发出去。常见的视频封装格式有:MP4、3GP、AVI、MKV、WMV、MPG、VOB、FLV、SWF、MOV、RMVB和 WebM 等。 
图像由于其直观感受最强并且体积也比较大,构成了一个视频内容的主要部分。图像采集和编码面临的主要挑战在于:设备兼容性差、延时敏感、卡顿敏感以及各种对图像的处理操作如美颜和水印等。

 视频采集的采集源主要有 摄像头采集、屏幕录制和从视频文件推流。

【此段文字简介来自:http://blog.csdn.net/stn_lcd/article/details/56012437】

【具体请看这个链接:http://news.sina.com.cn/o/2016-08-25/doc-ifxvitex8951990.shtml】

 图像采集

1、  摄像头采集

  通过Android Camera拍摄预览中设置setPreviewCallback实现onPreviewFrame接口,实时截取每一帧视频流数据

 代码实现如下:

 

packagecom.example.rtpalyerone;
 
importjava.io.IOException;
importjava.util.List;
 
importandroid.app.Activity;
importandroid.content.Context;
importandroid.content.pm.ActivityInfo;
importandroid.hardware.Camera;
importandroid.hardware.Camera.Parameters;
importandroid.hardware.Camera.Size;
importandroid.os.Bundle;
importandroid.os.PowerManager;
importandroid.os.PowerManager.WakeLock;
importandroid.util.Log;
importandroid.view.Menu;
importandroid.view.MenuItem;
importandroid.view.SurfaceHolder;
importandroid.view.SurfaceHolder.Callback;
importandroid.view.Surface;
importandroid.view.SurfaceView;
importandroid.view.View;
importandroid.view.Window;
importandroid.view.WindowManager;
 
public classMainActivity extends Activity {
 
              private SurfaceView _surface;
              private WakeLock wakeLock;
              public int _iDegrees;
              public boolean _bIsFront;
              public Camera _mCamera;
              private Integer _iCameraCodecType;
              private final int FRAMERATE_DEF =20;
 
              @Override
              protected void onCreate(BundlesavedInstanceState) {
                            requestWindowFeature(Window.FEATURE_NO_TITLE);
                            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
                            getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
                            super.onCreate(savedInstanceState);
                            setContentView(R.layout.activity_main);
                            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
                           
                            PowerManager pm =(PowerManager) getSystemService(Context.POWER_SERVICE);
                            wakeLock =pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "my tag");
                            init();
              }
 
              private void init() {
                            // TODOAuto-generated method stub
                            _surface =(SurfaceView)findViewById(R.id.surface);
                            //_surface.getHolder().setFixedSize(width,height)
                            _surface.getHolder().setKeepScreenOn(true);
                            _surface.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
                            _surface.getHolder().addCallback(newSurceCallBack());
              }
             
              @Override
              protected void onResume() {
                            // TODOAuto-generated method stub
                            super.onResume();
                            wakeLock.acquire();
              }
             
              @Override
              protected void onPause() {
                            // TODOAuto-generated method stub
                            super.onPause();
                            wakeLock.release();
              }
              /**
               * 获取旋转角度
               * @return
               */
              private int getDispalyRotation() {
                            int i =getWindowManager().getDefaultDisplay().getRotation();
                            switch (i) {
                                          caseSurface.ROTATION_0:
                                                        return0;
                                          caseSurface.ROTATION_90:
                                                        return90;
                                          caseSurface.ROTATION_180:
                                                        return180;
                                          caseSurface.ROTATION_270:
                                                        return270;
                            }
                            return 0;
              }
              /**
               * 获取摄像头应该对应的角度
               * @param degrees
               * @param cameraId
               * @return
               */
              private intgetDisplayOritation(int degrees, int cameraId) {
                            Camera.CameraInfoinfo = new Camera.CameraInfo();
                            Camera.getCameraInfo(cameraId,info);
                            int result = 0;
                            if (info.facing ==Camera.CameraInfo.CAMERA_FACING_FRONT) {
                                          result= (info.orientation + degrees) % 360;
                                          result= (360 - result) % 360;
                            } else {
                                          result= (info.orientation - degrees + 360) % 360;
                            }
                            return result;
              }
 
              /**
               * surfaceView 回调
               * @author Administrator
               *
               */
              private class SurceCallBack  implements SurfaceHolder.Callback{
 
 
                            @Override
                            public voidsurfaceCreated(SurfaceHolder holder) {
                                          //TODO Auto-generated method stub
                                          _iDegrees= getDisplayOritation(getDispalyRotation(), 0);
                                          //华为i7前后共用摄像头
                                          if(Camera.getNumberOfCameras() == 1) {
                                                        _bIsFront= false;
                                                        _mCamera= Camera.open(Camera.CameraInfo.CAMERA_FACING_BACK);
                                          } else{
                                                        _mCamera= Camera.open(Camera.CameraInfo.CAMERA_FACING_FRONT);
                                          }
                                          InitCamera();
                            }
 
                            @Override
                            public voidsurfaceChanged(SurfaceHolder holder, int format, int width,
                                                        intheight) {
                                          _mCamera.autoFocus(newCamera.AutoFocusCallback() {
                                                        @Override
                                                        publicvoid onAutoFocus(boolean success, Camera camera) {
                                                                      if(success) {
                                                                                    InitCamera();
                                                                                    camera.cancelAutoFocus();//只有加上了这一句,才会自动对焦。
                                                                      }
                                                        }
                                          });
                            }
 
                            @Override
                            public voidsurfaceDestroyed(SurfaceHolder holder) {
                                          //TODO Auto-generated method stub
                                          }
                           
              }
              /**
               * 初始化相机设置
               */
              private void InitCamera(){
                            Camera.Parameters p= _mCamera.getParameters();
 
                            Size prevewSize =p.getPreviewSize();
                            showlog("OriginalWidth:" + prevewSize.width + ", height:" + prevewSize.height);
 
                            List<Size>PreviewSizeList = p.getSupportedPreviewSizes();
                            List<Integer>PreviewFormats = p.getSupportedPreviewFormats();
                            showlog("Listingall supported preview sizes");
                            for (Camera.Sizesize : PreviewSizeList) {
                                          showlog("  w: " + size.width + ", h: " +size.height);
                            }
 
                            showlog("Listingall supported preview formats");
                            Integer iNV21Flag =0;
                            Integer iYV12Flag =0;
                            for (IntegeryuvFormat : PreviewFormats) {
                                          if(yuvFormat==android.graphics.ImageFormat.YV12){
                                                        iYV12Flag= android.graphics.ImageFormat.YV12;
                                          }
                                          if(yuvFormat == android.graphics.ImageFormat.NV21) {
                                                        iNV21Flag= android.graphics.ImageFormat.NV21;
                                          }
                            }
                            if (iNV21Flag != 0){
                                          _iCameraCodecType= iNV21Flag;
                            } else if (iYV12Flag!= 0) {
                                          _iCameraCodecType= iYV12Flag;
                            }
                            p.setPreviewFormat(_iCameraCodecType);
                            p.setPreviewFrameRate(FRAMERATE_DEF);
                            _mCamera.setDisplayOrientation(_iDegrees);
                            p.setRotation(_iDegrees);
                            _mCamera.setPreviewCallback(_previewCallback);
                            _mCamera.setParameters(p);
                            try {
                                          _mCamera.setPreviewDisplay(_surface.getHolder());
                            } catch (IOExceptione) {
                                          //TODO Auto-generated catch block
                                          e.printStackTrace();
                            }
                            _mCamera.cancelAutoFocus();//只有加上了这一句,才会自动对焦。
                            _mCamera.startPreview();
              }
              /**
               * 相机采集到的数据信息
               */
              private Camera.PreviewCallback_previewCallback = new Camera.PreviewCallback() {
                            @Override
                            public voidonPreviewFrame(byte[] YUV, Camera currentCamera) {
                                         
                                           /*
                                            * 此处为相机采集到的数据,后续,需要数据转码处理
                                            */
                           
                            }
              };
             
              private void showlog(Stringlogmsg){
                            Log.e("log",logmsg);
              }
}

注意还有一些权限设置别忘记了

<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />


 

2、  屏幕录制

通过使用 MediaProjectionManager, VirtualDisplay, MediaCodec 以及 MediaMuxer 等API,故而这个项目仅支持Android 5.0。

原理

  • Display 可以“投影”到一个 VirtualDisplay
  • 通过 MediaProjectionManager 取得的 MediaProjection创建VirtualDisplay
  • VirtualDisplay 会将图像渲染到 Surface中,而这个Surface是由MediaCodec所创建的

代码如下:

/*
 * Copyright (c) 2014 Yrom Wang <http://www.yrom.net>
 *
 * 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.example.rtpalyerone.screen;

import android.app.Activity;
import android.content.Intent;
import android.media.projection.MediaProjection;
import android.media.projection.MediaProjectionManager;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import java.io.File;

import com.example.rtpalyerone.R;

public class MainActivity extends Activity implements View.OnClickListener {
    private static final int REQUEST_CODE = 1;
    private MediaProjectionManager mMediaProjectionManager;
    private ScreenRecorder mRecorder;
    private Button mButton;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.screen_main);
        mButton = (Button) findViewById(R.id.button);
        mButton.setOnClickListener(this);
        //noinspection ResourceType
        mMediaProjectionManager = (MediaProjectionManager) getSystemService(MEDIA_PROJECTION_SERVICE);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        MediaProjection mediaProjection = mMediaProjectionManager.getMediaProjection(resultCode, data);
        if (mediaProjection == null) {
            Log.e("@@", "media projection is null");
            return;
        }
        // video size
        final int width = 720;
        final int height = 1280;
        File file = new File(Environment.getExternalStorageDirectory(),
                "record-" + width + "x" + height + "-" + System.currentTimeMillis() + ".mp4");
        final int bitrate = 6000000;
        mRecorder = new ScreenRecorder(width, height, bitrate, 1, mediaProjection, file.getAbsolutePath());
        mRecorder.start();
        mButton.setText("Stop Recorder");
        Toast.makeText(this, "Screen recorder is running...", Toast.LENGTH_SHORT).show();
        moveTaskToBack(true);
    }

    @Override
    public void onClick(View v) {
        if (mRecorder != null) {
            mRecorder.quit();
            mRecorder = null;
            mButton.setText("Restart recorder");
        } else {
            Intent captureIntent = mMediaProjectionManager.createScreenCaptureIntent();
            startActivityForResult(captureIntent, REQUEST_CODE);
        }
    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
        if(mRecorder != null){
            mRecorder.quit();
            mRecorder = null;
        }
    }
}

/*
 * Copyright (c) 2014 Yrom Wang <http://www.yrom.net>
 *
 * 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.example.rtpalyerone.screen;

import android.hardware.display.DisplayManager;
import android.hardware.display.VirtualDisplay;
import android.media.MediaCodec;
import android.media.MediaCodecInfo;
import android.media.MediaFormat;
import android.media.MediaMuxer;
import android.media.projection.MediaProjection;
import android.util.Log;
import android.view.Surface;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.concurrent.atomic.AtomicBoolean;

/**
 * @author Yrom
 */
public class ScreenRecorder extends Thread {
    private static final String TAG = "ScreenRecorder";

    private int mWidth;
    private int mHeight;
    private int mBitRate;
    private int mDpi;
    private String mDstPath;
    private MediaProjection mMediaProjection;
    // parameters for the encoder
    private static final String MIME_TYPE = "video/avc"; // H.264 Advanced Video Coding
    private static final int FRAME_RATE = 30; // 30 fps
    private static final int IFRAME_INTERVAL = 10; // 10 seconds between I-frames
    private static final int TIMEOUT_US = 10000;

    private MediaCodec mEncoder;
    private Surface mSurface;
    private MediaMuxer mMuxer;
    private boolean mMuxerStarted = false;
    private int mVideoTrackIndex = -1;
    private AtomicBoolean mQuit = new AtomicBoolean(false);
    private MediaCodec.BufferInfo mBufferInfo = new MediaCodec.BufferInfo();
    private VirtualDisplay mVirtualDisplay;

    public ScreenRecorder(int width, int height, int bitrate, int dpi, MediaProjection mp, String dstPath) {
        super(TAG);
        mWidth = width;
        mHeight = height;
        mBitRate = bitrate;
        mDpi = dpi;
        mMediaProjection = mp;
        mDstPath = dstPath;
    }


    public ScreenRecorder(MediaProjection mp) {
        // 480p 2Mbps
        this(640, 480, 2000000, 1, mp, "/sdcard/test.mp4");
    }

    /**
     * stop task
     */
    public final void quit() {
        mQuit.set(true);
    }

    @Override
    public void run() {
        try {
            try {
                prepareEncoder();
                mMuxer = new MediaMuxer(mDstPath, MediaMuxer.OutputFormat.MUXER_OUTPUT_MPEG_4);

            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            mVirtualDisplay = mMediaProjection.createVirtualDisplay(TAG + "-display",
                    mWidth, mHeight, mDpi, DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC,
                    mSurface, null, null);
            Log.d(TAG, "created virtual display: " + mVirtualDisplay);
            recordVirtualDisplay();

        } finally {
            release();
        }
    }

    private void recordVirtualDisplay() {
        while (!mQuit.get()) {
            int index = mEncoder.dequeueOutputBuffer(mBufferInfo, TIMEOUT_US);
            Log.i(TAG, "dequeue output buffer index=" + index);
            if (index == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) {
                resetOutputFormat();

            } else if (index == MediaCodec.INFO_TRY_AGAIN_LATER) {
                Log.d(TAG, "retrieving buffers time out!");
                try {
                    // wait 10ms
                    Thread.sleep(10);
                } catch (InterruptedException e) {
                }
            } else if (index >= 0) {

                if (!mMuxerStarted) {
                    throw new IllegalStateException("MediaMuxer dose not call addTrack(format) ");
                }
                encodeToVideoTrack(index);

                mEncoder.releaseOutputBuffer(index, false);
            }
        }
    }

    private void encodeToVideoTrack(int index) {
        ByteBuffer encodedData = mEncoder.getOutputBuffer(index);

        if ((mBufferInfo.flags & MediaCodec.BUFFER_FLAG_CODEC_CONFIG) != 0) {
            // The codec config data was pulled out and fed to the muxer when we got
            // the INFO_OUTPUT_FORMAT_CHANGED status.
            // Ignore it.
            Log.d(TAG, "ignoring BUFFER_FLAG_CODEC_CONFIG");
            mBufferInfo.size = 0;
        }
        if (mBufferInfo.size == 0) {
            Log.d(TAG, "info.size == 0, drop it.");
            encodedData = null;
        } else {
            Log.d(TAG, "got buffer, info: size=" + mBufferInfo.size
                    + ", presentationTimeUs=" + mBufferInfo.presentationTimeUs
                    + ", offset=" + mBufferInfo.offset);
        }
        if (encodedData != null) {
            encodedData.position(mBufferInfo.offset);
            encodedData.limit(mBufferInfo.offset + mBufferInfo.size);
            mMuxer.writeSampleData(mVideoTrackIndex, encodedData, mBufferInfo);
            Log.i(TAG, "sent " + mBufferInfo.size + " bytes to muxer...");
        }
    }

    private void resetOutputFormat() {
        // should happen before receiving buffers, and should only happen once
        if (mMuxerStarted) {
            throw new IllegalStateException("output format already changed!");
        }
        MediaFormat newFormat = mEncoder.getOutputFormat();

        Log.i(TAG, "output format changed.\n new format: " + newFormat.toString());
        mVideoTrackIndex = mMuxer.addTrack(newFormat);
        mMuxer.start();
        mMuxerStarted = true;
        Log.i(TAG, "started media muxer, videoIndex=" + mVideoTrackIndex);
    }

    private void prepareEncoder() throws IOException {

        MediaFormat format = MediaFormat.createVideoFormat(MIME_TYPE, mWidth, mHeight);
        format.setInteger(MediaFormat.KEY_COLOR_FORMAT,
                MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface);
        format.setInteger(MediaFormat.KEY_BIT_RATE, mBitRate);
        format.setInteger(MediaFormat.KEY_FRAME_RATE, FRAME_RATE);
        format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, IFRAME_INTERVAL);

        Log.d(TAG, "created video format: " + format);
        mEncoder = MediaCodec.createEncoderByType(MIME_TYPE);
        mEncoder.configure(format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);
        mSurface = mEncoder.createInputSurface();
        Log.d(TAG, "created input surface: " + mSurface);
        mEncoder.start();
    }

    private void release() {
        if (mEncoder != null) {
            mEncoder.stop();
            mEncoder.release();
            mEncoder = null;
        }
        if (mVirtualDisplay != null) {
            mVirtualDisplay.release();
        }
        if (mMediaProjection != null) {
            mMediaProjection.stop();
        }
        if (mMuxer != null) {
            mMuxer.stop();
            mMuxer.release();
            mMuxer = null;
        }
    }
}

本段代码转载自网上,非个人所写

3、  H.264RAW

待续

4、  自定义采集

待续

音视频开发实战:从麦克风到MP4,一步步解析音视频采集与封装全流程 本文详细解析了音视频开发从采集到封装的全流程实战。通过FFmpeg、OpenCV等工具,深入探讨了音频采样、视频编码及MP4封装等核心环节,并提供了代码示例和常见问题解决方案,帮助开发者构建稳定高效的音视频应用。 阅读详情

相关推荐

kali设置安装burpsuite中文版

工具:通过网盘分享的文件:Burpsuite 链接:提取码: jay1。

m0_74786138的博客 5218

Android多媒体-视频-录屏三种方式

createScreenCaptureIntent()这个方法会返回一个intent,你可以通过startActivityForResult方法来传递这个intent,为了能开始屏幕捕捉,activity会提示用户是否允许屏幕捕捉(为了防止开发者做一个木马,来捕获用户私人信息),你可以通过getMediaProjection来获取屏幕捕捉的结果。screenrecord是一个shell命令,支持Android4.4(API level 19)以上,录制的视频格式为mp4 ,存放到手机sd卡里,默认录。

weixin_47145826的博客 4043

使用 ANSYS AEDT(双向耦合)对高功率射频同轴滤波器进行热分析

使用 ANSYS HFSS,可以精确计算 EM 损耗,然后将其导入 ANSYS 热分析并使用 ANSYS Icepak CFD 求解器进行仿真,以帮助工程师解决最复杂的热挑战,并预测其设计在温度变化下的表现。然后,RF 损耗将与 ANSYS Icepak CFD 求解器耦合,以执行热分析,包括传热的传导、对流和辐射模式,并计算温度曲线。在此演示中,我们将仿真下面的 RF 同轴滤波器,并计算由于所用材料的有限电导率和介电损耗而导致的 RF 传导损耗。设置 HFSS 设计后,我们可以开始 HFSS 仿真。

jkh920184196的博客 1063

MediaStream,AudioTrack,VideoTrack的关系

在webrtc中,MediaStream代表一个媒体流,AudioTrack,VideoTrack代表音频”轨道”和视频“轨道”,如同一个MP4文件可以包含许多音轨和视频轨一样,一个MediaStream中可以包含多个AudioTrack和VideoTrack,它们的关系如下图:

奔向火星的博客 5553

沐数科技数据开发岗笔试题2025

与数据库中的主键(Primary Key)​有所不同,业务主键(Business Key)​是业务层面的唯一标识,通常由业务规则决定,例如,订单号、订单明细号,身份证号等。用户授信表(table_credit):包含用户ID(uid)、授信申请时间(credit_submit_time_local)、授信状态(credit_status)。:在正态分布中,大约68%的数据值落在距离均值一个标准差的范围内,约95%的数据值落在两个标准差的范围内,而约99.7%的数据值落在三个标准差的范围内。

weixin_40121264的博客 3535

全面分析总结解决Could not transfer artifact org.apache.maven.plugins等此类问题的方法

全面分析总结解决Could not transfer artifact org.apache.maven.plugins,Could not transfer artifact xxx from/to xxx等此类问题的方法

ccjjjjdff的博客 1万+

Android实现录屏直播(一)ScreenRecorder的简单分析

应项目需求瞄准了Bilibili的录屏直播功能,基本就仿着做一个吧。研究后发现Bilibili是使用的MediaProjection 与 VirtualDisplay结合实现的,需要 Android 5.0 Lollipop API 21以上的系统才能使用。其实官方提供的android-ScreenCapture这个Sample中已经有了MediaRecorder的实现与使用方式,还有使用Media

Coding for Android 6万+

适合小白的超详细yolov8环境配置+实例运行教程,从零开始教你如何使用yolov8训练自己的数据集(Windows+conda+pycharm)

yolov8源码下载地址:GitHub - ultralytics/ultralytics: NEW - YOLOv8 🚀 in PyTorch > ONNX > OpenVINO > CoreML > TFLiteyolov8使用文档: Home - Ultralytics YOLOv8 Docs教学视频参考: 包会!YOLOv8训练自己的数据集_哔哩哔哩_bilibili先用conda prompt创建一个虚拟环境,我的叫yolov8, python版本用3.10 源码地址:GitHub - ul

CV在读 25万+

Video Tracking--初识

CREST: Convolutional Residual Learning for Visual Tracking Research Background Given a bounding box annotation in the first frame, developing a tracker that is robust to a variety of challenges is an ...

乐兮山南水北的博客 1302

【音视频】PJSIP库——示例简介、C++类说明

aectest音频回声消除测试工具,用于演示音频处理模块中的回声消除(AEC)功能,通常用于 VoIP 场景中优化语音质量。auddemo音频播放 / 录制演示,展示如何使用 PJProject 的音频接口进行基本的音频数据采集、播放和处理,例如波形显示或格式转换。stereotest立体声处理测试,可能用于演示多声道音频的处理方式,如混音、声道分离等。tonegen音频信号生成工具,用于生成测试用的音频信号(如正弦波、音调等),常用于音频设备测试或调试。recfile。

郭老二 441

ZYNQ工业级串口方案:AXI UART 16550扩展RS-485实战(自动方向控制+Linux驱动)

可以轻松扩展出多路工业级串口。但常规方案需要手动控制收发方向(DE/RE引脚),存在实时性差、CPU占用高等痛点。本文从硬件逻辑设计到Linux驱动开发,完整实现了ZYNQ平台的RS-485工业通信方案。,解决了传统方案实时性差的痛点。所有代码均经过实际项目验证,可直接用于生产环境。:尝试将此设计扩展为多协议兼容接口(支持RS-422/RS-232切换)!等特性,依然是现场总线通信的首选。,通过硬件逻辑+Linux驱动协同设计,实现零延迟切换。在工业自动化、能源电力等场景中,RS-485凭借。

QQ_778132974的博客 842

FFMPEG学习(一)---【命令行】采集视频和音频

FFMPEG常识 参数 参考:ffmpeg-比特率,帧率和文件大小 下载资源 下载ffmpeg安装包 加入环境变量: e:\ProgramFiles_D\ffmpeg\bin\ 输入设备 dshow 的使用——视音频录制 打印 DirectShow 支持的设备列表(true 可用1替换) ffmpeg -list_devices true -f d...

xiake001的专栏 8422

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

如何在直播中解决黑屏、花屏、闪屏问题 | 直播疑难杂症排查

用户的眼睛没毛病!10 分钟搞明白如何在直播中解决黑屏、花屏、闪屏问题

七牛云——开发者的创新加速引擎 3万+

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

如何解决直播中的播放杂音、噪音、回声问题 | 直播疑难杂症排查

《直播疑难杂症排查》系列已经更新了 7 篇,我们为用户分析了视频直播过程中出现的问题,并一一作出排查。此次我们侧重于直播中的音频,以便给用户带来更好的听觉享受。

七牛云——开发者的创新加速引擎 6万+

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

应用场景:现场直播节目制作NDI技术中PoE网卡的广泛应用

对于绝大多数用户来说,所了解的PoE图像采集卡更多的是与工业相机搭配,主要应用在各种机器视觉检测系统中,比如说PCB贴片(SMT)检测、成品检测,以及机器视觉工控机上各种原材料检测等。实际上PoE图像采集卡不但在以机器视觉为代表的工业自动化智能设备上应用正在迅速普及,同时在逐步兴起的现场直播制作环境中市场应用前景更多广阔。 PoE图像采集卡在现场直播环境中应用广阔,主要得益于NDI接口技术的落地应用。在传统的直播视频制作中,人们更多的是依附于HDMI和SDI的输入或输出,这种接口的设备需要有线的方式接入。

LRLINK的博客 414

Android 关于直播,推流,拉流

1.直播 集成的腾讯的互动直播的SDK做到(注册开发者,填写信息,创建项目,下载SDK,导入项目,配置build文件,添加user-pressen权限和Activity权限,在application文件中初始化就完成了集成的步骤。) 用ijkplayer的实现播放,ijkplayer功能很强大,它是bilibili基于ffmpeg做的一个轻量级视频播放框架,能播放本地视频,也能播放网络流媒体,...

长歌的博客 8377

低成本搭建AI实景直播间操作全流程

用小鹿播搭建 AI 实景直播间,核心不是做复杂的虚拟主播,而是用更简单的方式完成商品讲解直播。对于新手来说,建议先从低成本、低复杂度的方式开始。先用一个商品、一段话术、一种声音跑通流程,再逐步增加更多商品、更多话术和更多直播间互动设计。这样既能降低搭建门槛,也方便后续不断优化直播内容。

xiaoluxiaoluyes的博客 392

[转载]如何解决直播中的播放杂音、噪音、回声问题 | 直播疑难杂症排查

继《直播技术详解》系列文章之后,我们推出了这个新的系列《直播疑难杂症排查》,把解决直播问题的经验逐步分享出来,同时也会穿插一些音视频开发的基础知识和优化经验,希望能够帮助到直播领域的开发者们。 本系列会涵盖的内容包括但不限于如下一些主题:  - 播放失败  - 直播卡顿  - 首开慢  - 延时高  - 音画不同步  - 马赛克严重  - 播放黑屏、花屏、绿屏  - 播放杂音、噪音、回声  - ...

woaitingting1985的博客 1万+

可能是全网最全的移动直播 trouble shooting 手册(5)——音画不同步

在七牛做直播 SDK 一年多了,帮助客户解决过各种形形色色的问题,如直播卡顿、马赛克、花屏、黑屏、杂音、音画不同步等等等等,这其中,有一些是网络原因,有一些是客户的使用姿势问题,有一些是参数配置错误,当然,也有一些是 SDK 本身的问题。总结下来,如果开发者能够对直播领域的一些基础知识有更深入的了解,掌握一些基本的排障手段,很多问题是能够很快自行解决的,甚至也能够更好地防患于未然。因此,有了这个系列

七牛云——开发者的创新加速引擎 806

用户的眼睛没毛病!10 分钟搞明白如何在直播中解决黑屏、花屏、闪屏问题

「黑屏、花屏、闪屏」经常出现在直播应用中,除了网络问题,在直播过程中的黑屏、花屏、闪屏却有很多技术原因,这篇文章将全方位为你解决直播中的「黑屏、花屏、闪屏」问题。 继《直播技术详解》系列文章之后,我们推出了这个新的系列《直播疑难杂症排查》,把解决直播问题的经验逐步分享出来,同时也会穿插一些音视频开发的基础知识和优化经验,希望能够帮助到直播领域的开发者们。本系列会涵盖的内容包括但不限于如下一些...

七牛云——开发者的创新加速引擎 4046

《直播疑难杂症排查》系列八:播放杂音、噪音、回声

《直播疑难杂症排查》系列已经更新了 7 篇,我们为用户分析了视频直播过程中出现的问题,并一一作出排查。此次我们侧重于直播中的音频,以便给用户带来更好的听觉享受。 继《直播技术详解》系列文章之后,我们推出了这个新的系列《直播疑难杂症排查》,把解决直播问题的经验逐步分享出来,同时也会穿插一些音视频开发的基础知识和优化经验,希望能够帮助到直播领域的开发者们。本系列会涵盖的内容包括但不限于如下一些主...

七牛云——开发者的创新加速引擎 1079

《直播疑难杂症排查》之五: 音画不同步

七牛直播云在 2016 年 6 月发布之后,帮助广大客户如熊猫TV、龙珠直播等解决过形形色色的问题。如直播卡顿、马赛克、花屏、黑屏、杂音、音画不同步等等等等,这其中,有一些是网络原因,有一些是开发者的使用姿势问题,有一些是参数配置错误,当然,也有一些是 SDK 本身的问题。总结下来,如果开发者能够对直播领域的一些基础知识有更深入的了解,掌握一些基本的排障手段,很多问题是能够很快自行解决的,甚至也能...

weixin_34150224的博客 313

Infoseek 字节探索舆情监测技术实战:从多模态采集到 AI 智能研判的落地实现

在 AIGC 技术普及、舆论传播愈发复杂的当下,企业的舆情监测已经从 “工具层面” 上升到 “战略层面”,而技术能力,是决定舆情监测效果的核心因素。Infoseek 字节探索凭借自身的技术积淀,从采集、解析、预警三大核心环节破解了传统舆情监测系统的技术瓶颈,打造出了适配当下舆论环境的专业舆情监测体系,不仅让企业实现了 “全域无死角、多模态全识别” 的舆情监测,更能通过精准研判和实时预警,让企业从 “被动救火” 的舆情应对模式,转向 “主动防控” 的模式。

weixin_64776994的博客 841
上一篇: 【直播技术探讨第一章】
下一篇: 加密技术(android开发经常用到的加密技术)
lemdsdf
博客等级 码龄13年 6粉丝 42原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值