Skip to content

Commit 172c234

Browse files
committed
ver 2.0
revise the main page.
1 parent 02d08e4 commit 172c234

File tree

1 file changed

+62
-53
lines changed

1 file changed

+62
-53
lines changed

docs/README.md

+62-53
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# FFmpeg-Encoder-Decoder-for-Python
32

43
*****
@@ -22,6 +21,8 @@ Getting your versions here! You could also visit the [release page](https://gith
2221

2322
| Version | Platform | Python Ver. | Numpy Ver. | FFmpeg Ver. |
2423
| ---------- | ----------- | ----------- | ----------- | ----------- |
24+
| [2.0][down20l] | Linux | 3.5 | 1.13 | 3.3 |
25+
| [2.0][down20w] | Windows | 3.5 | 1.13 | 3.3 |
2526
| [1.8][down18l] | Linux | 3.5 | 1.13 | 3.3 |
2627
| [1.8][down18w] | Windows | 3.5 | 1.13 | 3.3 |
2728
| [1.7][down17l] | Linux | 3.5 | 1.13 | 3.3 |
@@ -32,24 +33,24 @@ Getting your versions here! You could also visit the [release page](https://gith
3233
Just use it as a common module in python like this.
3334

3435
```python
35-
import mpegCoder
36+
import mpegCoder
3637
```
3738

3839
Noted that this API need you to install numpy.
3940

4041
An example of decoding a video in an arbitrary format:
4142

42-
```python
43+
```python
4344
d = mpegCoder.MpegDecoder()
4445
d.FFmpegSetup(b'inputVideo.mp4')
4546
p = d.ExtractGOP(10) # Get a gop of current video by setting the start position of 10th frame.
4647
p = d.ExtractGOP() # Get a gop of current video, using the current position after the last ExtractGOP.
4748
d.ExtractFrame(100, 100) # Extract 100 frames from the begining of 100th frame.
48-
```
49+
```
4950

5051
An example of transfer the coding of a video with an assigned codec:
5152

52-
```python
53+
```python
5354
d = mpegCoder.MpegDecoder()
5455
d.FFmpegSetup(b'i.avi')
5556
e = mpegCoder.MpegEncoder()
@@ -63,11 +64,11 @@ An example of transfer the coding of a video with an assigned codec:
6364
e.EncodeFrame(i) # Encode current frame.
6465
e.FFmpegClose() # End encoding, and flush all frames in cache.
6566
d.clear() # Close the input video.
66-
```
67+
```
6768

6869
An example of demuxing the video streamer from a server:
6970

70-
```python
71+
```python
7172
d = mpegCoder.MpegClient() # create the handle
7273
d.setParameter(dstFrameRate=(5,1), readSize=5, cacheSize=12) # normalize the frame rate to 5 FPS, and use a cache which size is 12 frames. Read 5 frames each time.
7374
success = d.FFmpegSetup(b'rtsp://localhost:8554/video')
@@ -80,97 +81,105 @@ An example of demuxing the video streamer from a server:
8081
# do some processing
8182
d.terminate() # shut down the current thread. You could call start() and let it restart.
8283
d.clear() # Disconnect with the stream.
84+
```
85+
86+
You could also find some more explanations in two examples about `MpegClient` in [here][exp1] and [here][exp2].
8387

8488
For more instructions, you could tap `help(mpegCoder)`.
8589

8690
## Update Report
8791

8892
### V2.0 update report:
8993

90-
1. Revise the bug of the encoder which may cause the stream duration is shorter than the real duration of the video in some not advanced media players.
94+
1. Revise the bug of the encoder which may cause the stream duration is shorter than the real duration of the video in some not advanced media players.
9195

92-
2. Improve the structure of the code and remove some unnecessary codes.
96+
2. Improve the structure of the code and remove some unnecessary codes.
9397

94-
3. Provide a complete version of client, which could demux the video stream from a server in any network protocol.
98+
3. Provide a complete version of client, which could demux the video stream from a server in any network protocol.
9599

96100
### V1.8 update report:
97101

98-
1. Provide options (widthDst, heightDst) to let MpegDecoder could control the output size manually. To ensure the option is valid, we must use the method `setParameter` before `FFmpegSetup`. Now you could use this options to get a rescaled output directly:
102+
1. Provide options (widthDst, heightDst) to let MpegDecoder could control the output size manually. To ensure the option is valid, we must use the method `setParameter` before `FFmpegSetup`. Now you could use this options to get a rescaled output directly:
103+
104+
```python
105+
d = mpegCoder.MpegDecoder() # initialize
106+
d.setParameter(widthDst=400, heightDst=300) # noted that these options must be set before 'FFmpegSetup'!
107+
d.FFmpegSetup(b'i.avi') # the original video size would not influence the output
108+
print(d) # examine the parameters. You could also get the original video size by 'getParameter'
109+
d.ExtractFrame(0, 100) # get 100 frames with 400x300
110+
```
99111

100-
```python
101-
d = mpegCoder.MpegDecoder() # initialize
102-
d.setParameter(widthDst=400, heightDst=300) # noted that these options must be set before 'FFmpegSetup'!
103-
d.FFmpegSetup(b'i.avi') # the original video size would not influence the output
104-
print(d) # examine the parameters. You could also get the original video size by 'getParameter'
105-
d.ExtractFrame(0, 100) # get 100 frames with 400x300
106-
```
112+
In another example, the set optional parameters could be inherited by encoder, too:
107113

108-
In another example, the set optional parameters could be inherited by encoder, too:
114+
```python
115+
d.setParameter(widthDst=400, heightDst=300) # set optional parameters
116+
...
117+
e.setParameter(decoder=d) # the width/height would inherit from widthDst/heightDst rather than original width/height of the decoder.
118+
```
109119

110-
```python
111-
d.setParameter(widthDst=400, heightDst=300) # set optional parameters
112-
...
113-
e.setParameter(decoder=d) # the width/height would inherit from widthDst/heightDst rather than original width/height of the decoder.
114-
```
120+
Noted that we do not provide `widthDst`/`heightDst` in `getParameter`, because these 2 options are all set by users. There is no need to get them from the video metadata.
115121

116-
Noted that we do not provide `widthDst`/`heightDst` in `getParameter`, because these 2 options are all set by users. There is no need to get them from the video metadata.
117-
118-
2. Optimize some realization of Decoder so that its efficiency could be improved.
122+
2. Optimize some realization of Decoder so that its efficiency could be improved.
119123

120124
### V1.7-linux update report:
121125

122-
Thanks to God, we succeed in this work!
126+
Thanks to God, we succeed in this work!
123127

124-
A new version is avaliable for Linux. To implement this tool, you need to install some libraries firstly:
128+
A new version is avaliable for Linux. To implement this tool, you need to install some libraries firstly:
125129

126-
* python3.5
130+
* python3.5
127131

128-
* numpy 1.13
132+
* numpy 1.13
129133

130-
If you want, you could install `ffmpeg` on Linux: Here are some instructions
134+
If you want, you could install `ffmpeg` on Linux: Here are some instructions
131135

132-
1. Check every pack which ffmpeg needs here: [Dependency of FFmpeg](https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu "Dependency of FFmpeg")
136+
1. Check every pack which ffmpeg needs here: [Dependency of FFmpeg](https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu "Dependency of FFmpeg")
133137

134-
2. Use these steps to install ffmpeg instead of provided commands on the above site.
138+
2. Use these steps to install ffmpeg instead of provided commands on the above site.
135139

136-
```Bash
137-
$ git clone https://git.ffmpeg.org/ffmpeg.git
138-
$ cd ffmpeg
139-
$ ./configure --prefix=host --enable-gpl --enable-libx264 --enable-libx265 --enable-shared --disable-static --disable-doc
140-
$ make
141-
$ make install
142-
```
140+
```Bash
141+
$ git clone https://git.ffmpeg.org/ffmpeg.git
142+
$ cd ffmpeg
143+
$ ./configure --prefix=host --enable-gpl --enable-libx264 --enable-libx265 --enable-shared --disable-static --disable-doc
144+
$ make
145+
$ make install
146+
```
143147

144148
### V1.7 update report:
145149

146-
1. Realize the encoder totally.
150+
1. Realize the encoder totally.
147151

148-
2. Provide a global option `dumpLevel` to control the log shown in the screen.
152+
2. Provide a global option `dumpLevel` to control the log shown in the screen.
149153

150-
3. Fix bugs in initialize functions.
154+
3. Fix bugs in initialize functions.
151155

152156
### V1.5 update report:
153157

154-
1. Provide an incomplete version of encoder, which could encode frames as a video stream that could not be played by player.
158+
1. Provide an incomplete version of encoder, which could encode frames as a video stream that could not be played by player.
155159

156160
### V1.4 update report:
157161

158-
1. Fix a severe bug of the decoder, which causes the memory collapsed if decoding a lot of frames.
162+
1. Fix a severe bug of the decoder, which causes the memory collapsed if decoding a lot of frames.
159163

160164
### V1.2 update report:
161165

162-
1. Use numpy array to replace the native pyList, which improves the speed significantly.
166+
1. Use numpy array to replace the native pyList, which improves the speed significantly.
163167

164168
### V1.0 update report:
165-
1. Provide the decoder which could decode videos in arbitrary formats and arbitrary coding.
169+
1. Provide the decoder which could decode videos in arbitrary formats and arbitrary coding.
166170

167171
## Version of currently used FFmpeg library
168-
* libavcodec.so.58.6.103
169-
* libavformat.so.58.3.100
170-
* libavutil.so.56.5.100
171-
* libswresample.so.3.0.101
172-
* libswscale.so.5.0.101
172+
* libavcodec.so.58.6.103
173+
* libavformat.so.58.3.100
174+
* libavutil.so.56.5.100
175+
* libswresample.so.3.0.101
176+
* libswscale.so.5.0.101
177+
178+
[exp1]:https://github.com/cainmagi/FFmpeg-Encoder-Decoder-for-Python/tree/example-client-check "check the client"
179+
[exp2]:https://github.com/cainmagi/FFmpeg-Encoder-Decoder-for-Python/tree/example-client-player "client with player"
173180

181+
[down20l]:https://github.com/cainmagi/FFmpeg-Encoder-Decoder-for-Python/releases/download/2.0/mpegCoder_2_0_Linux.7z "Linux, 1.8"
182+
[down20w]:https://github.com/cainmagi/FFmpeg-Encoder-Decoder-for-Python/releases/download/2.0/mpegCoder_2_0_Win.7z "Windows, 1.8"
174183
[down18l]:https://github.com/cainmagi/FFmpeg-Encoder-Decoder-for-Python/releases/download/1.8/mpegCoder_1_8_Linux.7z "Linux, 1.8"
175184
[down18w]:https://github.com/cainmagi/FFmpeg-Encoder-Decoder-for-Python/releases/download/1.8/mpegCoder_1_8_Win.7z "Windows, 1.8"
176185
[down17l]:https://github.com/cainmagi/FFmpeg-Encoder-Decoder-for-Python/releases/download/1.7/mpegCoder_1_7_Linux.7z "Linux, 1.7"

0 commit comments

Comments
 (0)