Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
352 changes: 352 additions & 0 deletions ALTERNATIVE_HYPOTHESIS_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,352 @@
# Alternative Hypothesis Research and Testing Framework

## Overview

This framework provides a systematic approach to evaluating alternative explanations for metadata signatures and compression patterns in surveillance video, moving beyond the assumption that these patterns definitively prove video editing.

## Key Features

- **Systematic Hypothesis Testing**: Rigorous evaluation of competing explanations
- **Statistical Analysis**: Quantitative assessment with confidence intervals and p-values
- **Baseline Comparison**: Comparison with known unedited surveillance footage
- **Bayesian Integration**: Probabilistic combination of multiple evidence sources
- **Comprehensive Research**: Investigation of surveillance system capabilities and limitations

## Framework Components

### 1. Alternative Hypothesis Tester (`alternative_hypothesis_tester.py`)
Main testing framework that evaluates multiple alternative explanations:

- **Hardware Encoding Hypothesis**: Automatic camera encoding adjustments
- **Network Transmission Hypothesis**: Network streaming and transmission effects
- **Storage System Hypothesis**: VMS and storage system processing
- **Environmental Factors Hypothesis**: Scene changes and environmental impacts

### 2. Surveillance System Researcher (`surveillance_system_research.py`)
Research module for investigating surveillance system capabilities:

- Manufacturer documentation research
- Known metadata artifacts investigation
- Adobe software deployment analysis
- Technical capability assessment

### 3. Enhanced Methodology (`enhanced_methodology.md`)
Comprehensive methodology document outlining:

- Systematic hypothesis testing approach
- Statistical analysis framework
- Bayesian evidence integration
- Uncertainty quantification methods

### 4. Validation Suite (`test_alternative_hypotheses.py`)
Comprehensive test suite for validating the framework:

- Known ground truth testing
- Statistical validation
- Performance benchmarking
- Reproducibility testing

## Installation

### Prerequisites

```bash
# System dependencies
sudo apt update
sudo apt install ffmpeg exiftool python3 python3-pip

# For macOS
brew install ffmpeg exiftool python3
```

### Python Dependencies

```bash
# Install framework dependencies
pip install -r alternative_hypothesis_requirements.txt

# Or install core dependencies only
pip install numpy scipy pandas statsmodels scikit-learn matplotlib
```

## Quick Start

### Basic Alternative Hypothesis Testing

```python
from alternative_hypothesis_tester import AlternativeHypothesisTester

# Initialize tester
tester = AlternativeHypothesisTester()

# Run comprehensive analysis
results = tester.run_comprehensive_analysis(
video_path="surveillance_video.mp4",
baseline_videos=["known_unedited_1.mp4", "known_unedited_2.mp4"]
)

# Print results
print(f"Alternative Probability: {results['overall_assessment']['total_alternative_probability']:.3f}")
print(f"Editing Probability: {results['overall_assessment']['editing_probability']:.3f}")
print(f"Conclusion: {results['overall_assessment']['conclusion']}")
```

### Individual Hypothesis Testing

```python
# Test specific hypotheses
hardware_result = tester.test_hardware_encoding_hypothesis("video.mp4")
network_result = tester.test_network_transmission_hypothesis("video.mp4")
storage_result = tester.test_storage_system_hypothesis("video.mp4")
environmental_result = tester.test_environmental_factors_hypothesis("video.mp4")

print(f"Hardware Encoding Probability: {hardware_result.probability:.3f}")
print(f"Network Transmission Probability: {network_result.probability:.3f}")
print(f"Storage Processing Probability: {storage_result.probability:.3f}")
print(f"Environmental Factors Probability: {environmental_result.probability:.3f}")
```

### Surveillance System Research

```python
from surveillance_system_research import SurveillanceSystemResearcher

# Initialize researcher
researcher = SurveillanceSystemResearcher()

# Generate research report
report = researcher.generate_research_report()

print(f"Total Research Findings: {report['research_summary']['total_findings']}")
print(f"Alternative Explanation Strength: {report['alternative_explanation_strength']['overall_strength']}")
```

## Command Line Usage

### Run Complete Analysis

```bash
# Analyze video with baseline comparison
python alternative_hypothesis_tester.py surveillance_video.mp4 baseline1.mp4 baseline2.mp4

# Analyze single video
python alternative_hypothesis_tester.py surveillance_video.mp4
```

### Run Surveillance Research

```bash
# Generate surveillance system research report
python surveillance_system_research.py
```

### Run Validation Tests

```bash
# Run complete validation suite
python test_alternative_hypotheses.py

# Run specific test categories
python -m pytest test_alternative_hypotheses.py::TestAlternativeHypotheses -v
python -m pytest test_alternative_hypotheses.py::TestPerformance -v
```

## Methodology

### Hypothesis Testing Framework

1. **Null Hypothesis (Hβ‚€)**: Observed patterns result from normal surveillance system operations
2. **Alternative Hypothesis (H₁)**: Observed patterns indicate professional video editing
3. **Statistical Testing**: p < 0.05 required to reject null hypothesis
4. **Confidence Assessment**: 95% confidence intervals for all estimates

### Alternative Explanations Evaluated

#### Hardware Factors
- Automatic encoding adjustments based on scene content
- Motion detection triggered encoding changes
- Lighting adaptation effects on compression
- Camera firmware update artifacts

#### Network Effects
- Streaming protocol processing signatures
- Bandwidth adaptation artifacts
- Network storage processing effects
- Transmission delay impacts

#### Storage System Processing
- VMS software processing signatures
- Automatic optimization artifacts
- Backup processing effects
- Legal compliance processing

#### Environmental Factors
- Scene complexity variations
- Lighting change effects
- Motion pattern impacts
- Natural surveillance footage patterns

### Statistical Analysis

- **Probability Assessment**: P(observation | hypothesis) for each alternative
- **Bayesian Integration**: Combined evidence using Bayes' theorem
- **Confidence Intervals**: Uncertainty bounds for all estimates
- **Significance Testing**: Statistical significance at p < 0.05 level

## Output and Results

### Analysis Results Structure

```json
{
"timestamp": "2025-01-13T21:49:00",
"video_path": "surveillance_video.mp4",
"hypothesis_tests": [
{
"name": "Hardware Encoding Adjustments",
"probability": 0.65,
"p_value": 0.12,
"confidence_interval": [0.55, 0.75],
"significant": false,
"evidence": ["Dynamic bitrate changes detected", "Motion correlation found"]
}
],
"overall_assessment": {
"total_alternative_probability": 0.73,
"editing_probability": 0.27,
"conclusion": "Alternative explanations are plausible",
"confidence_assessment": "Low confidence in editing conclusion",
"recommendation": "Additional investigation required"
}
}
```

### Research Report Structure

```json
{
"research_summary": {
"total_findings": 15,
"categories": {
"Hardware Encoding": 5,
"Network Transmission": 3,
"Storage Processing": 4,
"Software Updates": 3
}
},
"alternative_explanation_strength": {
"overall_strength": "moderate",
"strongest_categories": ["Hardware Encoding", "Storage Processing"],
"confidence_level": "medium"
},
"recommendations": [
"Conduct controlled testing with known surveillance systems",
"Obtain baseline metadata from confirmed unedited footage"
]
}
```

## Interpretation Guidelines

### Probability Thresholds

- **High Alternative Probability (> 0.5)**: Alternative explanations are plausible; editing conclusion questionable
- **Moderate Alternative Probability (0.3-0.5)**: Alternative explanations possible; moderate confidence in editing
- **Low Alternative Probability (< 0.3)**: Alternative explanations unlikely; high confidence in editing

### Confidence Assessments

- **High Confidence**: Strong statistical evidence, low alternative probability
- **Moderate Confidence**: Some statistical evidence, moderate alternative probability
- **Low Confidence**: Weak statistical evidence, high alternative probability

### Recommendations

- **Additional Investigation Required**: Alternative probability > 0.5
- **Consider Alternatives**: Alternative probability 0.3-0.5
- **Alternatives Unlikely**: Alternative probability < 0.3

## Validation and Quality Assurance

### Test Coverage

- **Known Ground Truth**: Testing with confirmed edited/unedited videos
- **Statistical Validation**: Verification of statistical methods
- **Reproducibility**: Consistent results across multiple runs
- **Performance**: Analysis completion within reasonable time

### Quality Metrics

- **Accuracy**: Correct classification rate on test cases
- **Precision**: Proportion of positive predictions that are correct
- **Recall**: Proportion of actual positives correctly identified
- **F1-Score**: Harmonic mean of precision and recall

## Limitations and Considerations

### Current Limitations

1. **Limited Baseline Data**: Need more confirmed unedited surveillance footage
2. **Manufacturer Specificity**: Different cameras may have different behaviors
3. **Environmental Variability**: Wide range of possible environmental factors
4. **Implementation Complexity**: Some analyses require specialized expertise

### Future Improvements

1. **Expanded Baseline Database**: Larger collection of confirmed unedited footage
2. **Machine Learning Integration**: Automated pattern recognition
3. **Real-time Analysis**: Streaming analysis capabilities
4. **Expert System Integration**: Knowledge-based reasoning

## Contributing

### Development Setup

```bash
# Clone repository
git clone https://github.com/codegen-sh/forensic-analysis.git
cd forensic-analysis

# Install development dependencies
pip install -r alternative_hypothesis_requirements.txt

# Run tests
python -m pytest test_alternative_hypotheses.py -v

# Run code quality checks
black alternative_hypothesis_tester.py
flake8 alternative_hypothesis_tester.py
mypy alternative_hypothesis_tester.py
```

### Contribution Guidelines

1. **Code Quality**: Follow PEP 8 style guidelines
2. **Testing**: Add tests for new functionality
3. **Documentation**: Update documentation for changes
4. **Validation**: Ensure changes pass validation suite

## License

This project is released under the MIT License. See LICENSE file for details.

## Citation

If you use this framework in research, please cite:

```
Alternative Hypothesis Testing Framework for Forensic Video Analysis
Forensic Analysis Research Team, 2025
https://github.com/codegen-sh/forensic-analysis
```

## Support and Contact

- **Issues**: Report bugs and feature requests on GitHub
- **Documentation**: See enhanced_methodology.md for detailed methodology
- **Research**: See surveillance_system_research.py for research findings

---

*This framework follows established scientific methodology for hypothesis testing and forensic analysis best practices.*

Binary file not shown.
Binary file not shown.
Loading