[FFmpeg-user] Read Exif from file processed by FFMPEG

Francois Visagie francois.visagie at gmail.com
Mon Jun 30 08:29:49 CEST 2014


> -----Original Message-----
> From: ffmpeg-user-bounces at ffmpeg.org [mailto:ffmpeg-user-
> bounces at ffmpeg.org] On Behalf Of Eugene Gekhter
> Sent: 30 June 2014 04:35
> To: FFmpeg user questions
> Subject: [FFmpeg-user] Read Exif from file processed by FFMPEG
> 
> This might fall into the realm of extreme specificity, but I encountered a
very
> large discrepancy in performance when reading files generated by FFMPEG
> and wanted to see if anybody had observed similar behavior in their
> experience.
> 
> Situation:
> Reading exif metadata from video files using exiftool for PHP.
> 
> Setup:
> Version A: Original MTS file from camcorder (~ 2.5 minutes) Version B:
> FFMPEG version of file (ffmpeg -i
> /Volumes/16GB/PRIVATE/AVCHD/BDMV/STREAM/00013.MTS -c copy
> ~/Desktop/00013F.MTS)
> Both versions are in same SSD folder (for unbiased performance readings)
> 
> Result: Time to read exif data from file (seconds):
> Version A : 0.49976897239685
> Version B: 17.803021192551
> 
> Here's the code I'm using for reading and timing:
> $logger = new \Monolog\Logger('exiftool');
> 
>         $start = microtime(true);
> 
>         $reader = \PHPExiftool\Reader::create($logger);
>         $file = "/Users/eugenegekhter/Desktop/00013.MTS";
>         $metadatas = $reader->files($file)->first();
> 
>         foreach ($metadatas as $metadata)
>         {
>             var_dump($metadata);
>         }
> 
>         $time_elapsed_us = microtime(true) - $start;
> 
>         var_dump($time_elapsed_us);
> 
> Here's ffprobe of original file:
> 
> ffprobe version N-64124-g84de3ed Copyright (c) 2007-2014 the FFmpeg
> developers
> 
>   built on Jun 21 2014 17:13:02 with Apple LLVM version 5.1
> (clang-503.0.40) (based on LLVM 3.4svn)
> 
>   configuration: --prefix=/Users/eugenegekhter/ffmpeg_build
> --extra-cflags=-I/Users/eugenegekhter/ffmpeg_build/include
> --extra-ldflags=-L/Users/eugenegekhter/ffmpeg_build/lib
> --bindir=/Users/eugenegekhter/bin --extra-libs=-ldl --enable-gpl --enable-
> libfdk-aac --enable-libx264 --enable-nonfree
> 
>   libavutil      52. 90.100 / 52. 90.100
> 
>   libavcodec     55. 68.100 / 55. 68.100
> 
>   libavformat    55. 44.100 / 55. 44.100
> 
>   libavdevice    55. 13.101 / 55. 13.101
> 
>   libavfilter     4.  9.100 /  4.  9.100
> 
>   libswscale      2.  6.100 /  2.  6.100
> 
>   libswresample   0. 19.100 /  0. 19.100
> 
>   libpostproc    52.  3.100 / 52.  3.100
> 
> Input #0, mpegts, from '/Users/eugenegekhter/Desktop/00013.MTS':
> 
>   Duration: 00:02:40.19, start: 0.382589, bitrate: 25334 kb/s
> 
>   Program 1
> 
>     Stream #0:0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448), yuv420p,
> 1920x1080 [SAR 1:1 DAR 16:9], 59.94 fps, 59.94 tbr, 90k tbn, 119.88 tbc
> 
>     Stream #0:1[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz,
5.1(side),
> fltp, 384 kb/s
> 
>     Stream #0:2[0x1200]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] /
0x0090),
> 1920x1080
> 
> 
> And probe of filed generated via ffmpeg copy command:
> 
> ffprobe version N-64124-g84de3ed Copyright (c) 2007-2014 the FFmpeg
> developers
> 
>   built on Jun 21 2014 17:13:02 with Apple LLVM version 5.1
> (clang-503.0.40) (based on LLVM 3.4svn)
> 
>   configuration: --prefix=/Users/eugenegekhter/ffmpeg_build
> --extra-cflags=-I/Users/eugenegekhter/ffmpeg_build/include
> --extra-ldflags=-L/Users/eugenegekhter/ffmpeg_build/lib
> --bindir=/Users/eugenegekhter/bin --extra-libs=-ldl --enable-gpl --enable-
> libfdk-aac --enable-libx264 --enable-nonfree
> 
>   libavutil      52. 90.100 / 52. 90.100
> 
>   libavcodec     55. 68.100 / 55. 68.100
> 
>   libavformat    55. 44.100 / 55. 44.100
> 
>   libavdevice    55. 13.101 / 55. 13.101
> 
>   libavfilter     4.  9.100 /  4.  9.100
> 
>   libswscale      2.  6.100 /  2.  6.100
> 
>   libswresample   0. 19.100 /  0. 19.100
> 
>   libpostproc    52.  3.100 / 52.  3.100
> 
> Input #0, mpegts, from '/Users/eugenegekhter/Desktop/00013F.MTS':
> 
>   Duration: 00:02:40.19, start: 1.416678, bitrate: 26022 kb/s
> 
>   Program 1
> 
>     Metadata:
> 
>       service_name    : Service01
> 
>       service_provider: FFmpeg
> 
>     Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B),
yuv420p,
> 1920x1080 [SAR 1:1 DAR 16:9], 59.94 fps, 59.94 tbr, 90k tbn,
> 119.88 tbc
> 
>     Stream #0:1[0x101]: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz,
> 5.1(side), fltp, 384 kb/s
> 
> 
> If anybody has any input that would be greatly appreciated.

I'm not familiar with the script language you're using, but it seems you're
calling exiftool without command-line arguments, correct? In that case, it
won't scan the file for each frame but will only collect container-level
information.

Seeing that the ffmpeg-muxed version takes so much longer to analyse, my
guess would be that the ffmpeg muxer moves some container-level information
to the end of the stream.

Pending the absence of any more authorative explanations, perhaps you could
try with files of different durations (other parameters remaining the same)
to test this idea.

> 
> 
> Thanks,
> 
> 
> 
> *Eugene Gekhter* / CEO
> 
> (847) 272-8207/ egekhter at pixcel.com
> *Pixcel* Office: (800) 557-3508
> 3336 Commercial Ave. / Northbrook, IL 60062 http://www.pixcel.com
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user



More information about the ffmpeg-user mailing list