Hello,
I have an upload problem with the Twitter API.
The problem is caused by codecs I think.
I use FFMPEG to concatenate an audio file and an image, so to build a 30-second video to a file not exceeding in the 1MB.
Here is the code that allows me to build this file and then upload the video via the Twitter API:
var convert = function(image, audio, output) {
var proc = ffmpeg(image)
.loop(30)
.addInput(audio)
.format('mp4')
.videoBitrate('1024k')
.videoCodec('mpeg4')
.size('640x640')
.audioBitrate('128k')
.audioChannels(2)
.audioCodec('libfaac')
.on('end', function() {
console.log(output);
fs.readFile(output, function(err, base64data) {
client.post('media/upload', { media: base64data }, function (error, media, response) {
console.log(media);
});
});
})
.on('error', function(err) {
console.log('an error happened: ' + err.message);
})
.save(output);
};
Each upload, I get the following message: unrecognized media type
{ request: '/1.1/media/upload.json',
error: 'media type unrecognized.' }
Could you help me please? Thanks!