Skip to content

Commit

Permalink
Revert "Merge pull request #1056 from biigle/moovAtomBug"
Browse files Browse the repository at this point in the history
This reverts commit 6999c17, reversing
changes made to 0965e33.
  • Loading branch information
mzur committed Feb 7, 2025
1 parent 9ae6df4 commit 0184b35
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 132 deletions.
1 change: 0 additions & 1 deletion app/Http/Controllers/Views/Videos/VideoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public function show(Request $request, $id)
'codec' => Video::ERROR_CODEC,
'malformed' => VIDEO::ERROR_MALFORMED,
'too-large' => VIDEO::ERROR_TOO_LARGE,
'moov-atom' => VIDEO::ERROR_INVALID_MOOV_POS,
]);

$fileIds = $volume->orderedFiles()->pluck('uuid', 'id');
Expand Down
20 changes: 0 additions & 20 deletions app/Jobs/ProcessNewVideo.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,6 @@ public function handleFile($file, $path)
return;
}

if ($this->hasInvalidMoovAtomPosition($path)) {
$this->video->error = Video::ERROR_INVALID_MOOV_POS;
$this->video->save();
return;
}

$this->video->size = File::size($path);
$this->video->duration = $this->getVideoDuration($path);

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

protected function hasInvalidMoovAtomPosition($sourcePath)
{
// Webm and mpeg videos don't have a moov atom
if (in_array($this->video->mimeType, ['video/mpeg', 'video/webm'])) {
return false;
}

$process = Process::forever()
->run("ffprobe -v trace -i '{$sourcePath}' 2>&1 | grep -o -e type:\'mdat\' -e type:\'moov\'")
->throw();
$output = explode("\n", $process->output());
return !str_contains($output[0], 'moov');
}

/**
* Extract images from video.
*
Expand Down
7 changes: 0 additions & 7 deletions app/Video.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,6 @@ class Video extends VolumeFile
*/
const ERROR_TOO_LARGE = 5;

/**
* Error if moov atom is not located at beginning.
*
* @var int
*/
const ERROR_INVALID_MOOV_POS = 6;

/**
* The attributes that are mass assignable.
*
Expand Down
6 changes: 0 additions & 6 deletions resources/assets/js/videos/videoContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class VideoMimeTypeError extends VideoError {}
class VideoCodecError extends VideoError {}
class VideoMalformedError extends VideoError {}
class VideoTooLargeError extends VideoError {}
class VideoMoovAtomError extends VideoError {}
// Used to round and parse the video current time from the URL, as it is stored as an int
// there (without decimal dot).
Expand Down Expand Up @@ -159,9 +158,6 @@ export default {
hasTooLargeError() {
return this.error instanceof VideoTooLargeError;
},
hasMoovAtomError() {
return this.error instanceof VideoMoovAtomError;
},
errorClass() {
if (this.hasVideoError) {
if (this.error instanceof VideoNotProcessedError) {
Expand Down Expand Up @@ -542,8 +538,6 @@ export default {
throw new VideoMalformedError();
} else if (video.error === this.errors['too-large']) {
throw new VideoTooLargeError();
} else if (video.error === this.errors['moov-atom']) {
throw new VideoMoovAtomError();
} else if (video.size === null) {
throw new VideoNotProcessedError();
}
Expand Down
8 changes: 0 additions & 8 deletions resources/views/manual/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,6 @@
Advanced configuration of the video annotation tool.
</p>

<h4>
<a href="{{route('manual-tutorials', ['videos', 'fix-video-encoding'])}}">Fix video encoding</a>
</h4>

<p>
Fix errors in video files that can cause problems in BIIGLE.
</p>

<h3>Reports</h3>
<h4>
<a href="{{route('manual-tutorials', ['reports', 'reports-schema'])}}">Reports schema</a>
Expand Down

This file was deleted.

4 changes: 0 additions & 4 deletions resources/views/videos/show/content.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
<span v-if="hasTooLargeError">
The video file is too large.
</span>
<span v-if="hasMoovAtomError">
The video's moov atom position is invalid.<br>
See <a href="{{url("manual/tutorials/videos/fix-video-encoding")}}">the manual</a> for how to fix this.
</span>
</div>
</div>
</div>
Expand Down
Binary file removed tests/files/test_invalid_moov_atom.mp4
Binary file not shown.
35 changes: 0 additions & 35 deletions tests/php/Jobs/ProcessNewVideoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,32 +225,6 @@ public function testHandleRemoveErrorOnSuccess()
$job->handle();
$this->assertNull($video->fresh()->error);
}

public function testHasInvalidMoovAtomPosition()
{
$video = VideoTest::create(['filename' => 'test_invalid_moov_atom.mp4']);
$job = new ProcessNewVideoStub($video);
$job->passThroughMimeType = true;
$job->handle();
$this->assertSame(Video::ERROR_INVALID_MOOV_POS, $video->fresh()->error);
}

public function testHasInvalidMoovAtomPositionNoAtom()
{
$video = VideoTest::create(['filename' => 'test.mp4']);
$job = new ProcessNewVideoStub($video);
$video->mimeType = 'video/webm';
$job->passThroughMimeType = true;
$job->handle();
$this->assertEmpty($video->fresh()->error);

$video = VideoTest::create(['filename' => 'test.mp4']);
$job = new ProcessNewVideoStub($video);
$video->mimeType = 'video/mpeg';
$job->passThroughMimeType = true;
$job->handle();
$this->assertEmpty($video->fresh()->error);
}
}

class ProcessNewVideoStub extends ProcessNewVideo
Expand All @@ -260,7 +234,6 @@ class ProcessNewVideoStub extends ProcessNewVideo
public $duration = 0;
public $passThroughDimensions = false;
public $passThroughCodec = false;
public $passThroughMimeType = false;

protected function getVideoDimensions($url)
{
Expand Down Expand Up @@ -299,12 +272,4 @@ protected function generateThumbnail(string $file, int $width, int $height): Vip
{
return VipsImage::black(100, 100);
}

protected function hasInvalidMoovAtomPosition($source)
{
if ($this->passThroughMimeType) {
return parent::hasInvalidMoovAtomPosition($source);
}
return false;
}
}

0 comments on commit 0184b35

Please sign in to comment.