Tag Archives: video

The video cannot be played because you have disabled the cookie

Today, I suddenly want to see “happy dramatist”, Google browser Click to play, the result is “because you disable the cookie, the video can’t play…” this situation…

It’s not a big problem either. I just found out where the cookie is after a round of setting. It’s still Baidu… So it’s this

In content settings

OK, I don’t have any problem. I just didn’t know what happened before. I went back to refresh the website and came out… It’s so funny. I don’t know if I can refresh the web page before. But at least we can find something that we hope we can use in the future.

Methods of compiling and installing ffmpeg and libx264 in Linux

Recently in the study of TS stream video preparation FFMPEG video format encoding and conversion
Compiling FFMPEG was smooth but integrating with Libx264 was tedious
It took me a long time to find it online
It is hereby sorted here

Operating system: CentOS 6.4 64-bit kernel 2.6.32
Compiling environment: GCC 4.4.7
FFMPEG version: 2.4
X264 version: X264 0.142.2479 DD79A61
YASM version: 1.3

Prepare documents:
Ffmpeg source
https://www.ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
x264
Git clone git://git.videolan.org/x264.git
yasm
http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz

Compile and install procedure:
1. Install YASM

tar zxvf yasm-1.3.0.tar.gz 
cd yasm-1.3.0
 ./configure 
 make
 make install
 yasm --version

2. Compile and install X264

cd x264 
./configure --enable-shared --enable-pthread --enable-pic
make
make install

3. Compile FFMPEG

cd ffmpeg
./configure --enable-libx264 --enable-gpl --enable-shared  --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib --enable-pic
make
make install

Install well at FFMPEG runtime if prompted

ffmpeg: error while loading shared libraries: libavdevice.so.52: cannot open shared object file: No such file or directory

You will need to modify the file: /etc/ld.so.conf

Add a line at the end of the file:
/usr/local/lib
Then execute the command:
ldconfig

Rerun the ffmpeg – encoders | grep x264 will find successful installation

How do I download or save a YouTube video to my computer?

Getting the YouTube file to your computer
Today, there are several online websites that allow you to enter the URL of the video you wish to save to your computer, and get a link to download the file. Below is a short list of some of the more popular free websites.
http://www.savevid.com/
http://keepvid.com/
Below is a brief description of how to save a video using Savevid. These steps are often very similar with other services used to save YouTube and other flash videos online.

    Go to the YouTube video page and copy the URL of the video you wish to save. For example, below is a URL to a video on YouTube.

    http://www.youtube.com/watch?v=R3ymHMgFAps
     Once this address has been copied, visit SaveVid and paste that URL into the URL text field, then click the Submit or Download button. If done properly, the page should open a new window or display a link to each of the video formats that can be saved. Savevid will give you the option to save the video as FLV, 3GP, MP4 and WebM format. If you’re wanting to watch this video on the computer we recommend saving the video as MP4 format.

Watching a FLV video on your computer
Once the .flv file has been downloaded to your computer, you’ll need a player that supports .flv files. Below are a few suggestions.
VLC media player
http://www.videolan.org/
FLV Player
http://www.martijndevisser.com/blog/flv-player/
Windows Media Player
Microsoft Windows users also have the ability of playing FLV files in Windows Media player with the right codec. Downloading and installing the CCCP codec will install this codec, as well as many other codecs you’ll likely need in the future.
Converting the YouTube video to a different movie format
There are dozens of different software programs and online services available that will allow you to convert FLV files into another format. Below is a short listing of some of the free services and products we recommend.
Media Convert – An excellent online service that can convert FLV files into dozens of other formats.
http://www.media-convert.com/
Vixy – Another great online service that allows you to download and save YouTube video files to another format.
http://vixy.net/

Python implementation of bilibilibili (B station) video download

Python implements Bilibili(B station) video download


Project making address: https://github.com/Henryhaohao/Bilibili_video_download

Bilibili website – https://www.bilibili.com/

Author ?Henryhaohao?

Email

1073064953 @qq.com has ️


?disclaimer
The software is for learning and communication only, please do not use it for any commercial purposes! Thank you all!


?introduce
This project is a video download for Bilibili(B station)
Project description: download bilibili_video_download.py from the video crawler file under the AV number of station B or the video link address


?Runtime environment
Version: Python3


?Install dependency libraries

pip3 install -r requirements.txt

?Run a screenshot

Run download

download complete


?conclusion
Finally, if you think this project is good or helpful to you, give a Star, which is also a kind of encouragement for my study!
Ha ha ha, thank you all! Lead yo ~ * *??

How to solve the error loading media: file could not be played in jwplay

Recent development projects need to use the JWplayer plugin to play videos, but no matter which version or what video is replaced, it always prompts Error loading media: File could not be played incorrectly. At first, I thought it was video coding, but after a lot of work, I still couldn’t solve the problem. Later, I accidentally found that IIS does not support. Mp4 format playback problem.
The IIS default configuration does not add an MP4 file, which results in opening an MP4 file reporting 404. The solution to this problem is simple, as follows:
1. Open IIS Manager


2. Double-click on the MIME type and click Add 22 in the upper right corner of the image below

3. Add, extension mp4, type Video/MP4


4. Click OK
is a perfect solution to the problem

Remove video with video byte 0, uncaught (in promise) domexception: failed to load because no supported source was f

Uncaught (in promise) DOMException: Failed to load because no supported source was found.

the above error occurs on the one hand, the number of bytes of the video obtained from the background is 0, is an empty video

was used to determine whether the video could be downloaded. In the project, there was a problem that the video from the mobile phone to the database could not be played at all for the 0 byte video. The console reported an error: Uncaught (in promise) DOMException: Failed to load because no supported source was found

solution:

determines the networkState of the video, if the value is equal to 3, it will not play, skip
- Media.networkState; //0. This element is not initialized 1. Normal but not using network 2. Downloading data 3. No resource

found

determines the resource length of the video. If it is NAN, it cannot be played. However, this may be limited by the network state, and it takes a certain amount of time to obtain the length of the video when the network is not good.
- Media.duration; // the current resource length stream returns an infinite

I use the item written by vue: ev.target is used to get the status of the video


videoChanging: function (ev) {
if (! $refs.video) {return}
// replace the SRC of video
if(this.videosrctwo){
var status = this.$refs. video-ended
if(status){
if(this.$refs. video-src == this.videosrcone){
this.$refs.video.src = this.videosrcTwo
console.log('ev.target.networkState', ev.target.networkState)
console.log('ev.target.duration', ev.target.duration)
this.$refs.video.play()
}else{
this.$refs.video.src = this.videosrcOne
}
}
if(ev.target.ended){
this.playing = false
// this.replay =true
}
} else {
this. IsLoop = true

}

if(ev.target.networkState == 3) return this.$refs.video-src = this.videosrcone
This result will not play '
ev.target.networkState 3
ev.target.duration NaN

Reading and saving opencv Python video

Capture Video from Camera

gets video from the camera:

to capture video, you need to create a VideoCapture object. Its parameters can be the device index or the name of the video file (described below). The device index simply specifies the number of which camera. Zero represents the first camera and one represents the second camera. After that, you can capture the video frame by frame. But finally, don’t forget to release the capture.

import numpy as np
import cv2

cap = cv2.VideoCapture(0)

while(True):
    # Capture frame-by-frame
    ret, frame = cap.read()

    # Our operations on the frame come here
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

    # Display the resulting frame
    cv2.imshow('frame',gray)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()

cap.read () : returns a Boolean (True/False). This returns true if the frame was read correctly, false otherwise. You can check this return value to see if the video is over.

cap. IsOpened () : checks if the cap is initialized. If it is not initialized, open it with cap.open () . The above code reports an error when the CAP is not initialized.

Get (propId) :

cap.get (propId) : accesses some of the features of the video, where propId is a number from 0 to 18, each number representing the video’s Property Identifier. Some of these values can be modified using cap.set (propId, value) , and value is the modified value.

For example, I check the frame width and height by cap.get (3) and cap.get (4). The default value is 640×480. But I want to change it to 320×240, using ret = cap.set (3, 320) and RET = cap.set (4, 240).


Playing Video from file

to play video from file:

is the same as capturing video from the camera, just change the camera index and video file name. When displaying frames, select the appropriate cv2.waitkey () time. If this value is too small, the video will be very fast, and if it is too large, the video will be slow (this can be used to display the video in slow motion). Normally, 25 milliseconds will do.

import numpy as np
import cv2

cap = cv2.VideoCapture('vtest.avi')

while(cap.isOpened()):
    ret, frame = cap.read()

    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

    cv2.imshow('frame',gray)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

cap.release()
cv2.destroyAllWindows()

Saving a Video

save video:

creates a VideoWriter object, specifying the output file name (for example: output.avi). Then you specify the FourCC code (FourCC is the 4-byte code used to specify the video codec. List of available code. Next, pass in frames per second (FPS) and frame size. The last is the isColor flag. If it is True, the encoder encodes a color frame; otherwise, a grayscale frame.

import numpy as np
import cv2

cap = cv2.VideoCapture(0)

# Define the codec and create VideoWriter object
fourcc = cv2.VideoWriter_fourcc(*'XVID')
out = cv2.VideoWriter('output.avi',fourcc, 20.0, (640,480))

while(cap.isOpened()):
    ret, frame = cap.read()
    if ret==True:
        frame = cv2.flip(frame,0)

        # write the flipped frame
        out.write(frame)

        cv2.imshow('frame',frame)
        if cv2.waitKey(1) & 0xFF == ord('q'):
            break
    else:
        break

# Release everything if job is finished
cap.release()
out.release()
cv2.destroyAllWindows()

official document