質問編集履歴

5

補足

2021/06/29 06:38

投稿

joru
joru

スコア45

test CHANGED
File without changes
test CHANGED
@@ -26,13 +26,17 @@
26
26
 
27
27
  movie_url = "https:/・・・"
28
28
 
29
- local = File.new(open(movie_url))
29
+ p local = File.new(open(movie_url))
30
+
31
+ p local.size
30
32
 
31
33
  movie = FFMPEG::Movie.new(local.path)
32
34
 
33
35
  movie.transcode("tmp/movie.mp4", %w(-t 00:02:00.00 -c copy))
34
36
 
35
- mov = File.new(open("tmp/movie.mp4"))
37
+ p mov = File.new(open("tmp/movie.mp4"))
38
+
39
+ p mov.size
36
40
 
37
41
  init_request = Twitter::REST::Request.new(twitter_client, :post, "https://upload.twitter.com/1.1/media/upload.json", { command: 'INIT', total_bytes: mov.size, media_type: 'video/mp4', media_category: 'tweet_video' }).perform
38
42
 
@@ -72,6 +76,10 @@
72
76
 
73
77
  ```
74
78
 
79
+ #<File:/var/folders/8s/5mzgwvks1pgg5pcswk0qpbv80000gn/T/open-uri20210629-76193-15yrwh1>
80
+
81
+ 31120633
82
+
75
83
  I, [2021-06-29T10:36:16.440604 #74369] INFO -- : Running transcoding...
76
84
 
77
85
  ["/usr/local/bin/ffmpeg", "-y", "-i", "/var/folders/8s/5mzgwvks1pgg5pcswk0qpbv80000gn/T/open-uri20210629-74369-9k8g4y", "-t", "00:02:00.00", "-c", "copy", "tmp/movie.mp4"]
@@ -79,6 +87,12 @@
79
87
 
80
88
 
81
89
  I, [2021-06-29T10:36:16.805879 #74369] INFO -- : Transcoding of /var/folders/8s/5mzgwvks1pgg5pcswk0qpbv80000gn/T/open-uri20210629-74369-9k8g4y to tmp/movie.mp4 succeeded
90
+
91
+
92
+
93
+ #<File:tmp/movie.mp4>
94
+
95
+ 22951395
82
96
 
83
97
  ```
84
98
 

4

補足

2021/06/29 06:38

投稿

joru
joru

スコア45

test CHANGED
File without changes
test CHANGED
@@ -93,3 +93,5 @@
93
93
  ・[twitter gemのINIT、APPEND、STATUS](https://www.ayumu-ao.tech/entry/2017/11/14/151156)
94
94
 
95
95
  ・[140秒動画](https://qiita.com/mpyw/items/7bedf8c23de286cef0f9#getpost-mediaupload-%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E3%81%82%E3%82%8A%E9%9D%9E%E5%90%8C%E6%9C%9F)
96
+
97
+ ・[ソースコード](https://teratail.com/questions/122668?link=qa_related_pc)

3

補足

2021/06/29 06:18

投稿

joru
joru

スコア45

test CHANGED
File without changes
test CHANGED
@@ -70,6 +70,20 @@
70
70
 
71
71
  ```
72
72
 
73
+ ```
74
+
75
+ I, [2021-06-29T10:36:16.440604 #74369] INFO -- : Running transcoding...
76
+
77
+ ["/usr/local/bin/ffmpeg", "-y", "-i", "/var/folders/8s/5mzgwvks1pgg5pcswk0qpbv80000gn/T/open-uri20210629-74369-9k8g4y", "-t", "00:02:00.00", "-c", "copy", "tmp/movie.mp4"]
78
+
79
+
80
+
81
+ I, [2021-06-29T10:36:16.805879 #74369] INFO -- : Transcoding of /var/folders/8s/5mzgwvks1pgg5pcswk0qpbv80000gn/T/open-uri20210629-74369-9k8g4y to tmp/movie.mp4 succeeded
82
+
83
+ ```
84
+
85
+ とあるので、movie.transcodeまでは成功していそうなので、Twitter gemの周りだとは思うのですが、、、
86
+
73
87
 
74
88
 
75
89
  参考にしたサイト:

2

補足

2021/06/29 02:37

投稿

joru
joru

スコア45

test CHANGED
File without changes
test CHANGED
@@ -74,14 +74,8 @@
74
74
 
75
75
  参考にしたサイト:
76
76
 
77
- ・rails内でのffmpegの利用
77
+ [rails内でのffmpegの利用](https://qiita.com/shyu61/items/523014af4aad4b929ad4)
78
78
 
79
- https://qiita.com/shyu61/items/523014af4aad4b929ad4
79
+ ・[twitter gemのINIT、APPEND、STATUS](https://www.ayumu-ao.tech/entry/2017/11/14/151156)
80
80
 
81
- ・twitter gemのINIT、APPEND、STATUS
82
-
83
- https://www.ayumu-ao.tech/entry/2017/11/14/151156
84
-
85
- ・140秒動画
86
-
87
- https://qiita.com/mpyw/items/7bedf8c23de286cef0f9#getpost-mediaupload-%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E3%81%82%E3%82%8A%E9%9D%9E%E5%90%8C%E6%9C%9F
81
+ ・[140秒動画](https://qiita.com/mpyw/items/7bedf8c23de286cef0f9#getpost-mediaupload-%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E3%81%82%E3%82%8A%E9%9D%9E%E5%90%8C%E6%9C%9F)

1

補足

2021/06/29 02:34

投稿

joru
joru

スコア45

test CHANGED
File without changes
test CHANGED
@@ -69,3 +69,19 @@
69
69
  #<Twitter::Error::BadRequest: Not valid video>
70
70
 
71
71
  ```
72
+
73
+
74
+
75
+ 参考にしたサイト:
76
+
77
+ ・rails内でのffmpegの利用
78
+
79
+ https://qiita.com/shyu61/items/523014af4aad4b929ad4
80
+
81
+ ・twitter gemのINIT、APPEND、STATUS
82
+
83
+ https://www.ayumu-ao.tech/entry/2017/11/14/151156
84
+
85
+ ・140秒動画
86
+
87
+ https://qiita.com/mpyw/items/7bedf8c23de286cef0f9#getpost-mediaupload-%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E3%81%82%E3%82%8A%E9%9D%9E%E5%90%8C%E6%9C%9F