Skip to content

Commit ea98502

Browse files
authored
Merge pull request #1077 from biigle/patch-1
Revert "Merge pull request #1056 from biigle/moovAtomBug"
2 parents 05f65af + 0184b35 commit ea98502

File tree

9 files changed

+0
-132
lines changed

9 files changed

+0
-132
lines changed

app/Http/Controllers/Views/Videos/VideoController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ public function show(Request $request, $id)
6868
'codec' => Video::ERROR_CODEC,
6969
'malformed' => VIDEO::ERROR_MALFORMED,
7070
'too-large' => VIDEO::ERROR_TOO_LARGE,
71-
'moov-atom' => VIDEO::ERROR_INVALID_MOOV_POS,
7271
]);
7372

7473
$fileIds = $volume->orderedFiles()->pluck('uuid', 'id');

app/Jobs/ProcessNewVideo.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,6 @@ public function handleFile($file, $path)
132132
return;
133133
}
134134

135-
if ($this->hasInvalidMoovAtomPosition($path)) {
136-
$this->video->error = Video::ERROR_INVALID_MOOV_POS;
137-
$this->video->save();
138-
return;
139-
}
140-
141135
$this->video->size = File::size($path);
142136
$this->video->duration = $this->getVideoDuration($path);
143137

@@ -233,20 +227,6 @@ protected function getVideoDimensions($url)
233227
return $this->ffprobe->streams($url)->videos()->first()->getDimensions();
234228
}
235229

236-
protected function hasInvalidMoovAtomPosition($sourcePath)
237-
{
238-
// Webm and mpeg videos don't have a moov atom
239-
if (in_array($this->video->mimeType, ['video/mpeg', 'video/webm'])) {
240-
return false;
241-
}
242-
243-
$process = Process::forever()
244-
->run("ffprobe -v trace -i '{$sourcePath}' 2>&1 | grep -o -e type:\'mdat\' -e type:\'moov\'")
245-
->throw();
246-
$output = explode("\n", $process->output());
247-
return !str_contains($output[0], 'moov');
248-
}
249-
250230
/**
251231
* Extract images from video.
252232
*

app/Video.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,6 @@ class Video extends VolumeFile
6868
*/
6969
const ERROR_TOO_LARGE = 5;
7070

71-
/**
72-
* Error if moov atom is not located at beginning.
73-
*
74-
* @var int
75-
*/
76-
const ERROR_INVALID_MOOV_POS = 6;
77-
7871
/**
7972
* The attributes that are mass assignable.
8073
*

resources/assets/js/videos/videoContainer.vue

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ class VideoMimeTypeError extends VideoError {}
2929
class VideoCodecError extends VideoError {}
3030
class VideoMalformedError extends VideoError {}
3131
class VideoTooLargeError extends VideoError {}
32-
class VideoMoovAtomError extends VideoError {}
3332
3433
// Used to round and parse the video current time from the URL, as it is stored as an int
3534
// there (without decimal dot).
@@ -159,9 +158,6 @@ export default {
159158
hasTooLargeError() {
160159
return this.error instanceof VideoTooLargeError;
161160
},
162-
hasMoovAtomError() {
163-
return this.error instanceof VideoMoovAtomError;
164-
},
165161
errorClass() {
166162
if (this.hasVideoError) {
167163
if (this.error instanceof VideoNotProcessedError) {
@@ -542,8 +538,6 @@ export default {
542538
throw new VideoMalformedError();
543539
} else if (video.error === this.errors['too-large']) {
544540
throw new VideoTooLargeError();
545-
} else if (video.error === this.errors['moov-atom']) {
546-
throw new VideoMoovAtomError();
547541
} else if (video.size === null) {
548542
throw new VideoNotProcessedError();
549543
}

resources/views/manual/index.blade.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,6 @@
233233
Advanced configuration of the video annotation tool.
234234
</p>
235235

236-
<h4>
237-
<a href="{{route('manual-tutorials', ['videos', 'fix-video-encoding'])}}">Fix video encoding</a>
238-
</h4>
239-
240-
<p>
241-
Fix errors in video files that can cause problems in BIIGLE.
242-
</p>
243-
244236
<h3>Reports</h3>
245237
<h4>
246238
<a href="{{route('manual-tutorials', ['reports', 'reports-schema'])}}">Reports schema</a>

resources/views/manual/tutorials/videos/fix-video-encoding.blade.php

Lines changed: 0 additions & 51 deletions
This file was deleted.

resources/views/videos/show/content.blade.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@
2020
<span v-if="hasTooLargeError">
2121
The video file is too large.
2222
</span>
23-
<span v-if="hasMoovAtomError">
24-
The video's moov atom position is invalid.<br>
25-
See <a href="{{url("manual/tutorials/videos/fix-video-encoding")}}">the manual</a> for how to fix this.
26-
</span>
2723
</div>
2824
</div>
2925
</div>
-102 KB
Binary file not shown.

tests/php/Jobs/ProcessNewVideoTest.php

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -225,32 +225,6 @@ public function testHandleRemoveErrorOnSuccess()
225225
$job->handle();
226226
$this->assertNull($video->fresh()->error);
227227
}
228-
229-
public function testHasInvalidMoovAtomPosition()
230-
{
231-
$video = VideoTest::create(['filename' => 'test_invalid_moov_atom.mp4']);
232-
$job = new ProcessNewVideoStub($video);
233-
$job->passThroughMimeType = true;
234-
$job->handle();
235-
$this->assertSame(Video::ERROR_INVALID_MOOV_POS, $video->fresh()->error);
236-
}
237-
238-
public function testHasInvalidMoovAtomPositionNoAtom()
239-
{
240-
$video = VideoTest::create(['filename' => 'test.mp4']);
241-
$job = new ProcessNewVideoStub($video);
242-
$video->mimeType = 'video/webm';
243-
$job->passThroughMimeType = true;
244-
$job->handle();
245-
$this->assertEmpty($video->fresh()->error);
246-
247-
$video = VideoTest::create(['filename' => 'test.mp4']);
248-
$job = new ProcessNewVideoStub($video);
249-
$video->mimeType = 'video/mpeg';
250-
$job->passThroughMimeType = true;
251-
$job->handle();
252-
$this->assertEmpty($video->fresh()->error);
253-
}
254228
}
255229

256230
class ProcessNewVideoStub extends ProcessNewVideo
@@ -260,7 +234,6 @@ class ProcessNewVideoStub extends ProcessNewVideo
260234
public $duration = 0;
261235
public $passThroughDimensions = false;
262236
public $passThroughCodec = false;
263-
public $passThroughMimeType = false;
264237

265238
protected function getVideoDimensions($url)
266239
{
@@ -299,12 +272,4 @@ protected function generateThumbnail(string $file, int $width, int $height): Vip
299272
{
300273
return VipsImage::black(100, 100);
301274
}
302-
303-
protected function hasInvalidMoovAtomPosition($source)
304-
{
305-
if ($this->passThroughMimeType) {
306-
return parent::hasInvalidMoovAtomPosition($source);
307-
}
308-
return false;
309-
}
310275
}

0 commit comments

Comments
 (0)