Skip to content

Commit 1860d70

Browse files
authored
Update README.md
Adjust the format of ReadMe
1 parent 282b4da commit 1860d70

File tree

1 file changed

+104
-72
lines changed

1 file changed

+104
-72
lines changed

README.md

Lines changed: 104 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,111 @@
1+
12
# FFmpeg-Encoder-Decoder-for-Python
2-
================================================================================
3+
4+
*****
35
__ _ _ _ _ ,___
46
( / / / o ( / ) ) / / /
57
(__/ , , _, /_ _ _ _' ( / / / ,_ _ _, / __ __/ _ _
68
_/_(_/_(__/ /_(/_/ / /_/_)_ / / (__/|_)_(/_(_)_(___/(_)(_/_(/_/ (_
79
// /| /|
810
(/ (/ (/
9-
================================================================================
10-
Yuchen's Mpeg Coder - Readme
11-
This is a mpegcoder adapted from FFmpeg & Python-c-api.Using it you could
12-
get access to processing video easily. Just use it as a common module in
13-
python like this.
14-
>>> import mpegCoder
15-
Noted that this API need you to install numpy.
16-
An example of decoding a video in an arbitrary format:
17-
>>> d = mpegCoder.MpegDecoder()
18-
>>> d.FFmpegSetup(b'inputVideo.mp4')
19-
>>> p = d.ExtractGOP(10) # Get a gop of current video by setting the
20-
start position of 10th frame.
21-
>>> p = d.ExtractGOP() # Get a gop of current video, using the current
22-
position after the last ExtractGOP.
23-
>>> d.ExtractFrame(100, 100) # Extract 100 frames from the begining of
24-
100th frame.
25-
An example of transfer the coding of a video with an assigned codec:
26-
>>> d = mpegCoder.MpegDecoder()
27-
>>> d.FFmpegSetup(b'i.avi')
28-
>>> e = mpegCoder.MpegEncoder()
29-
>>> e.setParameter(decoder=d, codecName=b'libx264', videoPath=b'o.mp4')
30-
# inherit most of parameters from the decoder.
31-
>>> opened = e.FFmpegSetup() # Load the encoder.
32-
>>> if opened: # If encoder is not loaded successfully, do not continue.
33-
... p = True
34-
... while p:
35-
... p = d.ExtractGOP() # Extract current GOP.
36-
... for i in p: # Select every frame.
37-
... e.EncodeFrame(i) # Encode current frame.
38-
... e.FFmpegClose() # End encoding, and flush all frames in cache.
39-
>>> d.clear() # Close the input video.
40-
For more instructions, you could tap help(mpegCoder).
41-
================================================================================
42-
V1.7-linux update report:
43-
Thanks to God, we succeed in this work!
44-
A new version is avaliable for Linux. To implement this tool, you need to
45-
install some libraries firstly:
46-
- python3.5 (with numpy)
47-
- ffmpeg on Linux: Here are some instructions
48-
(1). Check every pack which ffmpeg needs on
49-
https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
50-
(2). Use these steps to install ffmpeg instead of provided commands
51-
on the above site.
52-
$ git clone https://git.ffmpeg.org/ffmpeg.git
53-
$ cd ffmpeg
54-
$ ./configure --prefix=host --enable-gpl --enable-shared --disable-static --disable-doc
55-
$ make
56-
$ make install
57-
V1.7 update report:
58-
1. Realize the encoder totally.
59-
2. Provide a global option 'dumpLevel' to control the log shown in the screen.
60-
3. Fix bugs in initalize functions.
61-
V1.5 update report:
62-
1. Provide an incomplete version of encoder, which could encode frames as a
63-
video stream that could not be played by player.
64-
V1.4 update report:
65-
1. Fix a severe bug of the decoder, which causes the memory collapsed if
66-
decoding a lot of frames.
67-
V1.2 update report:
68-
1. Use numpy array to replace the native pyList, which improves the speed
69-
significantlly.
70-
V1.0 update report:
71-
1. Provide the decoder which could decode videos in arbitrary formats and
72-
arbitrary coding.
73-
================================================================================
74-
Version of used FFmpeg library
75-
libavcodec.so.58.6.103
76-
libavformat.so.58.3.100
77-
libavutil.so.56.5.100
78-
libswresample.so.3.0.101
79-
libswscale.so.5.0.101
11+
*****
12+
13+
## Yuchen's Mpeg Coder - Readme
14+
15+
This is a mpegcoder adapted from FFmpeg & Python-c-api.Using it you could get access to processing video easily. Just use it as a common module in python like this.
16+
17+
```python
18+
import mpegCoder
19+
```
20+
21+
Noted that this API need you to install numpy.
22+
23+
An example of decoding a video in an arbitrary format:
24+
25+
```python
26+
d = mpegCoder.MpegDecoder()
27+
d.FFmpegSetup(b'inputVideo.mp4')
28+
p = d.ExtractGOP(10) # Get a gop of current video by setting the start position of 10th frame.
29+
p = d.ExtractGOP() # Get a gop of current video, using the current position after the last ExtractGOP.
30+
d.ExtractFrame(100, 100) # Extract 100 frames from the begining of 100th frame.
31+
```
32+
33+
An example of transfer the coding of a video with an assigned codec:
34+
35+
```python
36+
 d = mpegCoder.MpegDecoder()
37+
d.FFmpegSetup(b'i.avi')
38+
e = mpegCoder.MpegEncoder()
39+
e.setParameter(decoder=d, codecName=b'libx264', videoPath=b'o.mp4') # inherit most of parameters from the decoder.
40+
opened = e.FFmpegSetup() # Load the encoder.
41+
if opened: # If encoder is not loaded successfully, do not continue.
42+
p = True
43+
while p:
44+
p = d.ExtractGOP() # Extract current GOP.
45+
for i in p: # Select every frame.
46+
e.EncodeFrame(i) # Encode current frame.
47+
e.FFmpegClose() # End encoding, and flush all frames in cache.
48+
d.clear() # Close the input video.
49+
```
50+
51+
For more instructions, you could tap `help(mpegCoder)`.
52+
53+
## Update Report
54+
55+
### V1.7-linux update report:
56+
57+
Thanks to God, we succeed in this work!
58+
59+
A new version is avaliable for Linux. To implement this tool, you need to install some libraries firstly:
60+
61+
* python3.5
62+
63+
* numpy 1.13
64+
65+
If you want, you could install `ffmpeg` on Linux: Here are some instructions
66+
67+
1. Check every pack which ffmpeg needs here: [Dependency of FFmpeg](https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu "Dependency of FFmpeg")
68+
69+
2. Use these steps to install ffmpeg instead of provided commands on the above site.
70+
71+
```Bash
72+
$ git clone https://git.ffmpeg.org/ffmpeg.git
73+
$ cd ffmpeg
74+
$ ./configure --prefix=host --enable-gpl --enable-shared --disable-static --disable-doc
75+
$ make
76+
$ make install
77+
```
78+
79+
### V1.7 update report:
80+
81+
1. Realize the encoder totally.
82+
83+
2. Provide a global option `dumpLevel` to control the log shown in the screen.
84+
85+
3. Fix bugs in initalize functions.
86+
87+
### V1.5 update report:
88+
89+
1. Provide an incomplete version of encoder, which could encode frames as a
90+
video stream that could not be played by player.
91+
92+
### V1.4 update report:
93+
94+
1. Fix a severe bug of the decoder, which causes the memory collapsed if
95+
decoding a lot of frames.
96+
97+
### V1.2 update report:
98+
99+
1. Use numpy array to replace the native pyList, which improves the speed
100+
significantlly.
101+
102+
### V1.0 update report:
103+
1. Provide the decoder which could decode videos in arbitrary formats and
104+
arbitrary coding.
105+
106+
## Version of currently used FFmpeg library
107+
* libavcodec.so.58.6.103
108+
* libavformat.so.58.3.100
109+
* libavutil.so.56.5.100
110+
* libswresample.so.3.0.101
111+
* libswscale.so.5.0.101

0 commit comments

Comments
 (0)