mirror of
https://github.com/ente-io/ente.git
synced 2025-08-07 23:18:10 +00:00
[mob] Expose and log video metadata
This commit is contained in:
parent
d3dccb1bea
commit
c941783fd3
@ -1,5 +1,7 @@
|
||||
// Adapted from: https://github.com/deckerst/aves
|
||||
|
||||
import "dart:developer";
|
||||
|
||||
import "package:collection/collection.dart";
|
||||
import "package:intl/intl.dart";
|
||||
import "package:photos/models/ffmpeg/channel_layouts.dart";
|
||||
@ -128,6 +130,12 @@ class FFProbeProps {
|
||||
required this.xiaomiSlowMoment,
|
||||
});
|
||||
|
||||
// toString() method
|
||||
@override
|
||||
String toString() {
|
||||
return 'FFProbeProps(captureFps: $captureFps, androidManufacturer: $androidManufacturer, androidModel: $androidModel, androidVersion: $androidVersion, bitRate: $bitRate, bitsPerRawSample: $bitsPerRawSample, byteCount: $byteCount, channelLayout: $channelLayout, chromaLocation: $chromaLocation, codecName: $codecName, codecPixelFormat: $codecPixelFormat, codedHeight: $codedHeight, codedWidth: $codedWidth, colorPrimaries: $colorPrimaries, colorRange: $colorRange, colorSpace: $colorSpace, colorTransfer: $colorTransfer, colorProfile: $colorProfile, compatibleBrands: $compatibleBrands, creationTime: $creationTime, displayAspectRatio: $displayAspectRatio, date: $date, duration: $duration, durationMicros: $durationMicros, extraDataSize: $extraDataSize, fieldOrder: $fieldOrder, fpsDen: $fpsDen, frameCount: $frameCount, handlerName: $handlerName, hasBFrames: $hasBFrames, height: $height, language: $language, location: $location, majorBrand: $majorBrand, mediaFormat: $mediaFormat, mediaType: $mediaType, minorVersion: $minorVersion, nalLengthSize: $nalLengthSize, quicktimeLocationAccuracyHorizontal: $quicktimeLocationAccuracyHorizontal, rFrameRate: $rFrameRate, rotate: $rotate, sampleFormat: $sampleFormat, sampleRate: $sampleRate, sampleAspectRatio: $sampleAspectRatio, sarDen: $sarDen, segmentCount: $segmentCount, sourceOshash: $sourceOshash, startMicros: $startMicros, startPts: $startPts, startTime: $startTime, statisticsWritingApp: $statisticsWritingApp, statisticsWritingDateUtc: $statisticsWritingDateUtc, timeBase: $timeBase, track: $track, vendorId: $vendorId, width: $width, xiaomiSlowMoment: $xiaomiSlowMoment)';
|
||||
}
|
||||
|
||||
factory FFProbeProps.fromJson(Map<dynamic, dynamic>? json) {
|
||||
return FFProbeProps(
|
||||
captureFps:
|
||||
|
@ -1,4 +1,5 @@
|
||||
import "dart:async";
|
||||
import "dart:developer";
|
||||
import "dart:io";
|
||||
|
||||
import "package:exif/exif.dart";
|
||||
@ -110,6 +111,7 @@ class _FileDetailsWidgetState extends State<FileDetailsWidget> {
|
||||
final File? originFile = await getFile(widget.file, isOrigin: true);
|
||||
if (originFile == null) return;
|
||||
final session = await FFprobeKit.getMediaInformation(originFile.path);
|
||||
|
||||
final mediaInfo = session.getMediaInformation();
|
||||
|
||||
if (mediaInfo == null) {
|
||||
@ -120,8 +122,13 @@ class _FileDetailsWidgetState extends State<FileDetailsWidget> {
|
||||
);
|
||||
return;
|
||||
}
|
||||
//todo:(neeraj) Use probe data for back filling location
|
||||
final _ = await FFProbeUtil.getProperties(mediaInfo);
|
||||
final properties = await FFProbeUtil.getProperties(mediaInfo);
|
||||
final parsedMetadata = await FFProbeUtil.getMetadata(mediaInfo);
|
||||
|
||||
// print all the properties
|
||||
log("videoCustomProps ${properties.toString()}");
|
||||
log("videoMetadata ${parsedMetadata.toString()}");
|
||||
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ class FFProbeUtil {
|
||||
static Future<FFProbeProps> getProperties(
|
||||
MediaInformation mediaInformation,
|
||||
) async {
|
||||
final properties = await _getMetadata(mediaInformation);
|
||||
final properties = await getMetadata(mediaInformation);
|
||||
|
||||
try {
|
||||
return FFProbeProps.fromJson(properties);
|
||||
@ -28,7 +28,7 @@ class FFProbeUtil {
|
||||
}
|
||||
}
|
||||
|
||||
static Future<Map> _getMetadata(MediaInformation information) async {
|
||||
static Future<Map> getMetadata(MediaInformation information) async {
|
||||
final props = information.getAllProperties();
|
||||
if (props == null) return {};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user