これはこの質問に多少似ていますが、もう少し複雑です。 FFMPEGを使用してメタデータをあるファイルから別のファイルにコピーする
私は2つのビデオを持っています。
ビデオ1からのすべての非ビデオストリームを新しいビデオにコピーすることができます(ビデオストリーム0以外のすべて)。ビデオ2のビデオストリーム(Stream 0)のビデオストリームのみが新しいファイルにコピーされます。これが理にかなっていることを願っています。
私はAfter Effectsで生の映像を修正し、これをすべての元のメタデータでエクスポートしたいと思います。
これは実際のソースファイル...または入力0 ...の詳細です。
Metadata:
major_brand : mp41
minor_version : 538120216
compatible_brands: mp41
creation_time : 2019-08-18T12:27:46.000000Z
firmware : FS1.04.01.80.00
Duration: 00:07:00.42, start: 0.000000, bitrate: 45287 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 2704x2624 [SAR 1:1 DAR 169:164], 44954 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
Metadata:
creation_time : 2019-08-18T12:27:46.000000Z
handler_name : GoPro AVC
encoder : GoPro AVC encoder
timecode : 12:52:47:11
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
creation_time : 2019-08-18T12:27:46.000000Z
handler_name : GoPro AAC
timecode : 12:52:47:11
Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
Metadata:
creation_time : 2019-08-18T12:27:46.000000Z
handler_name : GoPro TCD
timecode : 12:52:47:11
Stream #0:3(eng): Data: none (gpmd / 0x646D7067), 184 kb/s (default)
Metadata:
creation_time : 2019-08-18T12:27:46.000000Z
handler_name : GoPro MET
Stream #0:4(eng): Data: none (fdsc / 0x63736466), 9 kb/s (default)
Metadata:
creation_time : 2019-08-18T12:27:46.000000Z
handler_name : GoPro SOS
_
編集:コメントごと、そして微調整の後に更新されました。現在、このスクリプトを使用して2つの入力ファイルを新しいファイルにマージしています。私たちの目標と期待は、メタデータとストリームをマッピングした後、私たちはソースビデオとほぼ同じであったファイルになります。
私たちが使用しているSHファイルです。
ffmpeg -i GF120010.source.MP4 -i GF120010.fixed.MP4 -copy_unknown -map_metadata 0 -c copy -tag:d:1 'gpmd' -tag:d:2 'gpmd' -map 1:v -metadata:s:v: handler=' GoPro AVC' -map 0:a -metadata:s:a: handler=' GoPro AAC' -map 0:m:handler_name:' GoPro TCD' -metadata:s:d:0 handler=' GoPro TCD' -map 0:m:handler_name:' GoPro MET' -metadata:s:d:1 handler=' GoPro MET' -map 0:m:handler_name:' GoPro SOS' -metadata:s:d:2 handler=' GoPro SOS' GF120010.mp4
_
このスクリプトを実行した後の出力は次のとおりです。
built with gcc 7.3.1 (GCC) 20180722
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
libavutil 56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100
libpostproc 55. 1.100 / 55. 1.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002577f72b740] Using non-standard frame rate 29/1
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'GF120010.source.MP4':
Metadata:
major_brand : mp41
minor_version : 538120216
compatible_brands: mp41
creation_time : 2019-08-18T12:27:46.000000Z
firmware : FS1.04.01.80.00
Duration: 00:07:00.42, start: 0.000000, bitrate: 45287 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 2704x2624 [SAR 1:1 DAR 169:164], 44954 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
Metadata:
creation_time : 2019-08-18T12:27:46.000000Z
handler_name : GoPro AVC
encoder : GoPro AVC encoder
timecode : 12:52:47:11
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
creation_time : 2019-08-18T12:27:46.000000Z
handler_name : GoPro AAC
timecode : 12:52:47:11
Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
Metadata:
creation_time : 2019-08-18T12:27:46.000000Z
handler_name : GoPro TCD
timecode : 12:52:47:11
Stream #0:3(eng): Data: none (gpmd / 0x646D7067), 184 kb/s (default)
Metadata:
creation_time : 2019-08-18T12:27:46.000000Z
handler_name : GoPro MET
Stream #0:4(eng): Data: none (fdsc / 0x63736466), 9 kb/s (default)
Metadata:
creation_time : 2019-08-18T12:27:46.000000Z
handler_name : GoPro SOS
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'GF120010.fixed.MP4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41
creation_time : 2019-08-25T01:14:49.000000Z
Duration: 00:07:00.46, start: 0.000000, bitrate: 50357 kb/s
Stream #1:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 2704x2624, 50040 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
Metadata:
creation_time : 2019-08-25T01:14:50.000000Z
handler_name : Alias Data Handler
encoder : AVC Coding
Stream #1:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 317 kb/s (default)
Metadata:
creation_time : 2019-08-25T01:14:54.000000Z
handler_name : Alias Data Handler
File 'GF120010.mp4' already exists. Overwrite ? [y/N] y
Output #0, mp4, to 'GF120010.mp4':
Metadata:
major_brand : mp41
minor_version : 538120216
compatible_brands: mp41
creation_time : 2019-08-18T12:27:46.000000Z
firmware : FS1.04.01.80.00
encoder : Lavf58.12.100
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 2704x2624, q=2-31, 50040 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 30k tbc (default)
Metadata:
creation_time : 2019-08-25T01:14:50.000000Z
handler_name : Alias Data Handler
encoder : AVC Coding
handler : GoPro AVC
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
creation_time : 2019-08-18T12:27:46.000000Z
handler_name : GoPro AAC
timecode : 12:52:47:11
handler : GoPro AAC
Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
Metadata:
creation_time : 2019-08-18T12:27:46.000000Z
handler_name : GoPro TCD
timecode : 12:52:47:11
handler : GoPro TCD
Stream #0:3(eng): Data: none (gpmd / 0x646D7067), 184 kb/s (default)
Metadata:
creation_time : 2019-08-18T12:27:46.000000Z
handler_name : GoPro MET
handler : GoPro MET
Stream #0:4(eng): Data: none (gpmd / 0x646D7067), 9 kb/s (default)
Metadata:
creation_time : 2019-08-18T12:27:46.000000Z
handler_name : GoPro SOS
handler : GoPro SOS
Stream mapping:
Stream #1:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Stream #0:2 -> #0:2 (copy)
Stream #0:3 -> #0:3 (copy)
Stream #0:4 -> #0:4 (copy)
Press [q] to stop, [?] for help
frame=12600 fps=696 q=-1.0 Lsize= 2585057kB time=00:07:00.39 bitrate=50373.6kbits/s speed=23.2x
video:2568126kB audio:6569kB subtitle:0kB other streams:10000kB global headers:0kB muxing overhead: 0.014028%
_
出力後、これは新しく生成されたMP4についてFFMPEGが示すものです
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 2019-08-18T12:27:46.000000Z
encoder : Lavf58.12.100
Duration: 00:07:00.42, start: 0.000000, bitrate: 50370 kb/s
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 2704x2624, 50040 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
Metadata:
creation_time : 2019-08-18T12:27:46.000000Z
handler_name : GoPro AVC
timecode : 12:52:47:11
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
creation_time : 2019-08-18T12:27:46.000000Z
handler_name : GoPro AAC
Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
Metadata:
creation_time : 2019-08-18T12:27:46.000000Z
handler_name : GoPro TCD
timecode : 12:52:47:11
Stream #0:3(eng): Data: none (gpmd / 0x646D7067), 184 kb/s (default)
Metadata:
creation_time : 2019-08-18T12:27:46.000000Z
handler_name : GoPro MET
Stream #0:4(eng): Data: none (gpmd / 0x646D7067), 9 kb/s (default)
Metadata:
creation_time : 2019-08-18T12:27:46.000000Z
handler_name : GoPro SOS
_
Exiftoolを使用して、これらはFFMPEGエクスポートされたMP4の詳細です。
[System] FileName : GF120010.mp4
[System] Directory : .
[System] FileSize : 2.5 GB
[System] FileModifyDate : 2019:08:27 20:54:28-05:00
[System] FileAccessDate : 2019:08:27 20:54:28-05:00
[System] FileCreateDate : 2019:08:19 12:12:48-05:00
[System] FilePermissions : rw-rw-rw-
[File] FileType : MP4
[File] FileTypeExtension : mp4
[File] MIMEType : video/mp4
[QuickTime] MajorBrand : MP4 Base Media v1 [IS0 14496-12:2003]
[QuickTime] MinorVersion : 0.2.0
[QuickTime] CompatibleBrands : isom, iso2, avc1, mp41
[QuickTime] MovieDataSize : 2646726722
[QuickTime] MovieDataOffset : 48
[QuickTime] MovieHeaderVersion : 0
[QuickTime] CreateDate : 2019:08:18 12:27:46
[QuickTime] ModifyDate : 2019:08:18 12:27:46
[QuickTime] TimeScale : 1000
[QuickTime] Duration : 0:07:00
[QuickTime] PreferredRate : 1
[QuickTime] PreferredVolume : 100.00%
[QuickTime] MatrixStructure : 1 0 0 0 1 0 0 0 1
[QuickTime] PreviewTime : 0 s
[QuickTime] PreviewDuration : 0 s
[QuickTime] PosterTime : 0 s
[QuickTime] SelectionTime : 0 s
[QuickTime] SelectionDuration : 0 s
[QuickTime] CurrentTime : 0 s
[QuickTime] NextTrackID : 6
[QuickTime] HandlerType : Metadata
[QuickTime] HandlerVendorID : Apple
[Track1] TrackHeaderVersion : 0
[Track1] TrackCreateDate : 2019:08:18 12:27:46
[Track1] TrackModifyDate : 2019:08:18 12:27:46
[Track1] TrackID : 1
[Track1] TrackDuration : 0:07:00
[Track1] TrackLayer : 0
[Track1] TrackVolume : 0.00%
[Track1] MatrixStructure : 1 0 0 0 1 0 0 0 1
[Track1] ImageWidth : 2704
[Track1] ImageHeight : 2624
[Track1] TimeCode : 3
[Track1] MediaHeaderVersion : 0
[Track1] MediaCreateDate : 2019:08:18 12:27:46
[Track1] MediaModifyDate : 2019:08:18 12:27:46
[Track1] MediaTimeScale : 30000
[Track1] MediaDuration : 0:07:00
[Track1] MediaLanguageCode : eng
[Track1] HandlerType : Video Track
[Track1] HandlerDescription : GoPro AVC
[Track1] GraphicsMode : srcCopy
[Track1] OpColor : 0 0 0
[Track1] CompressorID : avc1
[Track1] SourceImageWidth : 2704
[Track1] SourceImageHeight : 2624
[Track1] XResolution : 72
[Track1] YResolution : 72
[Track1] BitDepth : 24
[Track1] VideoFrameRate : 29.97
[Track2] TrackHeaderVersion : 0
[Track2] TrackCreateDate : 2019:08:18 12:27:46
[Track2] TrackModifyDate : 2019:08:18 12:27:46
[Track2] TrackID : 2
[Track2] TrackDuration : 0:07:00
[Track2] TrackLayer : 0
[Track2] TrackVolume : 100.00%
[Track2] MatrixStructure : 1 0 0 0 1 0 0 0 1
[Track2] MediaHeaderVersion : 0
[Track2] MediaCreateDate : 2019:08:18 12:27:46
[Track2] MediaModifyDate : 2019:08:18 12:27:46
[Track2] MediaTimeScale : 48000
[Track2] MediaDuration : 0:07:00
[Track2] MediaLanguageCode : eng
[Track2] HandlerType : Audio Track
[Track2] HandlerDescription : GoPro AAC
[Track2] Balance : 0
[Track2] AudioFormat : mp4a
[Track2] AudioChannels : 2
[Track2] AudioBitsPerSample : 16
[Track2] AudioSampleRate : 48000
[Track3] TrackHeaderVersion : 0
[Track3] TrackCreateDate : 2019:08:18 12:27:46
[Track3] TrackModifyDate : 2019:08:18 12:27:46
[Track3] TrackID : 3
[Track3] TrackDuration : 0:07:00
[Track3] TrackLayer : 0
[Track3] TrackVolume : 0.00%
[Track3] MatrixStructure : 1 0 0 0 1 0 0 0 1
[Track3] MediaHeaderVersion : 0
[Track3] MediaCreateDate : 2019:08:18 12:27:46
[Track3] MediaModifyDate : 2019:08:18 12:27:46
[Track3] MediaTimeScale : 29
[Track3] MediaDuration : 0:07:00
[Track3] MediaLanguageCode : eng
[Track3] HandlerType : Time Code
[Track3] HandlerDescription : GoPro TCD
[Track3] OtherFormat : tmcd
[Track4] TrackHeaderVersion : 0
[Track4] TrackCreateDate : 2019:08:18 12:27:46
[Track4] TrackModifyDate : 2019:08:18 12:27:46
[Track4] TrackID : 4
[Track4] TrackDuration : 0:07:00
[Track4] TrackLayer : 0
[Track4] TrackVolume : 0.00%
[Track4] MatrixStructure : 1 0 0 0 1 0 0 0 1
[Track4] MediaHeaderVersion : 0
[Track4] MediaCreateDate : 2019:08:18 12:27:46
[Track4] MediaModifyDate : 2019:08:18 12:27:46
[Track4] MediaTimeScale : 1000
[Track4] MediaDuration : 0:07:00
[Track4] MediaLanguageCode : eng
[Track4] HandlerType : NRT Metadata
[Track4] HandlerDescription : GoPro MET
[Track4] GenMediaVersion : 0
[Track4] GenFlags : 0 0 0
[Track4] GenGraphicsMode : ditherCopy
[Track4] GenOpColor : 32768 32768 32768
[Track4] GenBalance : 0
[Track4] MetaFormat : gpmd
[Track4] Warning : [minor] The ExtractEmbedded option may find more tags in the movie data
[Track5] TrackHeaderVersion : 0
[Track5] TrackCreateDate : 2019:08:18 12:27:46
[Track5] TrackModifyDate : 2019:08:18 12:27:46
[Track5] TrackID : 5
[Track5] TrackDuration : 0:07:00
[Track5] TrackLayer : 0
[Track5] TrackVolume : 0.00%
[Track5] MatrixStructure : 1 0 0 0 1 0 0 0 1
[Track5] MediaHeaderVersion : 0
[Track5] MediaCreateDate : 2019:08:18 12:27:46
[Track5] MediaModifyDate : 2019:08:18 12:27:46
[Track5] MediaTimeScale : 90000
[Track5] MediaDuration : 0:07:00
[Track5] MediaLanguageCode : eng
[Track5] HandlerType : NRT Metadata
[Track5] HandlerDescription : GoPro SOS
[Track5] GenMediaVersion : 0
[Track5] GenFlags : 0 0 0
[Track5] GenGraphicsMode : ditherCopy
[Track5] GenOpColor : 32768 32768 32768
[Track5] GenBalance : 0
[Track5] MetaFormat : gpmd
[ItemList] Encoder : Lavf58.12.100
[Composite] ImageSize : 2704x2624
[Composite] Megapixels : 7.1
[Composite] AvgBitrate : 50.4 Mbps
[Composite] Rotation : 0
_
後続の読者のためのメモ - 最新のバージョンのFFMPEGは、少なくともWindows上で、オッカーよりも悪い場合があります。
フュージョンビデオのコマンドを実行するときは、最新のFFMPEG(4.2.1およびLighly Builds)。この:
ffmpeg -i GOPR5687.MP4 -map 0 -copy_unknown -map_metadata 0 \
-c copy -c:v h264 -crf 22 output.mp4
_
(またはトピックのスターターによって言及されたコマンド)は私にこれを与えます:
Could not find tag for codec none in stream #2, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
_
私はそれを解読しようとしている2日間を過ごしました: - /そしてついに私はしました。バージョン4.0.2(Windows Workの32と64のバージョンの両方)を使用したときにすべて機能し始めました。ホーム!
また、具体的にはGopro Videosのために、ここで説明されているハンドラ名にはスタータータブの問題があります。 http://coderunner.io/how-to-compress-gopro-movies-and-keep-metadata/ =