Skip to content

Commit 76b8c2f

Browse files
committed
minor updates - ffmpeg and readme
1 parent fbecb66 commit 76b8c2f

4 files changed

Lines changed: 83 additions & 50 deletions

File tree

Core/setup_ffmpeg.py

Lines changed: 13 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -30,49 +30,24 @@ def setup_ffmpeg():
3030
os.makedirs(bin_dir, exist_ok=True)
3131

3232
if system == "Windows":
33-
ffmpeg_url = "https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full.7z"
34-
ffmpeg_7z_path = os.path.join(bin_dir, "ffmpeg.7z")
35-
36-
seven_zip_archive = os.path.join(bin_dir, "7z-extra.7z")
37-
seven_zip_exe = os.path.join(bin_dir, "7z.exe")
38-
39-
if arch == "64bit":
40-
seven_zip_url = "https://www.7-zip.org/a/7z2301-extra.7z"
41-
else:
42-
seven_zip_url = "https://www.7-zip.org/a/7z2107-extra.7z"
43-
44-
if not os.path.exists(seven_zip_exe):
45-
print("Downloading 7z portable binary...")
46-
download_file(seven_zip_url, seven_zip_archive)
47-
48-
print("Please extract 7z.exe manually from:")
49-
print(f" {seven_zip_archive}")
50-
print(f"To: {bin_dir}")
51-
print("Then rerun this script.")
52-
exit(1)
53-
54-
# Download and extract FFmpeg
55-
if not os.path.exists(ffmpeg_7z_path):
56-
print("Downloading FFmpeg full .7z...")
57-
download_file(ffmpeg_url, ffmpeg_7z_path)
58-
59-
print("Extracting FFmpeg...")
60-
try:
61-
subprocess.run([seven_zip_exe, 'x', ffmpeg_7z_path, f'-o{bin_dir}', '-y'], check=True)
62-
except subprocess.CalledProcessError as e:
63-
print("Error: Failed to extract ffmpeg. Ensure 7z.exe is a valid executable for your system.")
64-
raise e
65-
66-
os.remove(ffmpeg_7z_path)
33+
url = "https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl-shared.zip"
34+
zip_path = os.path.join(bin_dir, "ffmpeg.zip")
35+
download_file(url, zip_path)
36+
extract_zip(zip_path, bin_dir)
37+
os.remove(zip_path)
6738

39+
ffmpeg_exe = None
6840
for root, _, files in os.walk(bin_dir):
6941
if "ffmpeg.exe" in files:
70-
src = os.path.join(root, "ffmpeg.exe")
71-
dst = os.path.join(bin_dir, "ffmpeg.exe")
72-
shutil.copy(src, dst)
73-
print(f"ffmpeg.exe copied to {dst}")
42+
ffmpeg_exe = os.path.join(root, "ffmpeg.exe")
7443
break
7544

45+
if not ffmpeg_exe:
46+
raise RuntimeError("ffmpeg.exe not found after extracting the zip.")
47+
48+
shutil.copy(ffmpeg_exe, os.path.join(bin_dir, "ffmpeg.exe"))
49+
print(f"ffmpeg.exe copied to: {os.path.join(bin_dir, 'ffmpeg.exe')}")
50+
7651
elif system == "Darwin":
7752
url = "https://evermeet.cx/ffmpeg/ffmpeg-7.1.1.zip"
7853
zip_path = os.path.join(bin_dir, "ffmpeg.zip")

README.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Our goal is to support earlier diagnosis of MND and related conditions through a
3535

3636
<p align="center">
3737
<img src="static/images/architecture.png" alt="Product Preview"
38-
style="width: 100%; max-width: 1000px; height: auto; border: 4px ridge #ccc;">
38+
style="width: 800px; max-width: 1000px; height: 415px; border: 4px ridge #ccc;">
3939
</p>
4040

4141

@@ -111,10 +111,22 @@ Follow the steps below to set up and run the Flask application locally:
111111

112112
## Features
113113

114-
- Single video upload
115-
- Bulk video upload
116-
- Live previews
117-
- Fullscreen mode
114+
# Single Video Upload
115+
Upload a single ultrasound video along with its muscle group and probe orientation.
116+
This feature is designed to support large ultrasound files (GB-scale).
117+
118+
A small 1-2 MB test sample video is included for functionality testing purposes.
119+
120+
# Bulk Video Upload via Excel
121+
Upload an entire folder of ultrasound videos using select folder functionality, automatically generate an Excel template, fill in details such as muscle group and probe orientation, and submit it for processing.
122+
This enables batch analysis for high-throughput use cases or larger clinical datasets.
123+
124+
# Live Video Previews & Fasciculation Visualization
125+
After processing, the application provides live previews of all videos.
126+
Detected fasciculations are overlaid in real time, and an interactive graph shows their distribution across the video timeline for easy verification and interpretation.
127+
128+
# Fullscreen Viewing Mode
129+
All processed videos can be expanded to fullscreen, enhancing clarity during analysis and review of subtle fasciculation patterns.
118130

119131

120132

templates/index.html

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ <h2>Single Video Upload</h2>
162162

163163
xhr.open("POST", "/upload", true);
164164
xhr.send(formData);
165+
165166
}
166167

167168
function formatETA(seconds) {
@@ -189,9 +190,8 @@ <h2>Single Video Upload</h2>
189190
} else {
190191
return `${bytes.toFixed(2)} B`;
191192
}
192-
}
193-
194-
193+
194+
}
195195

196196
</script>
197197

@@ -348,13 +348,17 @@ <h2>Bulk Video Upload</h2>
348348
}
349349
};
350350

351-
352351
</script>
352+
<script>
353+
window.addEventListener("pageshow", function (event) {
354+
if (event.persisted || performance.getEntriesByType("navigation")[0].type === "back_forward") {
355+
window.location.reload();
356+
}
357+
});
358+
</script>
359+
353360
<script src="{{ url_for('static', filename='js/config.js') }}"></script>
354361
<script src="{{ url_for('static', filename='js/alert.js') }}"></script>
355362

356-
357-
358363
</body>
359-
360364
</html>

tests/sample_data/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,43 @@
11

2+
## Testing with Sample Excel File
3+
4+
This project includes a utility function that generates a test Excel file with the correct absolute paths to sample video files, helping automate testing.
5+
6+
### How It Works
7+
8+
- The function `get_test_excel_with_correct_paths()` loads a provided Excel template (`test_data_template.xlsx`) containing placeholder paths.
9+
- It replaces the placeholder `"__VIDEO_PATH__"` with the actual absolute path to the sample video file (`test_video.mp4`).
10+
- The updated Excel file is saved as `test_data_generated.xlsx` in the `sample_data` folder.
11+
- This generated Excel file can be used directly for testing the application without manual path edits.
12+
13+
### Manual Testing Instructions
14+
15+
If you want to test the application manually using sample files:
16+
17+
1. Open the Excel template `test_data_template.xlsx` located in the `sample_data` folder.
18+
2. Replace the placeholder paths (e.g., `"__VIDEO_PATH__"`) with the **absolute paths** to your sample video files on your system.
19+
3. Save the Excel file (under a new name if preferred).
20+
4. Provide this edited Excel file to the application as the test input.
21+
22+
This way, the application will correctly locate and process your sample videos during manual testing.
23+
24+
25+
### Note
26+
27+
All test cases and performance validations were executed on a high-specification machine equipped with:
28+
29+
30+
64-bit Windows 11
31+
32+
Intel Core i7 processor
33+
34+
32 GB RAM
35+
36+
SSD storage
37+
38+
Python 3.10+
39+
40+
The application was tested with both small test videos (~1 MB) and large real-world ultrasound files (up to several GBs).
41+
All functionalities — including single and bulk video uploads, Excel integration, real-time previews, and fasciculation detection — were successfully verified and passed across all scenarios.
42+
43+
If any test case fails due to a timeout or resource limit, please retry the operation.

0 commit comments

Comments
 (0)