
Recherche avancée
Médias (1)
-
Revolution of Open-source and film making towards open film making
6 octobre 2011, par
Mis à jour : Juillet 2013
Langue : English
Type : Texte
Autres articles (20)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...) -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir
Sur d’autres sites (4167)
-
Saving an animation using ffmpeg and matplotlib on anaconda3
21 juin 2016, par Varsha DyavaiahI am trying to create videos of NBA Action with Sportsvu data.
I was following the steps given in this blog by Dan Vatterott :
I am trying to create a animation and save it using ffmpeg and matplotlib.
The code snippet is attached below.import matplotlib.animation as animation
plt.rcParams['animation.ffmpeg_path'] = '/home/anaconda3/pkgs/ffmpeg-2.1.0-1/bin'
fig = plt.figure(figsize=(15,7.5)) #create figure object
ax = plt.gca() #create axis object
draw_court([0,100,0,50]) #draw the court
player_text = list(range(10)) #create player text vector
player_circ = list(range(10)) #create player circle vector
ball_circ = plt.Circle((0,0), 1.1, color=[1, 0.4, 0]) #create circle object for bal
for i in list(range(10)): #create circle object and text object for each player
col=['w','k'] if i<5 else ['k','w'] #color scheme
player_circ[i] = plt.Circle((0,0), 2.2, facecolor=col[0],edgecolor='k') #player circle
player_text[i] = ax.text(0,0,'',color=col[1],ha='center',va='center') #player jersey # (text)
ani = animation.FuncAnimation(fig, animate, frames=np.arange(0,np.size(ball_xy,0)), init_func=init, blit=True, interval=5, repeat=False,\
save_count=0) #function for making video
FFwriter = animation.FFMpegWriter()
ani.save('Event_%d.mp4' % (search_id),dpi=100,writer = FFwriter,fps=25) #function for saving video
plt.close('all') #close the plotWhen I try to save the animation ’ani’ , I get Errno 13 (Permission denied).
---------------------------------------------------------------------------
PermissionError Traceback (most recent call last)
in <module>()
17
18 FFwriter = animation.FFMpegWriter()
---> 19 ani.save('Event_%d.mp4' % (search_id),dpi=100,writer = FFwriter,fps=25) #function for saving video
20 plt.close('all') #close the plot
/home/anaconda3/lib/python3.5/site-packages/matplotlib/animation.py in save(self, filename, writer, fps, dpi, codec, bitrate, extra_args, metadata, extra_anim, savefig_kwargs)
799 # since GUI widgets are gone. Either need to remove extra code to
800 # allow for this non-existant use case or find a way to make it work.
--> 801 with writer.saving(self._fig, filename, dpi):
802 for anim in all_anim:
803 # Clear the initial frame
/home/anaconda3/lib/python3.5/contextlib.py in __enter__(self)
57 def __enter__(self):
58 try:
---> 59 return next(self.gen)
60 except StopIteration:
61 raise RuntimeError("generator didn't yield") from None
/home/anaconda3/lib/python3.5/site-packages/matplotlib/animation.py in saving(self, *args)
192 '''
193 # This particular sequence is what contextlib.contextmanager wants
--> 194 self.setup(*args)
195 yield
196 self.finish()
/home/anaconda3/lib/python3.5/site-packages/matplotlib/animation.py in setup(self, fig, outfile, dpi, *args)
182 # Run here so that grab_frame() can write the data to a pipe. This
183 # eliminates the need for temp files.
--> 184 self._run()
185
186 @contextlib.contextmanager
/home/anaconda3/lib/python3.5/site-packages/matplotlib/animation.py in _run(self)
210 stdout=output, stderr=output,
211 stdin=subprocess.PIPE,
--> 212 creationflags=subprocess_creation_flags)
213
214 def finish(self):
/home/anaconda3/lib/python3.5/subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds)
948 c2pread, c2pwrite,
949 errread, errwrite,
--> 950 restore_signals, start_new_session)
951 except:
952 # Cleanup if the child failed starting.
/home/anaconda3/lib/python3.5/subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session)
1542 else:
1543 err_msg += ': ' + repr(orig_executable)
-> 1544 raise child_exception_type(errno_num, err_msg)
1545 raise child_exception_type(err_msg)
1546
PermissionError: [Errno 13] Permission denied
</module>Can someone help me ? Thanks in advance.
-
Got a crash when I run a ffmpeg comand on an certain phone
31 août 2016, par Kingty Tenghere is the code I change from ffmpeg.c ,it can be run correct.
BUT,IT ALWAYS crashed on an cenrtain phone after run this code.JNIEXPORT jstring JNICALL Java_com_p1_mobile_android_media_VideoKit_run(
JNIEnv* env, jobject thiz, jobjectArray strArray)
{
int ret, i, pid;
int pipeFD[2];
char retBuffer[2];
char resultString[4096];
int argc = (*env)->GetArrayLength(env, strArray);
char ** argv = (char **)malloc(sizeof(char*)*argc);
for (i = 0; i < argc; i++) {
argv[i] = (*env)->GetStringUTFChars(env,
(jstring)(*env)->GetObjectArrayElement(env, strArray, i), NULL);
}
// reset to FAIL
ret = 1;
memset(retBuffer, 0, sizeof(retBuffer));
memset(resultString, 0, sizeof(resultString));
pipe(pipeFD);
pid = fork();
if (pid < 0) {
goto done;
} else if (pid == 0) {
// in child process, do command work
close(pipeFD[0]);
init();
av_log_set_callback(log_callback);
ret = run_ffempeg_command(argc, argv);
s_task_completed = 1;
sprintf(retBuffer, "%d", ret);
write(pipeFD[1], retBuffer, sizeof(retBuffer));
char * result_record = get_record_result();
if (result_record != NULL && strlen(result_record) > 0) {
sprintf(resultString, "%s", result_record);
} else {
if (ret == 0 && s_task_completed == 1) {
sprintf(resultString, "%s", "SUCCESS");
} else {
sprintf(resultString, "%s", "FAIL");
}
}
write(pipeFD[1], resultString, sizeof(resultString));
exit(0);
} else {
close(pipeFD[1]);
read(pipeFD[0], retBuffer, sizeof(retBuffer));
ret = (retBuffer[0] == '1') ? 1 : 0;
memset(resultString, 0, sizeof(resultString));
read(pipeFD[0], resultString, sizeof(resultString));
}
done:
for (i=0; iReleaseStringUTFChars(env,
(jstring)(*env)->GetObjectArrayElement(env, strArray, i), argv[i]);
}
free(argv);
//close();
if (strlen(resultString) > 0) {
// workaround for UTF-8 issue
jbyteArray array = (*env)->NewByteArray(env, sizeof(resultString));
(*env)->SetByteArrayRegion(env, array, 0, sizeof(resultString), resultString);
jstring strEncode = (*env)->NewStringUTF(env, "UTF-8");
jclass cls = (*env)->FindClass(env, "java/lang/String");
jmethodID ctor = (*env)->GetMethodID(env, cls, "<init>", "([BLjava/lang/String;)V");
jstring object = (jstring) (*env)->NewObject(env, cls, ctor, array, strEncode);
return object;
} else {
return (*env)->NewStringUTF(env, "FAIL");
}
}
</init>here is the crash log.almost phone can run this well,only on one phone after run the jni ,any button i touched will bring this crash
,it’s really appreciate if anybody can help08-31 14:59:23.580 279-279/? D/AEE/AED: $===AEE===AEE===AEE===$
08-31 14:59:23.580 279-279/? D/AEE/AED: p 0 poll events 1 revents 0
08-31 14:59:23.580 279-279/? D/AEE/AED: not know revents:0
08-31 14:59:23.580 279-279/? D/AEE/AED: p 1 poll events 1 revents 0
08-31 14:59:23.580 279-279/? D/AEE/AED: not know revents:0
08-31 14:59:23.580 279-279/? D/AEE/AED: p 2 poll events 1 revents 1
08-31 14:59:23.580 279-279/? D/AEE/AED: aed_main_fork_worker: generator 0xf7017148, worker 0xffbe76d8, recv_fd 0
08-31 14:59:23.580 279-279/? D/AEE/AED: p 3 poll events 1 revents 0
08-31 14:59:23.580 279-279/? D/AEE/AED: not know revents:0
08-31 14:59:23.580 279-279/? D/AEE/AED: p 4 poll events 1 revents 0
08-31 14:59:23.580 279-279/? D/AEE/AED: not know revents:0
08-31 14:59:23.580 279-279/? D/AEE/AED: p 5 poll events 0 revents 0
08-31 14:59:23.580 279-279/? D/AEE/AED: not know revents:0
08-31 14:59:23.580 8546-8546/? I/AEE/AED: handle_request(0)
08-31 14:59:23.581 8546-8546/? I/AEE/AED: check process 29910 name:1.mobile.putong
08-31 14:59:23.581 8546-8546/? I/AEE/AED: tid 29961 abort msg address is:0x83b09000, si_code is:-6 (request from 29910:10152)
08-31 14:59:23.581 8546-8546/? I/AEE/AED: BOOM: pid=29910 uid=10152 gid=10152 tid=29961
08-31 14:59:23.582 8546-8546/? I/AEE/AED: [OnPurpose Redunant in void preset_info(aed_report_record*, int, int)] pid: 29910, tid: 29961, name: RenderThread >>> com.p1.mobile.putong <<<
08-31 14:59:23.634 8546-8546/? I/AEE/AED: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
08-31 14:59:23.634 8546-8546/? I/AEE/AED: Build fingerprint: 'Letv/Le1s_CN/X3:5.0.2/DBXCNOP5501304201S/66:user/release-keys'
08-31 14:59:23.634 8546-8546/? I/AEE/AED: Revision: '0'
08-31 14:59:23.634 8546-8546/? I/AEE/AED: ABI: 'arm'
08-31 14:59:23.635 8546-8546/? I/AEE/AED: pid: 29910, tid: 29961, name: RenderThread >>> com.p1.mobile.putong <<<
08-31 14:59:23.635 8546-8546/? I/AEE/AED: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
08-31 14:59:23.662 8546-8546/? I/AEE/AED: Abort message: 'Failed to make current on surface 0x8c8b6e40, error=EGL_BAD_NATIVE_WINDOW'
08-31 14:59:23.662 8546-8546/? I/AEE/AED: r0 00000000 r1 00007509 r2 00000006 r3 00000000
08-31 14:59:23.662 8546-8546/? I/AEE/AED: r4 863fddc8 r5 00000006 r6 0000000b r7 0000010c
08-31 14:59:23.662 8546-8546/? I/AEE/AED: r8 675bdb6c r9 863fdd30 sl 863fdd28 fp 675bdba8
08-31 14:59:23.662 8546-8546/? I/AEE/AED: ip 00007509 sp 863fd838 lr 4002ee43 pc 4005206c cpsr 600f0010
08-31 14:59:23.662 8546-8546/? I/AEE/AED: backtrace:
08-31 14:59:23.662 8546-8546/? I/AEE/AED: #00 pc 0003a06c /system/lib/libc.so (tgkill+12)
08-31 14:59:23.662 8546-8546/? I/AEE/AED: #01 pc 00016e3f /system/lib/libc.so (pthread_kill+66)
08-31 14:59:23.662 8546-8546/? I/AEE/AED: #02 pc 00017a0b /system/lib/libc.so (raise+10)
08-31 14:59:23.662 8546-8546/? I/AEE/AED: #03 pc 00014317 /system/lib/libc.so (__libc_android_abort+34)
08-31 14:59:23.662 8546-8546/? I/AEE/AED: #04 pc 00012a4c /system/lib/libc.so (abort+4)
08-31 14:59:23.662 8546-8546/? I/AEE/AED: #05 pc 000083c1 /system/lib/libcutils.so (__android_log_assert+88)
08-31 14:59:23.662 8546-8546/? I/AEE/AED: #06 pc 0003f07b /system/lib/libhwui.so
08-31 14:59:23.662 8546-8546/? I/AEE/AED: #07 pc 0003d9e1 /system/lib/libhwui.so
08-31 14:59:23.662 8546-8546/? I/AEE/AED: #08 pc 0003ec23 /system/lib/libhwui.so
08-31 14:59:23.662 8546-8546/? I/AEE/AED: #09 pc 0003ed1b /system/lib/libhwui.so
08-31 14:59:23.662 8546-8546/? I/AEE/AED: #10 pc 00040257 /system/lib/libhwui.so
08-31 14:59:23.662 8546-8546/? I/AEE/AED: #11 pc 00040eab /system/lib/libhwui.so (android::uirenderer::renderthread::RenderThread::threadLoop()+66)
08-31 14:59:23.662 8546-8546/? I/AEE/AED: #12 pc 00010973 /system/lib/libutils.so (android::Thread::_threadLoop(void*)+110)
08-31 14:59:23.662 8546-8546/? I/AEE/AED: #13 pc 000609dd /system/lib/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+72)
08-31 14:59:23.662 8546-8546/? I/AEE/AED: #14 pc 000165bf /system/lib/libc.so (__pthread_start(void*)+30)
08-31 14:59:23.662 8546-8546/? I/AEE/AED: #15 pc 0001466b /system/lib/libc.so (__start_thread+6)
08-31 14:59:33.720 8546-8546/? E/AEE/AED: timed out waiting for tid=29910 to stop
08-31 14:59:33.821 8546-8546/? E/AEE/AED: timed out waiting for tid=29915 to stop
08-31 14:59:36.912 8546-8546/? E/AEE/AED: timed out waiting for tid=8434 to stop -
Recording a webpage stream with multiple requests using PhantomJS & ffmpeg to /dev/stdout leads to ffmpeg error
2 septembre 2016, par Allisson FerreiraFirst of all, sorry for my english.
I’m in a quest for days. I’ve researched everywhere and I couldn’t find an answer to my problem.
I’m using Nodejs, Phantomjs and ffmpeg in this scenary :
- An user enters the site, login with facebook and he can ask for a video with his name and some random photos (gathered by /me/ & sent via JSON POST) ;
- Node receive the user data, creates a child process (PhantomJS + ffmpeg) and awaits for a response to send the video URL to the user.
When I run a single instance of this request, everything is working fine. BUT, when two or more users make the request, only one video is sent and the others process end up in a ffmpeg stream error.
I think the reason is that all the ffmpeg processes are using the same place (/dev/stdout). Since one process is already using it, the others enters in a "can’t access" error. But it is a assumption, I don’t know how /dev/stdout really works.
Here are my codes. (I have removed some lines and renamed some variables for better understanding, sorry for any mistake)
index.js :
var generateVideo = 'phantomjs phantom.js '+videoID+' '+userID+' | ffmpeg -vcodec png -f image2pipe -r 30 -i - -pix_fmt yuv420p public/videos/'+userID+'/'+videoID+'.mp4 -y';
childProcess.exec(generateVideo, function(err, stdout, stderr) {
var json = {};
json.video = '/videos/'+userID+'/'+videoID+'.mp4';
res.send(json);
});phantom.js :
var page = require('webpage').create();
page.viewportSize = { width: 1366, height: 768 };
page.settings.resourceTimeout = 10000;
var args = require('system').args;
var videoID = args[1];
var userID = args[2];
page.open('http://localhost:3000/recordvideo/'+videoID, 'post', function(status){
var frame = 0;
var target_fps = 30;
var maxframes = page.evaluate(function () {
return getTotalDurationInSeconds();
}) * target_fps;
setInterval(function(){
page.render('/dev/stdout', { format: "png" });
if( frame >= maxframes ){
phantom.exit();
}
frame++;
}, (1000 / target_fps));
});And the error :
[Error: Command failed: /bin/sh -c phantomjs phantom.js XXXXXXXX XXXXXXXX | ffmpeg -vcodec png -f image2pipe -r 30 -i - -pix_fmt yuv420p public/videos/XXXXXXXX/XXXXXXXX.mp4 -y
www-0 ffmpeg version N-80901-gfebc862 Copyright (c) 2000-2016 the FFmpeg developers
www-0 built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
www-0 configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --mandir=/usr/share/man --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libfreetype --enable-gnutls --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvidstab
www-0 libavutil 55. 28.100 / 55. 28.100
www-0 libavcodec 57. 48.101 / 57. 48.101
www-0 libavformat 57. 41.100 / 57. 41.100
www-0 libavdevice 57. 0.102 / 57. 0.102
www-0 libavfilter 6. 47.100 / 6. 47.100
www-0 libavresample 3. 0. 0 / 3. 0. 0
www-0 libswscale 4. 1.100 / 4. 1.100
www-0 libswresample 2. 1.100 / 2. 1.100
www-0 libpostproc 54. 0.100 / 54. 0.100
www-0 [png @ 0x3d7c4a0] Invalid PNG signature 0x46726F6D20506861.
www-0 [image2pipe @ 0x3d72780] decoding for stream 0 failed
www-0 [image2pipe @ 0x3d72780] Could not find codec parameters for stream 0 (Video: png, none(pc)): unspecified size
www-0 Consider increasing the value for the 'analyzeduration' and 'probesize' options
www-0 Input #0, image2pipe, from 'pipe:':
www-0 Duration: N/A, bitrate: N/A
www-0 Stream #0:0: Video: png, none(pc), 30 tbr, 30 tbn, 30 tbc
www-0 [buffer @ 0x3d81540] Unable to parse option value "0x0" as image size
www-0 [buffer @ 0x3d81540] Unable to parse option value "-1" as pixel format
www-0 [buffer @ 0x3d81540] Unable to parse option value "0x0" as image size
www-0 [buffer @ 0x3d81540] Error setting option video_size to value 0x0.
www-0 [graph 0 input from stream 0:0 @ 0x3d72600] Error applying options to the filter.
www-0 Error opening filters!
www-0 ]I really hope that I can find an answer here !
And sorry if there already is an answer for this. But I researched for days.Thank you in advance !