Tag Archives: Audio and video

[Solved] webrtc Compile Error: ERROR: The installation of the Chrome OS default fonts failed.

Installing Chrome OS fonts.
Installing Chrome OS fonts to /usr/local/share/fonts/chromeos.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:02:09 --:--:--     0curl: (7) Failed to connect to commondatastorage.googleapis.com port 443: 连接超时
Traceback (most recent call last):
  File "./build/linux/install-chromeos-fonts.py", line 120, in <module>
    sys.exit(main(sys.argv[1:]))
  File "./build/linux/install-chromeos-fonts.py", line 67, in main
    subprocess.check_call(['curl', '-L', url, '-o', tarball])
  File "/usr/lib/python2.7/subprocess.py", line 541, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['curl', '-L', 'https://commondatastorage.googleapis.com/chromeos-localmirror/distfiles/notofonts-20161129.tar.bz2', '-o', '/usr/local/share/fonts/chromeos/notofonts-20161129.tar.bz2']' returned non-zero exit status 7
ERROR: The installation of the Chrome OS default fonts failed.
This is expected if your repo is installed on a remote file system.
It is recommended to install your repo on a local file system.
You can skip the installation of the Chrome OS default founts with
the command line option: --no-chromeos-fonts.

Compile webrtc configuration report error: ERROR: The installation of the Chrome OS default fonts failed.
This means that the installation of the Chrome fonts failed, so far found that this has any effect on the use of webrtc later, you can add -no-chromeos-fonts after the command as prompted, meaning not to install the fonts.

./build/install-build-deps.sh --no-chromeos-fonts

Opencv c++ Read Video Error: capture.isOpened() Return false

#include<iostream>
#include<opencv2/opencv.hpp>
using namespace cv;
using namespace std;
int main()
{
    VideoCapture capture;
    Mat frame;
    const string source = "/home/gear/big_disk_c/wangjd/shipintest/789.mp4";
    // frame= capture.open("789.mp4");
    frame= capture.open(source);
    if(!capture.isOpened())
    {
        printf("can not open ...\n");
        return -1;
    }
    printf("1213131\n");
    // namedWindow("output", CV_WINDOW_AUTOSIZE);

    while (capture.read(frame))
    {
        imshow("output", frame);
        waitKey(10);
    }
    capture.release();
    return 0;
}

Reason: Path. I have a permission problem with this server, and it will report an error if I write the full path. And the executable file I generated and the video file are not in the same directory, …/789.mp4 will not be read, only the two put together to read. Later I found out that
The constructor of capture.open() passed in a const string, so I instantiated a const string source first, then I could write the full path, and then passed it in.

const string source = "/home/gear/big_disk_c/wangjd/shipintest/789.mp4";
frame= capture.open(source);

[Solved] unesolved external symbol _imp_fprintf referenced in funciton _showerror

There are two problems when debugging projects written in ffmpeg with vs2015:

Question 1:

“LNK2019 unresolved external symbol __imp____iob_func reference in function _ShowError”

Solution: add this sentence to the source code: extern “C” {file _iob_func [3] = {* stdin, * stdout, * stderr};}

Question 2:

“unesolved external symbol _imp_fprintf referenced in funciton _showerror”

Solution: right-click the item — properties — configuration — linker — input — additional dependencies to add the library legacy_stdio_definitions.lib

[Solved] Ubuntu uses gym to save the video error: “unknown encoder ‘libx264′”

In the experiment of using gym environment to train the agent and save the video locally, an error was encountered when using monitor to save the video:

Unknown encoder 'libx264'

Considering that the video saved in gym is saved in ffmpeg, I reinstalled it, but still reported an error. Then yes

check the original codes ofwrappers.Monitor

Here we judge the selection method, so we can choose other encoders to save our video. We just need to install CONDA, uninstall ffmpeg, and then use other options


import pkgutil
import distutils.spawn
import imageio_ffmpeg

print(distutils.spawn.find_executable("avconv"))
print(distutils.spawn.find_executable("ffmpeg"))
print(pkgutil.find_loader("imageio_ffmpeg"))
print(imageio_ffmpeg.get_ffmpeg_exe())

In my case, after I uninstall ffmpeg in CONDA, what gym calls becomes ffmpeg installed in Ubuntu, and then it can run.

Error message for HLS Video Fusion for the second time when using mars3d

Using Mars technology’s mars3d API and several video fusion written according to the sample code, clicking different web page tags will fly to different locations and turn on Video Fusion there.

    var video3D = new mars3d.graphic.Video3D({
        // type: mars3d.graphic.Video3D.Type.Image,
        // url: videoInfo.pic_url,
        type: mars3d.graphic.Video3D.Type.Video,
        dom: $("#trailer"),
        position: videoInfo.position,
        cameraPosition: videoInfo.cameraPosition,
        style: videoInfo.style,
        showFrustum: videoInfo.showFrustum,
    });
     gLayer.addGraphic(video3D);
    map.setCameraView(videoInfo.view);

However, glayer. Addgraphic (video3d) often appears; report errors. The first call is sure to succeed, and then the second call may fail. After a failure, all methods fail, which will also prevent the call of other methods, such as flight. Error message: unable to:_ 0xc3d9ee add addeventlistener.

After debugging, I found that this DOM element was obtained for the first time

the second time, it was just (forgot the screenshot):

dom:{
	selector:#trailer
}

Therefore, the specific reason for the problem is not clear, but it must be related to jQuery. The second time, I don’t know why I didn’t get the DOM elements completely and then pass them in
No, jQuery is fine anyway:

    var video3D = new mars3d.graphic.Video3D({
        // type: mars3d.graphic.Video3D.Type.Image,
        // url: videoInfo.pic_url,
        type: mars3d.graphic.Video3D.Type.Video,
        dom: document.getElementById("trailer"),
        position: videoInfo.position,
        cameraPosition: videoInfo.cameraPosition,
        style: videoInfo.style,
        showFrustum: videoInfo.showFrustum,
    });
     gLayer.addGraphic(video3D);
    map.setCameraView(videoInfo.view);

Easywasmlayer reports an error uncaught (in promise) domexception when playing a video

As a video streaming media player developed by tsingsee Qingxi video, easyplayer series projects support integration and secondary development. You can also download and try to obtain real test results. Among them, the new h.265 player branch easywasm player is the mainstream player for web page playback.

When we use easywasmlayer to play video in the project, the console will always report the error uncaught (in promise) domexception. In this article, we will analyze what caused the error.

In fact, this problem is caused by the browser’s blocking automatic playback. The user has set automatic playback, so this situation will occur when the first screen is loaded. To deal with this situation, you can disable the audio.

Changing openaudio to true disables audio or prevents the player from loading as soon as the first screen comes up, but this is obviously not the problem in this project. Instead, open the playback page, select the device to start playing, and then start loading the player. After modification, it can play normally:

Easyplayer, a player independently developed by tsingsee Qingxi video, is currently being effectively used on multiple platforms and supports integration. It also includes players such as easyplayer RTSP, easyplayer RTMP, easyplayerpro and easyplayer.js, which has higher availability and lower latency. Welcome to know.

[Solved] Mac ffmpeg Install Error: filenotfounderror: [errno 2] no such file or directory: ‘ffmpeg’: ‘ffmpeg’

Audio processing error: filenotfounderror: [errno 2] no such file or directory: ‘ffmpeg’: ‘ffmpeg’

An error occurs when the following code is executed

import audiosegment

print("Reading in the wave file...")
seg = audiosegment.from_file("voice_data/out_11.wav")

print("Information:")
print("Channels:", seg.channels)
print("Bits per sample:", seg.sample_width * 8)
print("Sampling frequency:", seg.frame_rate)
print("Length:", seg.duration_seconds, "seconds")

print("Detecting voice...")
seg = seg.resample(sample_rate_Hz=32000, sample_width=2, channels=1)
results = seg.detect_voice()
voiced = [tup[1] for tup in results if tup[0] == 'v']
unvoiced = [tup[1] for tup in results if tup[0] == 'u']

print("Reducing voiced segments to a single wav file 'voiced.wav'")
voiced_segment = voiced[0].reduce(voiced[1:])
voiced_segment.export("voiced.wav", format="WAV")

print("Reducing unvoiced segments to a single wav file 'unvoiced.wav'")
unvoiced_segment = unvoiced[0].reduce(unvoiced[1:])
unvoiced_segment.export("unvoiced.wav", format="WAV")

Error content

Solution:
use the command: brew install ffmpeg installation. If the following problems occur, let’s continue brew install ffmpeg installation without turning off the error message.

==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:c16266957db69346464e39967d41d5198f3550423d6
############################                                              40.0%
curl: (92) HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)
Error: ffmpeg: Failed to download resource "rav1e"
Download failed: https://ghcr.io/v2/homebrew/core/rav1e/blobs/sha256:c16266957db69346464e39967d41d5198f3550423d6aabfb62919975cf52ea19

After that, new error messages are found as follows:

Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/2to3
Target /usr/local/bin/2to3
already exists. You may want to remove it:
  rm '/usr/local/bin/2to3'

To force the link and overwrite all conflicting files:
  brew link --overwrite [email protected]

To list all files that would be deleted:
  brew link --overwrite --dry-run [email protected]

Follow the prompts and execute the following statements:

 rm '/usr/local/bin/2to3'
 brew link --overwrite [email protected]
 brew link --overwrite --dry-run [email protected]

srs Error: demux SPS/PPS : avc decode sequence header

SRS reports errors as follows:

[31m[2021-10-23 17:43:55.682][Error][31374][5ns94367][4] serve error
code=3001 : service cycle : rtmp: stream service : rtmp: receive
thread : handle publish message : rtmp: consume message : rtmp:
consume video : meta update video : demux SPS/PPS : avc decode
sequence header

This error means that SRS cannot obtain SPS and PPS information when receiving the code stream.
then select to disconnect from the streaming end. At this time, if the streaming end continues to push the stream, av_interleaved_write_frame (…) will report – 32, and the print log is:

broken pipe

The following encoder parameters need to be set:

if(octx->oformat->flags & AVFMT_GLOBALHEADER)
{
	printf("set video GLOBAL_HEADER\n");
	enc_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
}
octx Represents the output context

Explain PPS and SPS, two-byte areas in the code stream, which are very important for decoding. If they are not found, decoding will
fail because they store the parameters set by the encoder, such as the height and width of the video, the sampling rate of the audio, the number of channels, etc
explain the meaning of the above code segment. It will detect the encapsulation format of the output context to determine whether AV is set_CODEC_FLAG_GLOBAL_HEADER.
The function of the AV_CODEC_FLAG_GLOBAL_header flag is to add PPS and SPS in front of each keyframe from the original encoding to the byte area of extradate. Then, when decoding, you have to read PPS and SPS from extradate and put them in front of each keyframe.

[Solved] Brew Install ffmpeg Error: tar: Error opening archive: Failed to open

Error Message:

tar: Error opening archive: Failed to open ‘/Users/edy/Library/Caches/Homebrew/downloads/4a1df878f9549839794e9466cff829ff77e4e90d33b6ee3119051ec2590f8780–unbound-1.13.1.big_sur.bottle.tar.gz’

0f5d4b5b16c58d5ad770a56d–harfbuzz-2.8.2.big_sur.bottle.tar.gz –directory /private/tmp/d20210830-97010-oiocrb` exited with 1. Here’s the output:
tar: Error opening archive: Failed to open ‘/Users/edy/Library/Caches/Homebrew/downloads/ada1b84732f9bc165c3198c7180c846cc5d8e3e40f5d4b5b16c58d5ad770a56d–harfbuzz-2.8.2.big_sur.bottle.tar.gz’

tar: Error opening archive: Failed to open ‘/Users/edy/Library/Caches/Homebrew/downloads/49ceb5675427d6353db6ece526f416910cb5be2e7309f670a29ea845d19a0410–sdl2-2.0.14_1.big_sur.bottle.tar.gz’

Solution:

brew install bottle
brew install harfbuzz
brew install sdl2

Ffmpeg (libx264) compiling for IOS

Refer to the article: https://blog.csdn.net/cairo123/article/details/78808763
MacOS: 10.13.5 f77 (17)
FFmpeg: 2.7.7
1. The x264 compilation

The source code download: https://github.com/mstorsjo/fdk-aac
Compile script: https://github.com/kewlbear/x264-ios
Brew install NASM
$ nasm -v
NasM version 2.13.03 Compiled on Feb 8 2018

Compile scripts in X264 source code equivalent directory. Execute the compile script.

To fit the project requirements, modify the compiled script as follows:

CONFIGURE_FLAGS=”–enable-static –enable-pic”

ARCHS=”arm64 armv7 armv7s”

I’m just going to leave the ARM64, the ARMv7, the ARMv7s and I’m going to get rid of the i386 x86_64 of the simulator and the idea here is to reduce the size of the library.
Flags are as simple as possible to avoid the hassle of having fewer compilations, so just keep –enable-static –enable-pic
The modified compiled script: https://download.csdn.net/download/wangyubin2010n/10486377

2. Compile FFmpeg
To download the script: https://github.com/kewlbear/FFmpeg-iOS-build-script
Modify the script:
A. Remove i386, x86_64 architecture support,
B. Modify FFMPEG version to 2.7.7;
C. Streamline FFMPEG to remove unnecessary compilation such as binary compilation and DOCS, save time, and simplify the size of the library.
Because the script downloads the FFMPEG source code automatically, the script is executed directly after the modification is completed.     
The modified script: https://download.csdn.net/download/wangyubin2010n/10486405

3. Complete

X264 -iOS: Static library containing x264
FFMPEG-IOS: Holds FFMPEG libraries.
Library download address: https://download.csdn.net/download/wangyubin2010n/10486418

Configuring OpenGL environment on Mac OS

OpenGL environment is configured under Mac OS system
1. Prepare resources
CLToolsglewlibGLTools.
a
file can be downloaded in baidu network backup, link: https://pan.baidu.com/s/13gkpLWjbKSBNFnA-IGo23A password: g3b5
2. Create a project

3. Import the system Framework
Import OpenGL. Framework and Glut. Framework.

4. Add prepared resources
Drag the include file down into the project;
Drag the libgltools.a file into the Framework group under your project;
Add glew.h and gltools.h Paths to Header Search Paths.

5. Delete the unwanted files and create Main.cpp
Delete AppDelegate.swift, ViewController.swift, and if there are any main.m files, delete them as well.
create main.cpp file, do not check “Also create a header file”.

6. Compile
If you encounter a compilation error, import mode from the system library to <; > Change to plain file to introduce "".
test as follows:


#include "GLShaderManager.h"
#include "GLTools.h"
#include <GLUT/GLUT.h>

GLShaderManager shaderManager;

GLBatch triangleBatch;

void changeSize(int w,int h)
{
    glViewport(0, 0, w, h);
}

void RenderScene(void)
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
    
    GLfloat vRed[] = {1.0,1.00,0.0,0.5f};
    
    shaderManager.UseStockShader(GLT_SHADER_IDENTITY,vRed);
    
    triangleBatch.Draw();
    
    glutSwapBuffers();
}

void setupRC()
{
    glClearColor(0.3f, 1.0f, 1.0f, 1);
    
    shaderManager.InitializeStockShaders();
    
    GLfloat vVerts[] = {
        0.0f,0.8f,0.0f,
        0.5f,0.0f,0.0f,
        -0.5f,0.0f,0.0f
    };
    
    triangleBatch.Begin(GL_TRIANGLES, 3);
    triangleBatch.CopyVertexData3f(vVerts);
    triangleBatch.End();
    
}

int main(int argc,char *argv[])
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGBA|GLUT_DEPTH|GLUT_STENCIL);
    glutInitWindowSize(600, 400);
    glutCreateWindow("Triangle");
    glutReshapeFunc(changeSize);
    glutDisplayFunc(RenderScene);
    GLenum status = glewInit();
    if (GLEW_OK != status) {
        
        printf("GLEW Error:%s\n",glewGetErrorString(status));
        return 1;
        
    }
    setupRC();
    glutMainLoop();
 
    return  0;
    
}