Commit Graph

14 Commits

Author SHA1 Message Date
Shouichi Kamiya 35d8890c92 Instrument ActiveStorage analyzers 2021-08-17 16:55:05 +09:00
Breno Gazzola 48a7ec49bf Add metadata value for presence of video channel in video blobs 2021-06-19 09:56:41 -03:00
Breno Gazzola dd85734d2f Add metadata value for presence of audio channel in video blobs 2021-06-09 08:32:18 -03:00
Jonathan Hefner a197d39e13
Fall back to video container for duration
Some video formats, such as WebM, do not store duration information at
the level of the video stream.  Instead, the duration is stored as part
of the container format information.

This commit modifies `VideoAnalyzer` to use the duration from the video
container when the duration from the video stream is not available.

Fixes #40130.
2020-08-31 08:48:06 -04:00
Ryuta Kamizono 559ffacfd9 Revert "Merge pull request #36676 from wjessop/change_activestorage_metadata_duration_to_bound"
This reverts commit a307c697b2, reversing
changes made to f30f76af74.

Reason: This assertion is not failed even without this PR since both
ffprobe versions (3.2.14 and 4.1.3) return the same duration 5.166648
for `video.mp4`.
So there is no need to touch this assertion at this point.
2019-07-17 09:59:03 +09:00
Will Jessop 564fd87b99
Different versions of ffprobe can return subtly different video lengths
Specify a range so we can take this into account, but not get caught out by 0, nil or way too large values.
2019-07-14 14:09:01 +01:00
Ryuta Kamizono 88cbe13741 Fix activestorage CI failure due to ffprove version differece
Our CI environment is upgraded from stretch to buster then ffprove
version is also upgraded from 3.2.14 to 4.1.3.

https://packages.debian.org/stretch/ffmpeg
https://packages.debian.org/buster/ffmpeg

Somehow those ffprove returns different metadata for
`rotated_video.mp4`.

```
$ ffprobe -print_format json -show_streams -v error rotated_video.mp4 > ffprobe41.json
$ diff -ub ffprobe32.json ffprobe41.json
--- ffprobe32.json      2019-07-14 20:02:13.000000000 +0900
+++ ffprobe41.json      2019-07-14 19:59:08.000000000 +0900
@@ -27,8 +27,8 @@
             "time_base": "1/17594",
             "start_pts": 3976,
             "start_time": "0.225986",
-            "duration_ts": 91981,
-            "duration": "5.227975",
+            "duration_ts": 88000,
+            "duration": "5.001705",
             "bit_rate": "321546",
             "bits_per_raw_sample": "8",
             "nb_frames": "44",
@@ -78,8 +78,8 @@
             "time_base": "1/44100",
             "start_pts": 0,
             "start_time": "0.000000",
-            "duration_ts": 227865,
-            "duration": "5.167007",
+            "duration_ts": 227850,
+            "duration": "5.166667",
             "bit_rate": "109732",
             "max_bit_rate": "109732",
             "nb_frames": "223",
```

In the case on the `test "analyzing a rotated video"`, most important
part is `assert_equal 90, metadata[:angle]`, the accidental difference
of duration for ffprove version is out of scope for the test.
2019-07-14 20:06:41 +09:00
Ricardo Díaz 36e0ac3b53 Move #extract_metadata_from to ActiveStorage's TestHelper
ImageAnalyzerTest and VideoAnalyzerTest are defining the same helper,
since both use `#create_file_blob` that is defined in TestHelper, it
makes sense to move `#extract_metadata_from` to that side.
2018-04-25 15:28:30 -05:00
George Claghorn cf1c48478d Cope with videos with undefined display aspect ratios 2018-01-20 14:47:09 -05:00
George Claghorn 9b0c74e878 Use helper method 2018-01-19 18:46:59 -05:00
George Claghorn 2450fc24e3 Preserve display aspect ratio for videos with rectangular samples 2018-01-19 10:47:34 -05:00
George Claghorn c2ba530c43
Extract content types from blob data 2018-01-15 13:06:17 -05:00
George Claghorn da8e0ba03c Swap raw video width and height if angle is 90 or 270 degrees 2017-12-08 13:15:04 -05:00
George Claghorn 605484079d Extract metadata from images and videos 2017-10-22 13:16:59 -04:00