Skip to content

Commit f831f3f

Browse files
committed
Merge branch 'develop'
2 parents f167f9f + a9220b2 commit f831f3f

File tree

15 files changed

+293
-559
lines changed

15 files changed

+293
-559
lines changed

README.en.md

Lines changed: 15 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The data format is modified for playback.
1515
## Overview
1616
This application streams video files converted to the dedicated format gmv from SD.
1717
It uses multi-cores to perform rendering with DMA and audio playback.
18-
Old format (gcf + wav) can be played back (however, audio playback is restricted on machines without PSRAM).
18+
***The old format gcf + wav is no longer playable since 0.1.1. Please regenerate it in gmv format or convert it using the gcf + wav => gmv conversion script.***
1919

2020

2121
## Target devices
@@ -24,8 +24,6 @@ It must be able to run the libraries it depends on and have an SD card.
2424
* M5Stack Gray
2525
* M5Stack Core2
2626
* M5Stack CoreS3
27-
28-
However, Basic and Gray, which do not have PSRAM, have significant limitations on the amount of time that audio can be played.
2927

3028
## Required libraries
3129
* [M5Unified](https://github.com/m5stack/M5Unified)
@@ -54,8 +52,7 @@ However, Basic and Gray, which do not have PSRAM, have significant limitations o
5452
|S3\_release_DisplayModule| Support DisplayModule |
5553

5654
### Sample data for playback
57-
Download [sample_003.zip](https://github.com/GOB52/M5Stack_FlipBookSD/files/11746898/sample_003.zip) and copy it to **/gcf** on your SD card.
58-
55+
Download [sample_0_1_1.zip](https://github.com/GOB52/M5Stack_FlipBookSD/files/11871296/sample_0_1_1.zip), unzip it and copy to **/gcf** on your SD card.
5956

6057
## How to make data
6158
### Required tools
@@ -73,13 +70,13 @@ Video data can be in any format that can be processed by FFmpeg.
7370
1. Copy video data to an arbitrarily created directory.
7471
1. Copy [conv.sh](script/conv.sh) and [gmv.py](script/gmv.py) to the same directory.
7572
1. Execute the shell script as follows
76-
**bash conv.sh move_file_name frame_rate [ jpeg_maxumu,_size (Default if not specified is 7168) ]**
73+
**bash conv.sh move_file_name frame_rate [ jpeg_maxumum_size (Default if not specified is 7168) ]**
7774

7875
| Argument | Required?| Description |
7976
|---|---|---|
8077
|move_file_path|YES|Source movie|
81-
|frame_rate|YES|Output frame rate (1 - 30)|
82-
|jpeg_maximum_size|NO|Maximum file size of one image to output (1024 - 10240)<BR>Larger size helps maintain quality but increases the likelihood of crashes (see Known Issues)|
78+
|frame_rate|YES|Output frame rate (1.0 - 30.0)<br>**Integer or decimal numbers can be specified**|
79+
|jpeg_maximum_size|NO|Maximum file size of one image to output (1024 - 10240)<BR>Larger sizes preserve quality but are more likely to cause processing delays (see "Known Issues").|
8380

8481
4. The files that named "videofilename.gmv" output to same directory.
8582
5. Copy the above files to **/gcf** on the SD card.
@@ -91,7 +88,7 @@ cp bar.mp4 foo
9188
cp script/conv.sh foo
9289
cp script/gcf.py foo
9390
cd foo
94-
bash conv.sh bar.mp4 24
91+
bash conv.sh bar.mp4 29.97
9592
cp bar.gmv your_sd_card_path/gcf
9693
```
9794

@@ -111,21 +108,21 @@ You can change the output quality, filters, etc. to your liking. The best parame
111108
### Data restrictions
112109
* wav data quality (8KHz unsigned 8bit mono)
113110
The quality of the audio data is lowered to reduce the processing load.
114-
It is possible to edit the script to improve the quality, but the processing load may cause crashes. (See Known Issues).
111+
Scripts can be edited to improve quality, but processing delays may occur due to processing load. (See Known Issues)
115112

116-
* Image size and frame rate
113+
* Image size and frame rate
117114
When converting a video to JPEG, the width is 320px and the height is a value that maintains the aspect ratio.
118115
<ins>Currently, 320 x 240 can be played back at about 24 FPS, and 320 x 180 at about 30 FPS.</ins>
119116
To change the image size, edit the parameter for FFmpeg in conv.sh. **(scale=)**
120117

121-
## Known issues
122-
### Reset during playback
123-
If a reset occurs during execution, the Serial monitor should display a message that the assertion was caught.
124-
The cause is that drawing did not finish within the specified time, and the SD and Lcd buses collided.
125-
If this occurs at a specific point in the video, it can be avoided by modifying the data side.
118+
* Image size and output device size
119+
If the image size is narrower or wider than the output device size, it will be centered.
126120

127-
Also, in rare cases, it may take a long time to read from SD, which may cause a reset as described above.
128-
The cause of this is not known.There may be SD card compatibility issues.
121+
## Known issues
122+
### Audio is choppy or playback speed is slow.
123+
This may be due to the processing not being completed in time within a frame.
124+
In rare cases, it may take a long time to read from the SD card, which may cause some frames to not be processed in time.
125+
There may be a problem with the compatibility or formatting of the SD card.
129126

130127
https://github.com/greiman/SdFat/issues/96#issuecomment-377332392
131128

@@ -156,25 +153,6 @@ conv.sh
156153
# ...
157154
```
158155

159-
#### Workaround by the program (deprecated)
160-
* Switch multi-core playback to single-core playback.
161-
Switch the corresponding section of main.cpp to the one using a single core.
162-
Playback speed will be reduced, but bus contention will be reliably avoided.
163-
164-
```cpp
165-
src/main.cpp
166-
static void loopRender()
167-
{
168-
// ...
169-
{
170-
ScopedProfile(drawCycle);
171-
//mainClass.drawJpg(buffers[(bufferIndex - 1 + NUMBER_OF_BUFFERS) % NUMBER_OF_BUFFERS], JPG_BUFFER_SIZE); // Process on multiple cores
172-
mainClass.drawJpg(buffers[(bufferIndex - 1 + NUMBER_OF_BUFFERS) % NUMBER_OF_BUFFERS], JPG_BUFFER_SIZE, false); // Process on single core. Try it, if If assert occurs on xQueueSend call. (However, FPS will be reduced)
173-
}
174-
// ...
175-
}
176-
```
177-
178156
## How to operate
179157
### Menu
180158
| Button | Description |
@@ -194,7 +172,6 @@ static void loopRender()
194172

195173

196174
## Conversion from old format (gcf + wav)
197-
Currently, the old format (gcf + wav) can be played,
198175
Pyhton script for conversion [gcf\_to\_gmv.py](script/gcf_to_gmv.py) and shell script for conversion of files in the current directory [convert\_gcf\_to\_gmv.sh](script/convert_gcf_to_gmv.sh) for converting files in the current directory.
199176

200177
```sh

README.md

Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ SINTEL (Trailer)
1414
## 概要
1515
動画ファイルを専用の形式 (gmv) へ変換したファイルを SD からストリーミング再生するアプリケーションです。
1616
マルチコアを使用して DMA による描画と、音声再生を行っています。
17-
旧形式である gcf + wav 再生可能です(但し PSRAM 非搭載機では音声再生制限あり)
17+
***旧形式である gcf + wav は 0.1.1 より再生不可となりました。gmv 形式で再生成するか、gcf + wav => gmv 変換スクリプトを用いて変換してください。***
1818

1919

2020
## 対象デバイス
@@ -51,7 +51,7 @@ SINTEL (Trailer)
5151
|S3\_release_DisplayModule| ディスプレイモジュール 対応|
5252

5353
### 再生用サンプルデータ
54-
[sample_003.zip](https://github.com/GOB52/M5Stack_FlipBookSD/files/11746898/sample_003.zip) をダウンロードして SD カードの **/gcf** へコピーしてください。
54+
[sample_0_1_1.zip](https://github.com/GOB52/M5Stack_FlipBookSD/files/11871296/sample_0_1_1.zip) をダウンロードして解凍し、 SD カードの **/gcf** へコピーしてください。
5555

5656
## データの作成方法
5757
### 必要なもの
@@ -68,13 +68,13 @@ SINTEL (Trailer)
6868
1. 任意に作ったデータ作成用ディレクトリに動画データをコピーする
6969
1. 同ディレクトリに [conv.sh](script/conv.sh)[gmv.py](script/gmv.py) をコピーする
7070
1. シェルスクリプトを次のように指定して実行する。
71-
**bash conv.sh move_file_path frame_rate [ jpeg_maxumu,_size (無指定時は 7168) ]**
71+
**bash conv.sh move_file_path frame_rate [ jpeg_maxumum_size (無指定時は 7168) ]**
7272

7373
|引数|必須?|説明|
7474
|---|---|---|
7575
|move_file_path|YES|元となる動画|
76-
|frame_rate|YES|出力されるデータの FPS (1 - 30)|
77-
|jpeg_maximum_size|NO|JPEG 1枚あたりの最大ファイルサイズ( 1024 - 10240)<br>大きいと品質が維持されやすいがクラッシュする可能性が高くなる(既知の問題参照)|
76+
|frame_rate|YES|出力されるデータの FPS (1.0 - 30.0)<br>整数または小数を指定可能|
77+
|jpeg_maximum_size|NO|JPEG 1枚あたりの最大ファイルサイズ( 1024 - 10240)<br>大きいと品質が維持されるが処理遅延が発生する可能性が高くなる(既知の問題参照)|
7878

7979
4. 動画ファイル名.gmv が出力される。
8080
5. gmv ファイルを SD カードの **/gcf** にコピーする。
@@ -86,7 +86,7 @@ cp bar.mp4 foo
8686
cp script/conv.sh foo
8787
cp script/gcf.py foo
8888
cd foo
89-
bash conv.sh bar.mp4 24
89+
bash conv.sh bar.mp4 29.97
9090
cp bar.gmv your_sd_card_path/gcf
9191
```
9292

@@ -106,22 +106,21 @@ ffmpeg -i $1 -r $2 -vf scale=320:-1,dejudder -qmin 1 -q 1 jpg$$/%06d.jpg
106106
### データの制限
107107
* wav データの品質 (8KHz 符号なし 8bit mono)
108108
処理負荷軽減の為、音声データの品質は下げています。
109-
スクリプトを編集して品質を上げることは可能ですが、処理負荷によってクラッシュする場合が生じるかもしれません。(既知の問題参照)
109+
スクリプトを編集して品質を上げることは可能ですが、処理負荷によって処理遅延が生じるかもしれません。(既知の問題参照)
110110

111111
* 画像サイズとフレームレート
112112
動画から JPEG 化する際には幅 320p 高さはアスペクト比を維持した値で出力します。
113113
<ins>現在の所 320 x 240 で 24 FPS 程度、 320 x 180 で 30 FPS 程度の再生が可能です。</ins>
114114
画像サイズを変更したい場合は [conv.sh](conv.sh) の FFmpeg へ与えているパラメータを変更してください。 **(scale=)**
115115

116+
* 画像サイズと出力先サイズ
117+
画像データが出力先サイズに満たない、または逸脱する場合は、センタリングして表示されます。
116118

117119
## 既知の問題
118-
### 再生時にリセットがかかる
119-
実行中にリセットがかかった場合 Serial モニタに assert で引っ掛かった旨が表示されているはずです。
120-
原因は描画が所定の時間内に終わらず、 SD と Lcd のバスが衝突した事による物です。
121-
動画の特定箇所で発生する場合はデータ側を修正することで回避することができます。
122-
123-
またごく稀に SD からの読み込みに時間がかかる時があり、それによって上記と同様にリセットがかかる場合があります。
124-
これは原因がわかっていません。 SD カードの相性かフォーマット状態に問題があるかもしれません。
120+
### 音声が途切れる、再生速度が遅い
121+
1 フレーム内での処理が間に合っていないことが原因です。
122+
またごく稀に SD からの読み込みに時間がかかる時があり、それによって処理が間に合わないフレームが生じているかもしれません。
123+
SD カードの相性かフォーマット状態に問題がある可能性があります。
125124

126125
https://github.com/greiman/SdFat/issues/96#issuecomment-377332392
127126

@@ -159,24 +158,6 @@ conv.sh
159158
# ...
160159
```
161160

162-
#### プログラムでの回避策(非推奨)
163-
* マルチコア再生をシングルコア再生に切り替える
164-
main.cpp の該当箇所をシングルコア使用の物に切り替えます。
165-
再生速度は落ちますが、バス競合を確実に避けるようになります。
166-
167-
```cpp
168-
src/main.cpp
169-
static void loopRender()
170-
{
171-
// ...
172-
{
173-
ScopedProfile(drawCycle);
174-
//mainClass.drawJpg(buffers[(bufferIndex - 1 + NUMBER_OF_BUFFERS) % NUMBER_OF_BUFFERS], JPG_BUFFER_SIZE); // Process on multiple cores
175-
mainClass.drawJpg(buffers[(bufferIndex - 1 + NUMBER_OF_BUFFERS) % NUMBER_OF_BUFFERS], JPG_BUFFER_SIZE, false); // Process on single core. Try it, if If assert occurs on xQueueSend call. (However, FPS will be reduced)
176-
}
177-
// ...
178-
}
179-
```
180161
## 操作方法
181162
### メニュー
182163
|ボタン|説明|
@@ -195,7 +176,6 @@ static void loopRender()
195176
|Cボタン押下|画面右 1/3|音量上げる|
196177

197178
## 旧形式 (gcf + wav) からの変換
198-
現在の所、旧形式(gcf + wav) も再生できますが、
199179
変換用 Pyhton スクリプト [gcf_to_gmv.py](script/gcf_to_gmv.py) と、カレントディレクトリのファイル群の変換の為のシェルスクリプト [convert_gcf_to_gmv.sh](script/convert_gcf_to_gmv.sh) を用意しました。
200180

201181
```sh

platformio.ini

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,9 @@ monitor_speed = 115200
1919
monitor_filters = esp32_exception_decoder, time
2020
upload_speed = 921600
2121

22-
; BOARD_HAS_PSRAM is specified because we want to use PSRAM.
23-
; If the device does not have the PSRAM, PSRAM initialization will fail and the device will continue to operate as is.
24-
; PSRAM 搭載機種では PSRAM を使いたいので BOARD_HAS_PSRAM を指定しています。
25-
; 非搭載機では PSRAM 初期化に失敗し、そのまま動作します。
26-
;
27-
; FBSD_SUPPORT_GCF
28-
; 旧形式のサポートする場合は定義する
29-
; Support old format if defined
3022
build_flags = -Wall -Wextra -Wreturn-local-addr -Werror=format -Werror=return-local-addr
31-
-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue
23+
;-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue
3224
-DSD_FAT_TYPE=3
33-
-DFBSD_SUPPORT_GCF
3425

3526
; --------------------------------
3627
; Choose build options
@@ -63,22 +54,22 @@ build_flags = -DCORE_DEBUG_LEVEL=5
6354
[env:release]
6455
board = m5stack-core-esp32
6556
build_type=release
66-
build_flags=${env.build_flags} ${option_release.build_flags} -DENABLE_PROFILE
57+
build_flags=${env.build_flags} ${option_release.build_flags}
6758

6859
; Support display module
6960
; ディプレイモジュールのみサポート
7061
[env:release_DisplayModule]
7162
board = m5stack-core-esp32
7263
build_type=release
73-
build_flags=${env.build_flags} ${option_release.build_flags} -DENABLE_PROFILE -DFBSD_ENABLE_DISPLAY_MODULE
64+
build_flags=${env.build_flags} ${option_release.build_flags} -DFBSD_ENABLE_DISPLAY_MODULE
7465
board_build.partitions = min_spiffs.csv
7566

7667
; Support SD-Updater
7768
; SD-Updater のみサポート
7869
[env:release_SdUpdater]
7970
board = m5stack-core-esp32
8071
build_type=release
81-
build_flags=${env.build_flags} ${option_release.build_flags} -DENABLE_PROFILE -DFBSD_ENABLE_SD_UPDATER
72+
build_flags=${env.build_flags} ${option_release.build_flags} -DFBSD_ENABLE_SD_UPDATER
8273
lib_deps= ${env.lib_deps}
8374
tobozo/M5Stack-SD-Updater @1.2.5
8475
board_build.partitions = min_spiffs.csv
@@ -88,36 +79,62 @@ board_build.partitions = min_spiffs.csv
8879
[env:release_SdUpdater_DisplayModule]
8980
board = m5stack-core-esp32
9081
build_type=release
91-
build_flags=${env.build_flags} ${option_release.build_flags} -DENABLE_PROFILE -DFBSD_ENABLE_DISPLAY_MODULE -DFBSD_ENABLE_SD_UPDATER
82+
build_flags=${env.build_flags} ${option_release.build_flags} -DFBSD_ENABLE_DISPLAY_MODULE -DFBSD_ENABLE_SD_UPDATER
9283
lib_deps= ${env.lib_deps}
9384
tobozo/M5Stack-SD-Updater @1.2.5
9485
board_build.partitions = min_spiffs.csv
9586

87+
; For profiling
88+
[env:profile]
89+
board = m5stack-core-esp32
90+
build_type=release
91+
build_flags=${env.build_flags} ${option_debug.build_flags} -DENABLE_PROFILE
92+
93+
; For logging
94+
[env:log]
95+
board = m5stack-core-esp32
96+
build_type=release
97+
build_flags=${env.build_flags} ${option_log.build_flags}
98+
9699
; For debug
97100
[env:debug]
98101
board = m5stack-core-esp32
99102
build_type=debug
100103
build_flags=${env.build_flags} ${option_debug.build_flags} -DENABLE_PROFILE
101104

102105
;----
103-
;For CoreS3
106+
; For CoreS3
104107
[env:S3_release]
105108
board = esp32s3box
106109
board_build.arduino.memory_type = qio_qspi
107110
upload_speed = 1500000
108111
build_type=release
109-
build_flags=${env.build_flags} ${option_release.build_flags} -DENABLE_PROFILE
112+
build_flags=${env.build_flags} ${option_release.build_flags}
110113

111114
[env:S3_release_DisplayModule]
112115
board = esp32s3box
113116
board_build.arduino.memory_type = qio_qspi
114117
upload_speed = 1500000
115118
build_type=release
116-
build_flags=${env.build_flags} ${option_release.build_flags} -DENABLE_PROFILE -DFBSD_ENABLE_DISPLAY_MODULE
119+
build_flags=${env.build_flags} ${option_release.build_flags} -DFBSD_ENABLE_DISPLAY_MODULE
120+
121+
[env:S3_profile]
122+
board = esp32s3box
123+
board_build.arduino.memory_type = qio_qspi
124+
upload_speed = 1500000
125+
build_type=release
126+
build_flags=${env.build_flags} ${option_release.build_flags} -DENABLE_PROFILE
127+
128+
[env:S3_log]
129+
board = esp32s3box
130+
board_build.arduino.memory_type = qio_qspi
131+
upload_speed = 1500000
132+
build_type=release
133+
build_flags=${env.build_flags} ${option_log.build_flags}
117134

118135
[env:S3_debug]
119136
board = esp32s3box
120137
board_build.arduino.memory_type = qio_qspi
121138
upload_speed = 1500000
122139
build_type=debug
123-
build_flags=${env.build_flags} ${option_debug.build_flags} -DENABLE_PROFILE
140+
build_flags=${env.build_flags} ${option_debug.build_flags} -DENABLE_PROFILE

0 commit comments

Comments
 (0)