Tag Archives: codec

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

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/

Solution of Unicode decodeerror -‘utf-8 ‘codec can’t decode byte 0xc4 in position 0 – invalid continuation byte


Reading CSV document with Pandas is an error that cannot be read because there is Chinese in the document. The error is due to the failure of the 'utf-8' codec to decode the 0 bit byte 0xc4

Solutions:
After reading the file, add encoding=’ GBK ‘,
such as: pddata=pd. Read_csv (' felipe.csv ',encoding=' GBK ')


Interested to continue to see the reason!
As you know, the default encoding we use in Python is UTF-8. For an introduction to coding, I recommend taking a look at Liao Da’s Python tutorial, “Strings and Coding.” Since UTF-8 format cannot correctly read CSV files with Chinese characters, it would be a good idea to select a format that can read Chinese characters.
So what format can read Chinese characters?We open the Python3 official website: find the section on standard characters. The diagram below:

So what format do you want to change?You can see that the third column of the table, Language, represents what Language the encoding supports. So let’s find out.
!
I’m not going to show you the table here, but if you’re interested, go to the website. Anyway, under my careful search, there is big5; Big5hkscs; Gb2312; GBK; Gb18030. Hz; The five formats iso2022_jp_2 may support Chinese. After my test, I found gb2312; GBK; Gb18030 can read CSV files with Chinese smoothly. (Since all three are ok, let’s have a good GBK.)

It works!

Package python3.1 + PyQt4 into exe

There are many programs that package Python as an exe, such as Py2exe, PyInstaller, and so on, but so far none of them support Python 3.1 well, so I’ll introduce CX_freeze 4.2.2 here, which also supports cross-platform running on Windows and Linux.
Cx_freeze download site is http://sourceforge.net/projects/cx-freeze/files/, want to undertake choosing according to install python version. For example, I am using python3.1, so I will download the file cx_Freeze- 4.2.2.2.win32-py3.1.msi. After running the installation package, the program is copied to the Python directory. There are two main places, one is C:/Python31/Scripts and the other is C:/Python31/Lib/site-packages/cx_Freeze
 
In previous versions of cx_Freeze, py was converted to exe through the script Freezepython.py, but in 4.2.2 Freezepython.py is gone and the main work is done by the C:/Python 31/scripts cxfree.bat.
There are two main ways to complete python exe packaging using cx_Freeze:
First, run cxfreeze. Bat directly through:
Go to the CMD command line, enter the C:/Python 31/scripts directory, and run cxfreed.bat-h to see its instructions. We can do an experiment with CX_freeze’s own sample.
Go to C :/ Python 31/scripts/ and run
cxfreeze C:/Python31/Lib/site-packages/cx_Freeze/samples/PyQt4/PyQt4app.py –install-dir=d:/123
Pytqt4app.py is packaged as exe, and the libraries it USES are also evaluated in the d:/123 directory.
 
Second, run setup.py:
In the example provided with CXfreeze C:/ python31/lib /site-packages/cx_Freeze/samples/PyQt4, there is a setup.py file. Open this file and we find that it is:

By running this script, packaging can be done automatically:
For example, if you go into C:/ python31/lib /site-packages/cx_Freeze/samples/PyQt4,
run
setup.py build
After that, a build/exe.win32-3.1 directory will appear under this directory, where you can see the packaged exe file. We want to package our script, copy this setup.py over, and put it in
executables = [Executable(“PyQt4app.py”, base = base)])
Change pyqt4app.py to your own script name.
 
Problems during packaging:
For Chinese support, if there is Chinese in the script and the encoding format is not specified, the packaging process will occur: UnicodeDecodeError: ‘utf8’ codec can ‘t decode bytes in the position of 1602: invalid data this kind of mistake, this blog post on http://www.cnblogs.com/xinzaitian/archive/2010/12/10/1902481.html, the author mentioned Chinese must be deleted.
In fact, Chinese characters can be retained by adding the following at the beginning of the script file:
#! /usr/bin/env python
#coding=utf-8
It is ok
 
Another problem is that if the packaged EXE file is run under “desktop” or other Chinese path, a window will pop up showing “Cannot get zipimporter” instance. So far, no good solution has been found