Opened 12 years ago
Closed 12 years ago
#2299 closed defect (fixed)
-dump_attachment option is poorly documented and/or doesn't work
Reported by: | slhck | Owned by: | |
---|---|---|---|
Priority: | minor | Component: | documentation |
Version: | git-master | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | no |
Description
The FFmpeg documentation gives the following example for dumping attachments from MKV files:
To extract all attachments to files determined by the filename tag: ffmpeg -dump_attachment:t "" INPUT
There are a few confusing points about this example:
-dump_attachment
seems to be a per-file option, and not a global one, so it should come _after_ the input.- The input file would be missing the
-i
option altogether
Because of this, FFmpeg just overwrites and empties the input file when using the above command.
Here's an example with an attachment created with mkvmerge
:
mkvmerge -o out.mkv -A in.mp4 \ --attachment-description "Test Attachment" \ --attachment-mime-type image/jpeg \ --attach-file out.jpg mkvmerge v5.0.1 ('Es ist Sommer') built on Jul 30 2012 19:32:42 'in.mp4': Using the Quicktime/MP4 demultiplexer. 'in.mp4' track 1: Using the MPEG-4 part 10 (AVC) video output module. The file 'out.mkv' has been opened for writing. 'in.mp4' track 1: Extracted the aspect ratio information from the MPEG-4 layer 10 (AVC) video data and set the display dimensions to 1280/720. Progress: 100% The cue entries (the index) are being written... Muxing took 0 seconds.
Checking whether the file really contains an attachment:
mkvmerge -i out.mkv File 'out.mkv': container: Matroska Track ID 1: video (V_MPEG4/ISO/AVC) Attachment ID 1: type 'image/jpeg', size 45690 bytes, description 'Test Attachment', file name 'out.jpg'
Then, with FFmpeg:
ffmpeg -dump_attachment:t "" out.mkv ffmpeg version 1.1.2 Copyright (c) 2000-2013 the FFmpeg developers built on Feb 8 2013 22:55:29 with Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn) configuration: --prefix=/usr/local/Cellar/ffmpeg/1.1.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --cc=cc --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-aacenc --enable-ffplay --enable-libfdk-aac --enable-libopus --enable-libopenjpeg --extra-cflags='-I/usr/local/Cellar/openjpeg/1.5.1/include/openjpeg-1.5 ' libavutil 52. 13.100 / 52. 13.100 libavcodec 54. 86.100 / 54. 86.100 libavformat 54. 59.106 / 54. 59.106 libavdevice 54. 3.102 / 54. 3.102 libavfilter 3. 32.100 / 3. 32.100 libswscale 2. 1.103 / 2. 1.103 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 File 'out.mkv' already exists. Overwrite ? [y/N]
Naturally, pressing y
here would just overwrite the file and do nothing.
This also doesn't work, as a per-file option. It doesn't dump the attachment.
ffmpeg -i out.mkv -dump_attachment "" -c copy out2.mkv ffmpeg version 1.1.2 Copyright (c) 2000-2013 the FFmpeg developers built on Feb 8 2013 22:55:29 with Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn) configuration: --prefix=/usr/local/Cellar/ffmpeg/1.1.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --cc=cc --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-aacenc --enable-ffplay --enable-libfdk-aac --enable-libopus --enable-libopenjpeg --extra-cflags='-I/usr/local/Cellar/openjpeg/1.5.1/include/openjpeg-1.5 ' libavutil 52. 13.100 / 52. 13.100 libavcodec 54. 86.100 / 54. 86.100 libavformat 54. 59.106 / 54. 59.106 libavdevice 54. 3.102 / 54. 3.102 libavfilter 3. 32.100 / 3. 32.100 libswscale 2. 1.103 / 2. 1.103 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 Input #0, matroska,webm, from 'out.mkv': Metadata: creation_time : 2013-02-23 14:22:56 Duration: 00:03:31.48, start: 0.000000, bitrate: 2232 kb/s Stream #0:0(eng): Video: h264 (High), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1k tbn, 50 tbc (default) Stream #0:1: Attachment: mjpeg Metadata: filename : out.jpg mimetype : image/jpeg Output #0, matroska, to 'out2.mkv': Metadata: encoder : Lavf54.59.106 Stream #0:0(eng): Video: h264 (H264 / 0x34363248), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 1k tbn, 1k tbc (default) Stream mapping: Stream #0:0 -> #0:0 (copy) Press [q] to stop, [?] for help frame= 5287 fps=0.0 q=-1.0 Lsize= 57601kB time=00:03:31.36 bitrate=2232.5kbits/s video:57559kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.071764%
Note:
- In the above examples, substituting
-dump_attachment:t
for-dump_attachment
doesn't make a difference. - The defect is the same in the Git master head.
Change History (3)
follow-up: 2 comment:1 by , 12 years ago
Component: | FFmpeg → documentation |
---|---|
Priority: | normal → minor |
Reproduced by developer: | set |
Status: | new → open |
comment:2 by , 12 years ago
Replying to cehoyos:
http://ffmpeg.org/ffmpeg.html#Main-options
Patch sent, try "ffmpeg -dump_attachment:t "" -i out.mkv"
Yes, this does the job just fine. Thank you!
The only remaining issue is that there's no indicator of a successful command here—FFmpeg will still say that no output file has been specified and you'll have to look in your folder for the written attachments. Maybe it could be a little more verbose?
http://ffmpeg.org/ffmpeg.html#Main-options
Patch sent, try "ffmpeg -dump_attachment:t "" -i out.mkv"