
Recherche avancée
Autres articles (67)
-
Le profil des utilisateurs
12 avril 2011, parChaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...) -
Configurer la prise en compte des langues
15 novembre 2010, parAccéder à la configuration et ajouter des langues prises en compte
Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...) -
XMP PHP
13 mai 2011, parDixit Wikipedia, XMP signifie :
Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)
Sur d’autres sites (6410)
-
Uploading video to Twitter sometimes doesn't work
22 juillet 2021, par K-s S-kI have a very difficult situation. I've already spent 2 days and couldn't find a solution. Project on Laravel. I want to upload videos to Twitter using the Twitter API endpoints. But sometimes I am getting this error :




file is currently unsupported




I did everything as recommended in the official documentation Video specifications and recommendations. I get an error when I set an audio codec is aac in my video file, despite the fact that it is recommended in the official documentation, but when I set the audio codec to mp3, the video is uploaded, but the sound quality is very poor, and sometimes there is no sound at all. Please forgive me if this is awkward to read, but I want to provide all of my code. Because I don't know how to solve this anymore and I think it might help.


<?php

namespace App\Jobs;

use App\Models\PublishedContent;
use Atymic\Twitter\Facades\Twitter;
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Bus\Queueable;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\File;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Support\Str;


class PublishToTwitter implements ShouldQueue
{
 use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

 /**
 * @var
 */
 protected $publishingData;

 /**
 * Create a new job instance.
 *
 * @param $publishingData
 */
 public function __construct($publishingData)
 {
 $this->publishingData = $publishingData;
 }

 /**
 * Execute the job.
 *
 * @return void
 */
 public function handle()
 {
 $publishingData = $this->publishingData;

 if (is_array($publishingData)) {
 $publishingResult = $this->publishing(...array_values($publishingData));
 sendNotification($publishingResult['message'], $publishingResult['status'], 'Twitter', $publishingResult['link'], $publishingData['post_name'], $publishingData['user']);
 } else {
 $scheduledData = processingScheduledPost($publishingData);
 $postName = $scheduledData['scheduleData']['post_name'];
 $postContent = $scheduledData['scheduleData']['post_content'];
 $userToken = json_decode($publishingData->user_token,true);
 $requestToken = [
 'token' => $userToken['oauth_token'],
 'secret' => $userToken['oauth_token_secret'],
 ];
 $publishingResult = $this->publishing($scheduledData['file'], $postName, $postContent, $requestToken);
 $publishingResult['status'] && PublishedContent::add($scheduledData['craft'], $scheduledData['file'], "twitter_share");
 sendResultToUser($publishingData, $scheduledData['user'], $publishingResult['message'], $postName, $publishingResult['link'], $publishingResult['publishing_status'], $scheduledData['social_media']);
 sendNotification($publishingResult['message'], $publishingResult['status'], 'Twitter', $publishingResult['link'], $postName, $scheduledData['user']);
 }
 }

 /**
 * @param $file
 * @param $postName
 * @param $postContent
 * @param $requestToken
 * @return array
 */
 private function publishing($file, $postName, $postContent, $requestToken): array
 {
 $result = [
 'status' => false,
 'link' => null,
 'message' => 'Your content can\'t successfully published on Twitter. This file is not supported for publishing.',
 'publishing_status' => 'error'
 ];

 if ((($file->refe_type !== 'text') || $file->refe_file_path) && !checkIfFileExist($file->refe_file_path)) {
 $result['message'] = 'Missing or invalid file.';
 return $result;
 }

 $filePath = $file->refe_file_path;
 $fileSize = $file->content_length;
 $tempFileName = 'temp-' . $file->refe_file_name;
 $ext = $file->file_type;
 $mediaCategory = 'tweet_' . $file->refe_type;
 $mediaType = $file->refe_type . '/' . $ext;
 $remoteFile = file_get_contents($filePath);
 $tempFolder = public_path('/storage/uploads/temp');

 if (!file_exists($tempFolder)) {
 mkdir($tempFolder, 0777, true);
 }

 $tempFile = public_path('/storage/uploads/temp/' . $tempFileName);
 File::put($tempFile, $remoteFile);
 $convertedFileName = 'converted-' . $file->refe_file_name;
 $convertedFile = public_path('/storage/uploads/temp/' . $convertedFileName);
 $command = 'ffmpeg -y -i '.$tempFile.' -b:v 5000k -b:a 380k -c:a aac -profile:a aac_low -threads 1 '.$convertedFile.'';
 exec($command);
 @File::delete($tempFile);

 try {
 $twitter = Twitter::usingCredentials($requestToken['token'], $requestToken['secret']);
 if ($file->refe_type === 'text') {
 $twitter->postTweet([
 'status' => urldecode($postContent),
 'format' => 'json',
 ]);

 $result['link'] = 'https://twitter.com/home';
 $result['status'] = true;
 $result['message'] = 'Your content successfully published on Twitter. You can visit to Twitter and check it.';
 $result['publishing_status'] = 'done';
 } else if ($file->refe_type === 'video' || $file->refe_type === 'image') {
 if ($file->refe_type === 'video') {
 $duration = getVideoDuration($file->refe_file_path);

 if ($duration > config('constant.sharing_configs.max_video_duration.twitter')) {
 throw new \Exception('The duration of the video file must not exceed 140 seconds.');
 }
 }

 $isFileTypeSupported = checkPublishedFileType('twitter', $file->refe_type, strtolower($ext));
 $isFileSizeSupported = checkPublishedFileSize('twitter', $file->refe_type, $fileSize, strtolower($ext));

 if (!$isFileTypeSupported) {
 throw new \Exception('Your content can\'t successfully published on Twitter. This file type is not supported for publishing.');
 }

 if (!$isFileSizeSupported) {
 throw new \Exception('Your content can\'t successfully published on Twitter. The file size is exceeded.');
 }

 if ($file->refe_type === 'video') $fileSize = filesize($convertedFile);

 if (strtolower($ext) === 'gif') {
 $initMedia = $twitter->uploadMedia([
 'command' => 'INIT',
 'total_bytes' => (int)$fileSize
 ]);
 } else {
 $initMedia = $twitter->uploadMedia([
 'command' => 'INIT',
 'media_type' => $mediaType,
 'media_category' => $mediaCategory,
 'total_bytes' => (int)$fileSize
 ]);
 }

 $mediaId = (int)$initMedia->media_id_string;

 $fp = fopen($convertedFile, 'r');
 $segmentId = 0;

 while (!feof($fp)) {
 $chunk = fread($fp, 1048576);

 $twitter->uploadMedia([
 'media_data' => base64_encode($chunk),
 'command' => 'APPEND',
 'segment_index' => $segmentId,
 'media_id' => $mediaId
 ]);

 $segmentId++;
 }

 fclose($fp);

 $twitter->uploadMedia([
 'command' => 'FINALIZE',
 'media_id' => $mediaId
 ]);

 if ($file->refe_type === 'video') {
 $waits = 0;

 while ($waits <= 4) {
 // Authorizing header for Twitter API
 $oauth = [
 'command' => 'STATUS',
 'media_id' => $mediaId,
 'oauth_consumer_key' => config('twitter.consumer_key'),
 'oauth_nonce' => Str::random(42),
 'oauth_signature_method' => 'HMAC-SHA1',
 'oauth_timestamp' => time(),
 'oauth_token' => $requestToken['token'],
 'oauth_version' => '1.0'
 ];

 // Generate an OAuth 1.0a HMAC-SHA1 signature for an HTTP request
 $baseInfo = $this->buildBaseString('https://upload.twitter.com/1.1/media/upload.json', 'GET', $oauth);
 // Getting a signing key
 $compositeKey = rawurlencode(config('twitter.consumer_secret')) . '&' . rawurlencode($requestToken['secret']);
 // Calculating the signature
 $oauthSignature = base64_encode(hash_hmac('sha1', $baseInfo, $compositeKey, true));
 $oauth['oauth_signature'] = $oauthSignature;
 $headers['Authorization'] = $this->buildAuthorizationHeader($oauth);

 try {
 $guzzle = new GuzzleClient([
 'headers' => $headers
 ]);
 $response = $guzzle->request( 'GET', 'https://upload.twitter.com/1.1/media/upload.json?command=STATUS&media_id=' . $mediaId);
 $uploadStatus = json_decode($response->getBody()->getContents());
 } catch (\Exception | GuzzleException $e) {
 dd($e->getMessage(), $e->getLine(), $e->getFile());
 }

 if (isset($uploadStatus->processing_info->state)) {
 switch ($uploadStatus->processing_info->state) {
 case 'succeeded':
 $waits = 5; // break out of the while loop
 break;
 case 'failed':
 File::delete($tempFile);
 Log::error('File processing failed: ' . $uploadStatus->processing_info->error->message);
 throw new \Exception('File processing failed: ' . $uploadStatus->processing_info->error->message);
 default:
 sleep($uploadStatus->processing_info->check_after_secs);
 $waits++;
 }
 } else {
 throw new \Exception('There was an unknown error uploading your file');
 }
 }
 }

 $twitter->postTweet(['status' => urldecode($postContent), 'media_ids' => $initMedia->media_id_string]);
 @File::delete($convertedFile);
 $result['link'] = 'https://twitter.com/home';
 $result['status'] = true;
 $result['message'] = 'Your content successfully published on Twitter. You can visit to Twitter and check it.';
 $result['publishing_status'] = 'done';
 }
 } catch (\Exception $e) {
 dd($e->getMessage());
 $result['message'] = $e->getMessage();
 return $result;
 }

 return $result;
 }

 /**
 * @param $baseURI
 * @param $method
 * @param $params
 * @return string
 *
 * Creating the signature base string
 */
 protected function buildBaseString($baseURI, $method, $params): string
 {
 $r = array();
 ksort($params);
 foreach($params as $key=>$value){
 $r[] = "$key=" . rawurlencode($value);
 }
 return $method . "&" . rawurlencode($baseURI) . '&' . rawurlencode(implode('&', $r));
 }

 /**
 * @param $oauth
 * @return string
 *
 * Collecting parameters
 */
 protected function buildAuthorizationHeader($oauth): string
 {
 $r = 'OAuth ';
 $values = array();
 foreach($oauth as $key=>$value)
 $values[] = "$key=\"" . rawurlencode($value) . "\"";
 $r .= implode(', ', $values);
 return $r;
 }
}




I would be very grateful if someone would help me.


-
How can several .ts files be converted to one (non-fragmented) .mp4 file using ffmpeg ?
23 juin 2021, par verified_tinkerProblem Description


The video player I'm using doesn't support
.ts
files, but it does play.mp4
files, so I'd like to use ffmpeg to convert my.ts
files to.mp4
files.

Goal Solution


Use ffmpeg to download several
.ts
segments and transcode them into an.mp4
file that I'd load into my video player. Rinse and repeat. It'd add a delay of 10-20 seconds, but that's fine.

The trick is to do the transcoding fast enough so, by the time one
.mp4
file is finished playing, the next one is available ; in other words, the transcoding should take less than a second per second of footage. Ideally, it would take significantly less than that, to account for varying processing power on different devices.

To clarify, when I say
.mp4
, I don't mean fragmented.mp4
files.


If transcoding to some other format is faster, that might be fine, too. For example, I know the
.mkv
format is playable. I'm still exploring the full range of available formats.

What I've Tried


I tested transcoding 1
.ts
file into an.mp4
file, and unfortunately it took about 6 seconds when the file was about 4 seconds long. That was with ffmpeg-wasm. I was hoping the JavaScript bridge might be slowing it down and that batching several.ts
segments in 1 call might help.

Command


ffmpeg -i test.ts test.mp4



Log


[info] run FS.writeFile test.ts <349304 bytes binary file>
log.js:15 [info] run ffmpeg command: -i test.ts test.mp4
log.js:15 [fferr] ffmpeg version v0.9.0-2-gb11e5c1495 Copyright (c) 2000-2020 the FFmpeg developers
log.js:15 [fferr] built with emcc (Emscripten gcc/clang-like replacement) 2.0.8 (d059fd603d0b45b584f634dc2365bc9e9a6ec1dd)
log.js:15 [fferr] configuration: --target-os=none --arch=x86_32 --enable-cross-compile --disable-x86asm --disable-inline-asm --disable-stripping --disable-programs --disable-doc --disable-debug --disable-runtime-cpudetect --disable-autodetect --extra-cflags='-s USE_PTHREADS=1 -I/src/build/include -O3 --closure 1' --extra-cxxflags='-s USE_PTHREADS=1 -I/src/build/include -O3 --closure 1' --extra-ldflags='-s USE_PTHREADS=1 -I/src/build/include -O3 --closure 1 -L/src/build/lib' --pkg-config-flags=--static --nm=llvm-nm --ar=emar --ranlib=emranlib --cc=emcc --cxx=em++ --objcc=emcc --dep-cc=emcc --enable-gpl --enable-nonfree --enable-zlib --enable-libx264 --enable-libx265 --enable-libvpx --enable-libwavpack --enable-libmp3lame --enable-libfdk-aac --enable-libtheora --enable-libvorbis --enable-libfreetype --enable-libopus --enable-libwebp --enable-libass --enable-libfribidi
log.js:15 [fferr] libavutil 56. 51.100 / 56. 51.100
log.js:15 [fferr] libavcodec 58. 91.100 / 58. 91.100
log.js:15 [fferr] libavformat 58. 45.100 / 58. 45.100
log.js:15 [fferr] libavdevice 58. 10.100 / 58. 10.100
log.js:15 [fferr] libavfilter 7. 85.100 / 7. 85.100
log.js:15 [fferr] libswscale 5. 7.100 / 5. 7.100
log.js:15 [fferr] libswresample 3. 7.100 / 3. 7.100
log.js:15 [fferr] libpostproc 55. 7.100 / 55. 7.100
log.js:15 [fferr] Input #0, mpegts, from 'test.ts':
log.js:15 [fferr] Duration: 00:00:04.00, start: 10.006000, bitrate: 698 kb/s
log.js:15 [fferr] Program 1 
log.js:15 [fferr] Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1280x720, 23.98 tbr, 90k tbn, 1411200000.00 tbc
log.js:15 [fferr] Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 130 kb/s
log.js:15 [fferr] Stream mapping:
log.js:15 [fferr] Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
log.js:15 [fferr] Stream #0:1 -> #0:1 (aac (native) -> aac (native))
log.js:15 [fferr] [libx264 @ 0x1f5f080] using cpu capabilities: none!
log.js:15 [fferr] [libx264 @ 0x1f5f080] profile High, level 3.1, 4:2:0, 8-bit
log.js:15 [fferr] [libx264 @ 0x1f5f080] 264 - core 160 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=23 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
log.js:15 [fferr] Output #0, mp4, to 'test.mp4':
log.js:15 [fferr] Metadata:
log.js:15 [fferr] encoder : Lavf58.45.100
log.js:15 [fferr] Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1280x720, q=-1--1, 23.98 fps, 24k tbn, 23.98 tbc
log.js:15 [fferr] Metadata:
log.js:15 [fferr] encoder : Lavc58.91.100 libx264
log.js:15 [fferr] Side data:
log.js:15 [fferr] cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
log.js:15 [fferr] Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s
log.js:15 [fferr] Metadata:
log.js:15 [fferr] encoder : Lavc58.91.100 aac
log.js:15 [fferr] frame= 3 fps=0.0 q=0.0 size= 0kB time=00:00:00.38 bitrate= 1.0kbits/s dup=1 drop=0 speed=0.521x 
log.js:15 [fferr] frame= 47 fps= 27 q=0.0 size= 0kB time=00:00:02.09 bitrate= 0.2kbits/s dup=1 drop=0 speed=1.22x 
log.js:15 [fferr] frame= 57 fps= 25 q=28.0 size= 0kB time=00:00:02.51 bitrate= 0.2kbits/s dup=1 drop=0 speed=1.13x 
log.js:15 [fferr] frame= 67 fps= 24 q=28.0 size= 0kB time=00:00:02.96 bitrate= 0.1kbits/s dup=1 drop=0 speed=1.08x 
log.js:15 [fferr] frame= 77 fps= 23 q=28.0 size= 0kB time=00:00:03.37 bitrate= 0.1kbits/s dup=1 drop=0 speed=1.03x 
log.js:15 [fferr] frame= 89 fps= 23 q=28.0 size= 0kB time=00:00:03.96 bitrate= 0.1kbits/s dup=1 drop=0 speed=1.04x 
log.js:15 [fferr] frame= 96 fps= 15 q=-1.0 Lsize= 60kB time=00:00:04.01 bitrate= 122.8kbits/s dup=1 drop=0 speed=0.646x 
log.js:15 [fferr] video:55kB audio:1kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 7.249582%
log.js:15 [fferr] [libx264 @ 0x1f5f080] frame I:1 Avg QP:17.20 size: 31521
log.js:15 [fferr] [libx264 @ 0x1f5f080] frame P:24 Avg QP:16.17 size: 735
log.js:15 [fferr] [libx264 @ 0x1f5f080] frame B:71 Avg QP:27.68 size: 91
log.js:15 [fferr] [libx264 @ 0x1f5f080] consecutive B-frames: 1.0% 0.0% 3.1% 95.8%
log.js:15 [fferr] [libx264 @ 0x1f5f080] mb I I16..4: 26.2% 56.4% 17.4%
log.js:15 [fferr] [libx264 @ 0x1f5f080] mb P I16..4: 0.1% 0.2% 0.0% P16..4: 3.5% 0.4% 0.2% 0.0% 0.0% skip:95.4%
log.js:15 [fferr] [libx264 @ 0x1f5f080] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 1.6% 0.0% 0.0% direct: 0.0% skip:98.3% L0:31.0% L1:69.0% BI: 0.0%
log.js:15 [fferr] [libx264 @ 0x1f5f080] 8x8 transform intra:56.5% inter:59.4%
log.js:15 [fferr] [libx264 @ 0x1f5f080] coded y,uvDC,uvAC intra: 17.4% 15.4% 7.5% inter: 0.2% 0.4% 0.0%
log.js:15 [fferr] [libx264 @ 0x1f5f080] i16 v,h,dc,p: 29% 63% 1% 7%
log.js:15 [fferr] [libx264 @ 0x1f5f080] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 51% 31% 14% 0% 2% 1% 1% 0% 1%
log.js:15 [fferr] [libx264 @ 0x1f5f080] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 45% 11% 2% 3% 2% 4% 2% 4%
log.js:15 [fferr] [libx264 @ 0x1f5f080] i8c dc,h,v,p: 76% 17% 6% 1%
log.js:15 [fferr] [libx264 @ 0x1f5f080] Weighted P-Frames: Y:0.0% UV:0.0%
log.js:15 [fferr] [libx264 @ 0x1f5f080] ref P L0: 89.5% 1.6% 6.7% 2.3%
log.js:15 [fferr] [libx264 @ 0x1f5f080] ref B L0: 38.5% 60.9% 0.6%
log.js:15 [fferr] [libx264 @ 0x1f5f080] ref B L1: 97.7% 2.3%
log.js:15 [fferr] [libx264 @ 0x1f5f080] kb/s:111.08
log.js:15 [fferr] [aac @ 0x1f48100] Qavg: 65536.000
log.js:15 [ffout] FFMPEG_END
log.js:15 [info] run FS.readFile test.mp4
(index):38 Time elapsed: 6345 (This one's my own code.)
[info] run FS.readFile test.mp4



(I'm running this on the browser. For the purposes of this question, consider the HTML player unavailable for use.)



I also tested feeding the HLS live-stream URL as input to ffmpeg and outputting a single
.mp4
file, but I couldn't play it until I ended the live-stream and ffmpeg finished downloading it.

This one I ran on the (Windows) PC ; not the browser.


Command


ffmpeg -i https://stream.mux.com/lngMYGqNpHhYg2ZXqpH8WODVGzuenaZuhckdyunGpzU.m3u8 -acodec copy -bsf:a aac_adtstoasc -vcodec copy out.mp4



Log


The log is too large and StackOverflow won't let me paste it here, so I uploaded it to PasteBin : https://pastebin.com/FqvPQ1DZ


-
FFMPEG : Merge Image and Audio Convert into Video in android using FFMPEG library
30 janvier 2014, par Nitish Singlai want to convert images into video in android using FFMPEG,still now i compiled the library successfully,and also get Libffmpeg.so.
Using Platform : UBUNTU,Eclipse
My problem is- when i use this library command too convert video into images through Java code i mean through my Activity i got Error-
JAVA.IO.EXCEPTION.Enable to execute .Exec() command
But if i exceute this command through CMD then my video file is created successfully.
i want to know whats the problem behind it,i am searching from 2 days on it,but could not get the solution,i thing its problem of Execute Permission In android.Plzzz help me,,,or tell me is it possible to in android to make a video file using FFMPEG.Code :
public class Mpeg extends Activity {
String cmd;
static {
System.loadLibrary("ffmpeg");
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_mpeg);
File mf = Environment.getExternalStorageDirectory();
String install="$adb push ./asl-native /sdcard/asl-native";
String ins="$adb shell /system/bin/chmod 0777 /sdcard/asl-native";
String start="$adb shell /system/bin/chmod 0777 /sdcard/asl-native";
String str="$adb shell /system/bin/chmod 0777 /sdcard/asl-native";
try{
Process p = Runtime.getRuntime().exec(install);
p = Runtime.getRuntime().exec(ins);
p = Runtime.getRuntime().exec(start);
p = Runtime.getRuntime().exec(str);
Log.e("filee name", "goodddddd"+ install);
Log.e("full command", "goodddddd"+ ins);
}
catch (Exception e) {
Log.e("image", "exception");
}
String livestream = mf.getAbsoluteFile()+"/smile.png";
Log.e("image", "imageeeeeeeee " + livestream);
String folderpth = mf.getAbsoluteFile()+"/RABBA.MP3";
Log.e("Test", "songggggggggg " + folderpth);
String output=mf.getAbsoluteFile()+"/plztest.mp4";;
//String output = new File(Environment.getExternalStorageDirectory(), "plzz.mp4").getAbsolutePath();
Log.e("Test", "outputttttt " + output);
cmd= "ffmpeg -i "+ livestream +" -i "+ folderpth +" -acodec copy "+ output;
Log.e("chck plzzzzz", "after "+ cmd);
//String jaiho="ffmpeg -i image8.jpg -i file.m4a -acodec copy test.mp4";
// Boolean heloo=isDeviceRooted_BySu();
//Log.e("check file", "after "+ heloo);
Button run=(Button)findViewById(R.id.btn);
run.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Perform action on click
try {
Execute();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
/*
try{
Process p = Runtime.getRuntime().exec(cmd);
Log.e("check file", "main fileeee ");
}
catch (IOException e) {
throw new RuntimeException(e);
}
*/
}
public void Execute() throws IOException, InterruptedException{
Process process=Runtime.getRuntime().exec(cmd);
// process = pb.command(com).redirectErrorStream(true).start();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.mpeg, menu);
return true;
}
public static boolean isDeviceRooted_BySu() {
try {
Log.d("BySu", "BySu");
Process p = Runtime.getRuntime().exec("su");
return true;
} catch (IOException e) {
e.printStackTrace();
}
return false;
}
}Logcat output :
06-05 17:58:10.686: D/dalvikvm(1189): Trying to load lib /data/data/com.example.myfmpeg /lib/libffmpeg.so 0x412a5cf0
06-05 17:58:10.756: I/dalvikvm(1189): threadid=3: reacting to signal 3
06-05 17:58:10.955: D/dalvikvm(1189): Added shared lib /data/data/com.example.myfmpeg/lib/libffmpeg.so 0x412a5cf0
06-05 17:58:10.955: D/dalvikvm(1189): No JNI_OnLoad found in /data/data/com.example.myfmpeg/lib/libffmpeg.so 0x412a5cf0, skipping init
06-05 17:58:11.024: I/dalvikvm(1189): Wrote stack traces to '/data/anr/traces.txt'
06-05 17:58:11.215: I/dalvikvm(1189): threadid=3: reacting to signal 3
06-05 17:58:11.326: I/dalvikvm(1189): Wrote stack traces to '/data/anr/traces.txt'
06-05 17:58:11.466: E/image(1189): imageeeeeeeee /mnt/sdcard/smile.png
06-05 17:58:11.466: E/Test(1189): songggggggggg /mnt/sdcard/RABBA.MP3
06-05 17:58:11.476: E/Test(1189): outputttttt /mnt/sdcard/video.mp4
06-05 17:58:11.476: E/chck plzzzzz(1189): after ffmpeg -i /mnt/sdcard/smile.png -i /mnt/sdcard/RABBA.MP3 -acodec copy /mnt/sdcard/video.mp4
06-05 17:58:11.896: E/AndroidRuntime(1189): FATAL EXCEPTION: main
06-05 17:58:11.896: E/AndroidRuntime(1189): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myfmpeg/com.example.myfmpeg.Mpeg}: java.lang.RuntimeException: java.io.IOException: Error running exec(). Command: [ffmpeg, -i, /mnt/sdcard/smile.png, -i, /mnt/sdcard/RABBA.MP3, -acodec, copy, /mnt/sdcard/video.mp4] Working Directory: null Environment: null
06-05 17:58:11.896: E/AndroidRuntime(1189): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
06-05 17:58:11.896: E/AndroidRuntime(1189): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
06-05 17:58:11.896: E/AndroidRuntime(1189): at android.app.ActivityThread.access$600(ActivityThread.java:123)
06-05 17:58:11.896: E/AndroidRuntime(1189): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
06-05 17:58:11.896: E/AndroidRuntime(1189): at android.os.Handler.dispatchMessage(Handler.java:99)
06-05 17:58:11.896: E/AndroidRuntime(1189): at android.os.Looper.loop(Looper.java:137)
06-05 17:58:11.896: E/AndroidRuntime(1189): at android.app.ActivityThread.main(ActivityThread.java:4424)
06-05 17:58:11.896: E/AndroidRuntime(1189): at java.lang.reflect.Method.invokeNative(Native Method)
06-05 17:58:11.896: E/AndroidRuntime(1189): at java.lang.reflect.Method.invoke(Method.java:511)
06-05 17:58:11.896: E/AndroidRuntime(1189): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
06-05 17:58:11.896: E/AndroidRuntime(1189): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
06-05 17:58:11.896: E/AndroidRuntime(1189): at dalvik.system.NativeStart.main(Native Method)
06-05 17:58:11.896: E/AndroidRuntime(1189): Caused by: java.lang.RuntimeException: java.io.IOException: Error running exec(). Command: [ffmpeg, -i, /mnt/sdcard/smile.png, -i, /mnt/sdcard/RABBA.MP3, -acodec, copy, /mnt/sdcard/video.mp4] Working Directory: null Environment: null