Giter VIP home page Giter VIP logo

imalimin / hardwarevideocodec Goto Github PK

View Code? Open in Web Editor NEW
445.0 15.0 119.0 94.56 MB

HardwareVideoCodec is an efficient video recording library for Android. Supports software and hardware encode. With it, you can record a video at any resolution, no need to care about camera resolution. Everything is so easy.

License: GNU General Public License v2.0

Java 16.19% Shell 0.11% CMake 0.06% GLSL 2.16% Makefile 5.36% C++ 16.14% C 59.30% MATLAB 0.08% Roff 0.27% HTML 0.33%
android filter recorder rtmp-stream hwvc

hardwarevideocodec's People

Contributors

aliminabc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hardwarevideocodec's Issues

预览方向问题

我们有个需求是可以调整预览方向0,90,180,270. 请问大佬这个如何实现呢?

保存为本地mp4文件的情况下,大约1秒以后画面卡住。

`final TextureView textureView=new TextureView(this);
setContentView(textureView);
videoRecorder=new VideoRecorderImpl(this);
videoRecorder.reset();
// videoRecorder.setOutputUri("rtmp://192.168.16.125:1935/live/livestream");
videoRecorder.setOutputUri(Environment.getExternalStorageDirectory().getAbsolutePath()+"/test.mp4");
videoRecorder.setOutputSize(720,1280);
videoRecorder.setFps(20);
// videoRecorder.setFilter(getDefaultFilter());
videoRecorder.setPreviewDisplay(textureView);
// videoRecorder.enableHardware(true);
videoRecorder.setOnStateListener(new VideoRecorder.OnStateListener() {
@OverRide
public void onStop() {

       }

       @Override
       public void onError(int i, @NotNull String s) {

       }

       @Override
       public void onPrepared(@NotNull Encoder encoder) {
           videoRecorder.start();

       }

       @Override
       public void onRecord(@NotNull Encoder encoder, long l) {

       }
   });
    videoRecorder.prepare();`

打印日志内容为:

E/MuxerImpl: Add audio track
I/MuxerImpl: addAudioTrack 2
E/MuxerImpl: Muxer audio start
V/VideoEncoderImpl: INFO_OUTPUT_FORMAT_CHANGED
E/MuxerImpl: Muxer video start
I/MPEG4Writer: limits: 4294967295/0 bytes/us, bit rate: -1 bps and the estimated moov size 3195 bytes
E/MuxerImpl: Muxer start
I/MPEG4Writer: setStartTimestampUs: 113378
I/MPEG4Writer: Earliest track starting time: 113378
I/MPEG4Writer: setStartTimestampUs: 0
I/MPEG4Writer: Earliest track starting time: 0
E/MPEG4Writer: timestampUs 87139 < lastTimestampUs 120661 for Video track

本地生成的mp4文件一直是3.23k的固定大小。请问是否是我使用方法不对?

编译不了怎么回事?

ERROR: The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.10 and higher.
The following dependencies do not satisfy the required version:
root project 'HardwareVideoCodec' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.30
Affected Modules: codec

WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getJavaCompile(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
Affected Modules: codec

Video Save

I am not able to save the video can you please tell me how and where I can save the video recorded with effect?

部分机型写入muxer 写入video 的时候,presentationTimeUs混乱

2019-11-29 15:48:43.747 9147-9355/com.lmy.sample E/MuxerImpl: writeAudioSample(13, 521541): 259
2019-11-29 15:48:43.768 9147-9355/com.lmy.sample E/MuxerImpl: writeAudioSample(13, 544217): 255
2019-11-29 15:48:43.786 9147-9355/com.lmy.sample E/MuxerImpl: writeAudioSample(14, 566893): 263
2019-11-29 15:48:43.811 9147-9355/com.lmy.sample E/MuxerImpl: writeAudioSample(14, 589569): 270
2019-11-29 15:48:43.828 9147-9355/com.lmy.sample E/MuxerImpl: writeAudioSample(15, 612244): 263
2019-11-29 15:48:43.852 9147-9355/com.lmy.sample E/MuxerImpl: writeAudioSample(16, 634920): 290
2019-11-29 15:48:43.886 9147-9355/com.lmy.sample E/MuxerImpl: writeAudioSample(17, 657596): 247
2019-11-29 15:48:43.907 9147-9355/com.lmy.sample E/MuxerImpl: writeAudioSample(17, 680272): 260
2019-11-29 15:48:43.940 9147-9355/com.lmy.sample E/MuxerImpl: writeAudioSample(18, 702947): 264
2019-11-29 15:48:43.958 9147-9355/com.lmy.sample E/MuxerImpl: writeAudioSample(19, 725623): 249
2019-11-29 15:48:43.979 9147-9355/com.lmy.sample E/MuxerImpl: writeAudioSample(19, 748299): 252
2019-11-29 15:48:43.982 9147-9356/com.lmy.sample E/MuxerImpl: writeVideoSample(20, 598474): 8944
2019-11-29 15:48:43.982 9147-9356/com.lmy.sample E/MediaAdapter: pushBuffer called before start
2019-11-29 15:48:43.997 9147-9355/com.lmy.sample E/MuxerImpl: writeAudioSample(20, 770975): 250
2019-11-29 15:48:43.998 9147-9356/com.lmy.sample V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@148ed9a
2019-11-29 15:48:43.998 9147-9356/com.lmy.sample V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@38e46cb
2019-11-29 15:48:44.003 9147-9356/com.lmy.sample V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@2433dc1
2019-11-29 15:48:44.003 9147-9356/com.lmy.sample V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@7b84966
2019-11-29 15:48:44.018 9147-9355/com.lmy.sample E/MuxerImpl: writeAudioSample(21, 793650): 248
2019-11-29 15:48:44.019 9147-9356/com.lmy.sample W/System.err: java.lang.IllegalStateException: writeSampleData returned an error
2019-11-29 15:48:44.019 9147-9356/com.lmy.sample W/System.err:     at android.media.MediaMuxer.nativeWriteSampleData(Native Method)
2019-11-29 15:48:44.019 9147-9356/com.lmy.sample W/System.err:     at android.media.MediaMuxer.writeSampleData(MediaMuxer.java:473)
2019-11-29 15:48:44.020 9147-9356/com.lmy.sample W/System.err:     at com.lmy.codec.muxer.impl.MuxerImpl.writeSample(MuxerImpl.kt:150)
2019-11-29 15:48:44.020 9147-9356/com.lmy.sample W/System.err:     at com.lmy.codec.muxer.impl.MuxerImpl.access$writeSample(MuxerImpl.kt:27)
2019-11-29 15:48:44.020 9147-9356/com.lmy.sample W/System.err:     at com.lmy.codec.muxer.impl.MuxerImpl$writeVideoSample$2.run(MuxerImpl.kt:132)
2019-11-29 15:48:44.020 9147-9356/com.lmy.sample W/System.err:     at com.lmy.codec.pipeline.impl.EventPipeline$1.handleMessage(EventPipeline.kt:36)
2019-11-29 15:48:44.020 9147-9356/com.lmy.sample W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:102)
2019-11-29 15:48:44.020 9147-9356/com.lmy.sample W/System.err:     at android.os.Looper.loop(Looper.java:165)
2019-11-29 15:48:44.020 9147-9356/com.lmy.sample W/System.err:     at android.os.HandlerThread.run(HandlerThread.java:61)

解决方案:使用自己统计的presentationTimeUs

mBufferInfo.presentationTimeUs = pTimer.presentationTimeUs/1000

Ratio switch crash

Switch to 4:3 first, then switch the camera, and finally switch back to the default, it will crash

编译是可以,就是直接run 的时候报错了,麻烦看一下

@LMY小明 日志有点多,发不了评论,麻烦看一下,我对NDK环境不是很熟练,LLDB CMake NDK 20版本,都是AS上直接装的。
Build command failed.
Error while executing process F:\sdk\ndk-bundle\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=E:\HardwareVideoCodec-master\rtmp\src\main\jni\Android.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=1 APP_PLATFORM=android-19 NDK_OUT=E:/HardwareVideoCodec-master/rtmp/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=E:\HardwareVideoCodec-master\rtmp\build\intermediates\ndkBuild\debug\lib E:/HardwareVideoCodec-master/rtmp/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/librtmp.so}
[armeabi-v7a] Compile++ thumb: rtmp <= HandlerThread.cpp

E:/HardwareVideoCodec-master/rtmp/src/main/jni/rtmp/Android.mk:14: librtmp/amf.c librtmp/hashswf.c librtmp/log.c librtmp/parseurl.c librtmp/rtmp.c HandlerThread.cpp Java_com_lmy_rtmp_RtmpClient.cpp Lock.cpp Message.cpp RtmpClient.cpp SpecificData.cpp
In file included from E:/HardwareVideoCodec-master/rtmp/src/main/jni/rtmp/HandlerThread.cpp:7:
In file included from E:/HardwareVideoCodec-master/rtmp/src/main/jni/rtmp/HandlerThread.h:7:
In file included from E:/HardwareVideoCodec-master/rtmp/src/main/jni/rtmp/BlockQueue.h:10:
In file included from F:/sdk/ndk-bundle/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1\list:183:
In file included from F:/sdk/ndk-bundle/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1\memory:658:
In file included from F:/sdk/ndk-bundle/build//../sources/cxx-stl/system/include\utility:36:
F:/sdk/ndk-bundle/build//../sources/cxx-stl/system/include\stl_pair.h:86:30: error: no template named 'pair'
inline bool operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
^
F:/sdk/ndk-bundle/build//../sources/cxx-stl/system/include\stl_pair.h:86:57: error: no template named 'pair'
inline bool operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
^
F:/sdk/ndk-bundle/build//../sources/cxx-stl/system/include\stl_pair.h:92:29: error: no template named 'pair'
inline bool operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
^
F:/sdk/ndk-bundle/build//../sources/cxx-stl/system/include\stl_pair.h:92:56: error: no template named 'pair'
inline bool operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
^
F:/sdk/ndk-bundle/build//../sources/cxx-stl/system/include\stl_pair.h:99:30: error: no template named 'pair'
inline bool operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
^
F:/sdk/ndk-bundle/build//../sources/cxx-stl/system/include\stl_pair.h:99:57: error: no template named 'pair'
inline bool operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
^
F:/sdk/ndk-bundle/build//../sources/cxx-stl/system/include\stl_pair.h:104:29: error: no template named 'pair'
inline bool operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
^
F:/sdk/ndk-bundle/build//../sources/cxx-stl/system/include\stl_pair.h:104:56: error: no template named 'pair'
inline bool operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
^
F:/sdk/ndk-bundle/build//../sources/cxx-stl/system/include\stl_pair.h:109:30: error: no template named 'pair'
inline bool operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
^
F:/sdk/ndk-bundle/build//../sources/cxx-stl/system/include\stl_pair.h:109:57: error: no template named 'pair'
inline bool operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
^
F:/sdk/ndk-bundle/build//../sources/cxx-stl/system/include\stl_pair.h:114:30: error: no template named 'pair'
inline bool operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
^
F:/sdk/ndk-bundle/build//../sources/cxx-stl/system/include\stl_pair.h:114:57: error: no template named 'pair'
inline bool operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
^
F:/sdk/ndk-bundle/build//../sources/cxx-stl/system/include\stl_pair.h:119:8: error: no template named 'pair'
inline pair<_T1, _T2> make_pair(_T1 __x, _T2 __y)
^
F:/sdk/ndk-bundle/build//../sources/cxx-stl/system/include\stl_pair.h:121:10: error: reference to 'pair' is ambiguous
return pair<_T1, _T2>(__x, __y);
^
F:/sdk/ndk-bundle/build//../sources/cxx-stl/system/include\stl_pair.h:72:8: note: candidate found by name lookup is 'std::pair'
struct pair {
^
F:/sdk/ndk-bundle/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1\type_traits:415:61: note: candidate found by name lookup is 'std::__ndk1::pair'
template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS pair;
^
In file included from E:/HardwareVideoCodec-master/rtmp/src/main/jni/rtmp/HandlerThread.cpp:7:
In file included from E:/HardwareVideoCodec-master/rtmp/src/main/jni/rtmp/HandlerThread.h:7:
In file included from E:/HardwareVideoCodec-master/rtmp/src/main/jni/rtmp/BlockQueue.h:10:
In file included from F:/sdk/ndk-bundle/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1\list:183:
In file included from F:/sdk/ndk-bundle/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1\memory:658:
In file included from F:/sdk/ndk-bundle/build//../sources/cxx-stl/system/include\utility:36:
F:/sdk/ndk-bundle/build//../sources/cxx-stl/system/include\stl_pair.h:121:15: error: '_T1' does not refer to a value
return pair<_T1, _T2>(__x, __y);
^
F:/sdk/ndk-bundle/build//../sources/cxx-stl/system/include\stl_pair.h:118:17: note: declared here
template <class _T1, class _T2>
^
In file included from E:/HardwareVideoCodec-master/rtmp/src/main/jni/rtmp/HandlerThread.cpp:7:
In file included from E:/HardwareVideoCodec-master/rtmp/src/main/jni/rtmp/HandlerThread.h:7:
In file included from E:/HardwareVideoCodec-master/rtmp/src/main/jni/rtmp/BlockQueue.h:10:
In file included from F:/sdk/ndk-bundle/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1\list:183:
In file included from F:/sdk/ndk-bundle/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1\memory:660:
In file included from F:/sdk/ndk-bundle/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1\iterator:417:
In file included from F:/sdk/ndk-bundle/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1__functional_base:17:
F:/sdk/ndk-bundle/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1\exception:181:5: error: no member named 'abort' in namespace 'std::__ndk1'; did you mean simply 'abort'?
_VSTD::abort();
^~~~~~~
F:/sdk/ndk-bundle/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1__config:804:15: note: expanded from macro '_VSTD'
#define _VSTD std::_LIBCPP_ABI_NAMESPACE
^
F:/sdk/ndk-bundle/build//../sources/cxx-stl/system/include\cstdlib:43:9: note: 'abort' declared here
using ::abort;
^
In file included from E:/HardwareVideoCodec-master/rtmp/src/main/jni/rtmp/HandlerThread.cpp:7:
In file included from E:/HardwareVideoCodec-master/rtmp/src/main/jni/rtmp/HandlerThread.h:7:
In file included from E:/HardwareVideoCodec-master/rtmp/src/main/jni/rtmp/BlockQueue.h:10:
In file included from F:/sdk/ndk-bundle/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1\list:183:
In file included from F:/sdk/ndk-bundle/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1\memory:660:
In file included from F:/sdk/ndk-bundle/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1\iterator:417:
F:/sdk/ndk-bundle/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1__functional_base:81:16: error: no template named 'unary_function'; did you mean 'binary_function'?
static unary_function<_Ap, _Rp>
^
F:/sdk/ndk-bundle/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1__functional_base:28:29: note: 'binary_function' declared here
struct _LIBCPP_TEMPLATE_VIS binary_function
^
F:/sdk/ndk-bundle/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1__functional_base:81:16: error: too few template arguments for class template 'binary_function'
static unary_function<_Ap, _Rp>
^
F:/sdk/ndk-bundle/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1__functional_base:28:29: note: template is declared here
struct _LIBCPP_TEMPLATE_VIS binary_function
^
F:/sdk/ndk-bundle/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1__functional_base:82:31: error: no template named 'unary_function'; did you mean 'binary_function'?
__test(const volatile unary_function<_Ap, _Rp>*);
^
F:/sdk/ndk-bundle/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1__functional_base:28:29: note: 'binary_function' declared here
struct _LIBCPP_TEMPLATE_VIS binary_function
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [E:/HardwareVideoCodec-master/rtmp/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/rtmp/HandlerThread.o] Error 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.