質問編集履歴
2
試したことの追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -18,9 +18,35 @@
|
|
18
18
|
>>> piexif._exceptions.InvalidImageDataError: Given file is neither JPEG nor TIFF.
|
19
19
|
```
|
20
20
|
|
21
|
+
### 試したこと
|
22
|
+
ffmpyというライブラリを試してみましたが、結果としてタグは取得できませんでした。
|
23
|
+
動画タグに「Dragon」、コメントに「DD」と入れて下記を実行したところ、取得できたのはコメントだけでした。
|
21
24
|
|
25
|
+
```python
|
26
|
+
import subprocess
|
27
|
+
import ffmpy
|
28
|
+
import json
|
29
|
+
from ffmpy import FFprobe
|
22
30
|
|
31
|
+
path = r"任意の動画パス"
|
23
32
|
|
33
|
+
tup_resp = ffmpy.FFprobe(
|
34
|
+
executable=r"***\bin\ffprobe.exe",
|
35
|
+
inputs={path: None},
|
36
|
+
global_options=[
|
37
|
+
'-v', 'quiet',
|
38
|
+
'-print_format', 'json',
|
39
|
+
'-show_format', '-show_streams']
|
40
|
+
).run(stdout=subprocess.PIPE)
|
41
|
+
|
42
|
+
meta = json.loads(tup_resp[0].decode('utf-8'))
|
43
|
+
|
44
|
+
print(meta)
|
45
|
+
>>>{'streams': [{'index': 0, 'codec_name': 'h264', 'codec_long_name': 'H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10', 'profile': 'High', 'codec_type': 'video', 'codec_tag_string': 'avc1', 'codec_tag': '0x31637661', 'width': 1280, 'height': 720, 'coded_width': 1280, 'coded_height': 720, 'closed_captions': 0, 'has_b_frames': 2, 'sample_aspect_ratio': '1:1', 'display_aspect_ratio': '16:9', 'pix_fmt': 'yuv420p', 'level': 31, 'chroma_location': 'left', 'refs': 1, 'is_avc': 'true', 'nal_length_size': '4', 'r_frame_rate': '25/1', 'avg_frame_rate': '25/1', 'time_base': '1/90000', 'start_pts': 0, 'start_time': '0.000000', 'duration_ts': 13327110, 'duration': '148.079000', 'bit_rate': '949626', 'bits_per_raw_sample': '8', 'nb_frames': '3702', 'disposition': {'default': 1, 'dub': 0, 'original': 0, 'comment': 0, 'lyrics': 0, 'karaoke': 0, 'forced': 0, 'hearing_impaired': 0, 'visual_impaired': 0, 'clean_effects': 0, 'attached_pic': 0, 'timed_thumbnails': 0}, 'tags': {'language': 'und', 'handler_name': 'VideoHandler', 'vendor_id': '[0][0][0][0]', 'encoder': 'dailymotion/hls.js'}}, {'index': 1, 'codec_name': 'aac', 'codec_long_name': 'AAC (Advanced Audio Coding)', 'profile': 'LC', 'codec_type': 'audio', 'codec_tag_string': 'mp4a', 'codec_tag': '0x6134706d', 'sample_fmt': 'fltp', 'sample_rate': '44100', 'channels': 2, 'channel_layout': 'stereo', 'bits_per_sample': 0, 'r_frame_rate': '0/0', 'avg_frame_rate': '0/0', 'time_base': '1/44100', 'start_pts': 0, 'start_time': '0.000000', 'duration_ts': 6529005, 'duration': '148.050000', 'bit_rate': '113059', 'nb_frames': '6376', 'disposition': {'default': 1, 'dub': 0, 'original': 0, 'comment': 0, 'lyrics': 0, 'karaoke': 0, 'forced': 0, 'hearing_impaired': 0, 'visual_impaired': 0, 'clean_effects': 0, 'attached_pic': 0, 'timed_thumbnails': 0}, 'tags': {'language': 'und', 'handler_name': 'SoundHandler', 'vendor_id': '[0][0][0][0]'}}], 'format': {'filename': '###任意の動画フルパス###', 'nb_streams': 2, 'nb_programs': 0, 'format_name': 'mov,mp4,m4a,3gp,3g2,mj2', 'format_long_name': 'QuickTime / MOV', 'start_time': '0.000000', 'duration': '148.080000', 'size': '19751188', 'bit_rate': '1067054', 'probe_score': 100, 'tags': {'major_brand': 'mp42', 'minor_version': '0', 'compatible_brands': 'isomiso2avc1mp41mp42', 'comment': 'DD'}}}
|
46
|
+
```
|
47
|
+
|
48
|
+
|
49
|
+
|
24
50
|
### 補足情報(FW/ツールのバージョンなど)
|
25
51
|
Windows10
|
26
52
|
piexif 1.1.3
|
1
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
### 前提・実現したいこと
|
2
2
|
|
3
|
-
Pythonを用いて、**.mp4形式の動画タグを編集**したいのですが、方法がわかりません。
|
3
|
+
Pythonを用いて、**.mp4形式の動画タグ**(以下)を**編集**したいのですが、方法がわかりません。
|
4
4
|
|
5
5
|
画像タグを操作するpiexifでは、下記のように「JPEGとTIFF形式以外は操作できません」というエラーが出てしまいました。
|
6
6
|
動画タグを操作するライブラリないし方法をご存じの方、ご回答よろしくお願いします。
|
7
7
|
|
8
|
+

|
8
9
|
|
9
|
-
|
10
10
|
### 該当のソースコード
|
11
11
|
|
12
12
|
```python
|
@@ -19,6 +19,8 @@
|
|
19
19
|
```
|
20
20
|
|
21
21
|
|
22
|
+
|
23
|
+
|
22
24
|
### 補足情報(FW/ツールのバージョンなど)
|
23
25
|
Windows10
|
24
26
|
piexif 1.1.3
|