
Recherche avancée
Autres articles (97)
-
Qu’est ce qu’un éditorial
21 juin 2013, parEcrivez votre de point de vue dans un article. Celui-ci sera rangé dans une rubrique prévue à cet effet.
Un éditorial est un article de type texte uniquement. Il a pour objectif de ranger les points de vue dans une rubrique dédiée. Un seul éditorial est placé à la une en page d’accueil. Pour consulter les précédents, consultez la rubrique dédiée.
Vous pouvez personnaliser le formulaire de création d’un éditorial.
Formulaire de création d’un éditorial Dans le cas d’un document de type éditorial, les (...) -
Contribute to translation
13 avril 2011You can help us to improve the language used in the software interface to make MediaSPIP more accessible and user-friendly. You can also translate the interface into any language that allows it to spread to new linguistic communities.
To do this, we use the translation interface of SPIP where the all the language modules of MediaSPIP are available. Just subscribe to the mailing list and request further informantion on translation.
MediaSPIP is currently available in French and English (...) -
Des sites réalisés avec MediaSPIP
2 mai 2011, parCette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.
Sur d’autres sites (7440)
-
Unable to find replacement for -vol [closed]
21 février 2024, par Michael BentonI'm referring to this thread posted years ago.


While I was testing Downmixing without discarding the LFE channel (Dave_750's answer) on ffmpeg, which included the formula


ffmpeg -i "sourcetrack.dts" -c dca -vol 425 -af "pan=stereo|c0=0.5*c2+0.707*c0+0.707*c4+0.5*c3|c1=0.5*c2+0.707*c1+0.707*c5+0.5*c3" "outputstereo.dts"



the cmd raised the following error :


Unrecognized option 'vol'. Error splitting the argument list: Option not found



The formula I put in cmd wasn't the same as the one in the thread at the beginning, because I replaced in it the attributes of my ac3 track.


ffmpeg -i "inputsurround.ac3" -vol 425 -af "pan=stereo|c0=0.5*c2+0.707*c0+0.707*c4+0.5*c3|c1=0.5*c2+0.707*c1+0.707*c5+0.5*c3" -c:a ac3 -b:a 320k -ar 48000 "outputstereo.ac3"



Through this thread, I discovered that the -vol function was deprecated years ago.


I found another thread where the syntax used was


-af volume=N



(where N stands for a percentage or, if N is followed by "dB", a dB value).


I'm not sure if -af volume behaves exactly like -vol while downmixing to stereo the ac3.


I went back editing the formula :


ffmpeg -i "inputsurround.ac3" -af "volume=425" -af "pan=stereo|c0=0.5*c2+0.707*c0+0.707*c4+0.5*c3|c1=0.5*c2+0.707*c1+0.707*c5+0.5*c3" -c:a ac3 -b:a 320k -ar 48000 "outputstereo.ac3"



It raised the following warning (which didn't stop the file generation) :


Multiple -filter/-af/-vf options specified for stream 0, only the last option '-filter:a pan=stereo|c0=0.5*c2+0.707*c0+0.707*c4+0.5*c3|c1=0.5*c2+0.707*c1+0.707*c5+0.5*c3' will be used



As I already suspected, I couldn't use two "-af" in the same command. The generated file is useless, because ffmpeg only applied one of the two commands. I also tried with N defined in dB, with no success.


I continued my search and, from another thread, I learned that I could use


-filter_complex "[1] formula1;[0] formula2"



to resolve my issue.


My formula then became :


ffmpeg -i "inputsurround.ac3" -filter_complex "[1]volume=425;[0]pan=stereo|c0=0.5*c2+0.707*c0+0.707*c4+0.5*c3|c1=0.5*c2+0.707*c1+0.707*c5+0.5*c3" -c:a ac3 -b:a 320k -ar 48000 "outputstereo.ac3"



And it still raised an error :


Invalid file index 1 in filtergraph description [1]volume=425;[0]pan=stereo|c0=0.5*c2+0.707*c0+0.707*c4+0.5*c3|c1=0.5*c2+0.707*c1+0.707*c5+0.5*c3.
Error initializing complex filters: Invalid argument



To simplify the formula, I went back using -af with the properties of -filter_complex. And I got :


ffmpeg -i "inputsurround.ac3" -af "[1]volume=425;[0]pan=stereo|c0=0.5*c2+0.707*c0+0.707*c4+0.5*c3|c1=0.5*c2+0.707*c1+0.707*c5+0.5*c3" -c:a ac3 -b:a 320k -ar 48000 "outputstereo.ac3"



Again, another error :


Simple filtergraph '[1]volume=425;[0]pan=stereo|c0=0.5*c2+0.707*c0+0.707*c4+0.5*c3|c1=0.5*c2+0.707*c1+0.707*c5+0.5*c3' was expected to have exactly 1 input and 1 output. However, it had 2 input(s) and 2 output(s). Please adjust, or use a complex filtergraph (-filter_complex) instead.
[aost#0:0/ac3 @ 000001d83b4c4200] Error initializing a simple filtergraph
Error opening output file outputstereo.ac3.
Error opening output files: Invalid argument



whether I used a semicolon or comma as a separator.


I'm completely lost at this point as I don't have deep knowledge of the topic.


- 

-
has -vol been deprecated or I've searched badly/it's a syntax typo ?


-
if -vol has been deprecated, is there a way to rewrite the formula such that it outputs the result intended by the original user ?


-
if I replace c0, c1, c2, c3, c4, c5 to FL, FR, FC, LF, BL, BR in the formula, would I get a different channel layout ? (my file is : L, R, C, LFE, Ls, Rs)










I'll try to clear every doubt. Any help is highly appreciated !


-
-
FileNotFoundError : [WinError 2] The system cannot find the file specified - FFMPEG
5 avril 2024, par shiftyscalesI am running a script using conda environment on Windows and getting this error (stack trace below), which is apparently caused by python executable not being able to find the ffmpeg.exe. There are numerous questions about this, but none of the solutions unfortunately worked for me, so I hope someone has fresh ideas.


What I tried :


- 

conda install -c conda-forge ffmpeg
(after this I can run ffmpeg in command line, but still getting the error)pip install ffmpeg-python
- Added the folder where ffmpeg.exe is located in conda env to the Windows Path as well as to sys.path in python.
- copied the same ffmpeg.exe a) to the location of python.exe in conda env, b) to the location of the script I am running, c) to the location of subprocess.py.
- Downloaded ffmpeg windows binary and repeated the last two steps with that file.












Is there anything else that I can try to make it work ?


---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
Cell In[10], line 22
 19 truncate_second = 8.2 # Video end = start_second + truncate_second
 21 # Extract Video CAVP Features & New Video Path:
---> 22 cavp_feats, new_video_path = extract_cavp(video_path, start_second, truncate_second, tmp_path=tmp_path)

File D:\Software\Anaconda\envs\diff_foley\Lib\site-packages\torch\nn\modules\module.py:1518, in Module._wrapped_call_impl(self, *args, **kwargs)
 1516 return self._compiled_call_impl(*args, **kwargs) # type: ignore[misc]
 1517 else:
-> 1518 return self._call_impl(*args, **kwargs)

File D:\Software\Anaconda\envs\diff_foley\Lib\site-packages\torch\nn\modules\module.py:1527, in Module._call_impl(self, *args, **kwargs)
 1522 # If we don't have any hooks, we want to skip the rest of the logic in
 1523 # this function, and just call forward.
 1524 if not (self._backward_hooks or self._backward_pre_hooks or self._forward_hooks or self._forward_pre_hooks
 1525 or _global_backward_pre_hooks or _global_backward_hooks
 1526 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1527 return forward_call(*args, **kwargs)
 1529 try:
 1530 result = None

File D:\Software\Anaconda\envs\diff_foley\Lib\site-packages\torch\utils\_contextlib.py:115, in context_decorator.<locals>.decorate_context(*args, **kwargs)
 112 @functools.wraps(func)
 113 def decorate_context(*args, **kwargs):
 114 with ctx_factory():
--> 115 return func(*args, **kwargs)

File D:\Work\DIff-Foley\Diff-Foley\inference\demo_util.py:131, in Extract_CAVP_Features.forward(self, video_path, start_second, truncate_second, tmp_path)
 129 print("truncate second: ", truncate_second)
 130 # Load the video, change fps:
--> 131 video_path_low_fps = reencode_video_with_diff_fps(video_path, self.tmp_path, self.fps, start_second, truncate_second)
 132 video_path_high_fps = reencode_video_with_diff_fps(video_path, self.tmp_path, 21.5, start_second, truncate_second)
 134 # read the video:

File D:\Work\DIff-Foley\Diff-Foley\inference\demo_util.py:42, in reencode_video_with_diff_fps(video_path, tmp_path, extraction_fps, start_second, truncate_second)
 31 def reencode_video_with_diff_fps(video_path: str, tmp_path: str, extraction_fps: int, start_second, truncate_second) -> str:
 32 '''Reencodes the video given the path and saves it to the tmp_path folder.
 33 
 34 Args:
 (...)
 40 str: The path where the tmp file is stored. To be used to load the video from
 41 '''
---> 42 assert which_ffmpeg() != '', 'Is ffmpeg installed? Check if the conda environment is activated.'
 43 # assert video_path.endswith('.mp4'), 'The file does not end with .mp4. Comment this if expected'
 44 # create tmp dir if doesn't exist
 45 os.makedirs(tmp_path, exist_ok=True)

File D:\Work\DIff-Foley\Diff-Foley\inference\demo_util.py:26, in which_ffmpeg()
 20 def which_ffmpeg() -> str:
 21 '''Determines the path to ffmpeg library
 22 
 23 Returns:
 24 str -- path to the library
 25 '''
---> 26 result = subprocess.run(['which', 'ffmpeg'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
 27 ffmpeg_path = result.stdout.decode('utf-8').replace('\n', '')
 28 return ffmpeg_path

File D:\Software\Anaconda\envs\diff_foley\Lib\subprocess.py:548, in run(input, capture_output, timeout, check, *popenargs, **kwargs)
 545 kwargs['stdout'] = PIPE
 546 kwargs['stderr'] = PIPE
--> 548 with Popen(*popenargs, **kwargs) as process:
 549 try:
 550 stdout, stderr = process.communicate(input, timeout=timeout)

File D:\Software\Anaconda\envs\diff_foley\Lib\subprocess.py:1026, in Popen.__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, user, group, extra_groups, encoding, errors, text, umask, pipesize, process_group)
 1022 if self.text_mode:
 1023 self.stderr = io.TextIOWrapper(self.stderr,
 1024 encoding=encoding, errors=errors)
-> 1026 self._execute_child(args, executable, preexec_fn, close_fds,
 1027 pass_fds, cwd, env,
 1028 startupinfo, creationflags, shell,
 1029 p2cread, p2cwrite,
 1030 c2pread, c2pwrite,
 1031 errread, errwrite,
 1032 restore_signals,
 1033 gid, gids, uid, umask,
 1034 start_new_session, process_group)
 1035 except:
 1036 # Cleanup if the child failed starting.
 1037 for f in filter(None, (self.stdin, self.stdout, self.stderr)):

File D:\Software\Anaconda\envs\diff_foley\Lib\subprocess.py:1538, in Popen._execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_gid, unused_gids, unused_uid, unused_umask, unused_start_new_session, unused_process_group)
 1536 # Start the process
 1537 try:
-> 1538 hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
 1539 # no special security
 1540 None, None,
 1541 int(not close_fds),
 1542 creationflags,
 1543 env,
 1544 cwd,
 1545 startupinfo)
 1546 finally:
 1547 # Child is launched. Close the parent's copy of those pipe
 1548 # handles that only the child should have open. You need
 (...)
 1551 # pipe will not close when the child process exits and the
 1552 # ReadFile will hang.
 1553 self._close_pipe_fds(p2cread, p2cwrite,
 1554 c2pread, c2pwrite,
 1555 errread, errwrite)

FileNotFoundError: [WinError 2] The system cannot find the file specified
</locals>


-
avio_open() function returns -138
8 avril 2024, par checkrightWhen I use ffmpeg4.4.1 to push rtmp to the desktop, the program returns -138 when running avio_open().I use dshow's screen-capture-recorder on the input side. My purpose is to capture the desktop in real time and use rtmp to push the stream.


avdevice_register_all();
 avformat_network_init();

 AVFormatContext* pFmtCtx_In = nullptr;
 AVFormatContext* pFmtCtx_Out = nullptr;
 AVInputFormat* pInFmt = nullptr;
 AVDictionary* options = nullptr;
 int nVideoIndex = -1;
 int ret = 0;

 AVCodecParameters* pCodecParam = nullptr;
 AVCodecContext * pCodecCtx = nullptr;
 AVCodec * pCodec = nullptr;

 AVFrame* pFrame = av_frame_alloc();
 AVFrame* pFrameRGB = av_frame_alloc();
 AVPacket* pkt = nullptr;

 pFrame = av_frame_alloc();
 pFrameRGB = av_frame_alloc();
 pkt = nullptr;
 img_convert_ctx = nullptr;

 pFmtCtx_In = avformat_alloc_context();
 if(!pFmtCtx_In)
 {
 qDebug() << "create AVFormatContext failed." ;
 return;
 }

 QString urlString = QString("video=screen-capture-recorder");
 const char* rtmpAddress = "rtmp://192.168.0.136:8554/myapp/test";
 
 if(1){
 pInFmt = const_cast(av_find_input_format("dshow"));
 ret = avformat_open_input(&pFmtCtx_In, urlString.toStdString().c_str(), pInFmt, nullptr);
 }else{
 pInFmt = const_cast(av_find_input_format("gdigrab"));
 av_dict_set(&options, "video_device_index", "1", 0); 
 av_dict_set(&options, "offset_x", "1920", 0);
 av_dict_set(&options, "offset_y", "0", 0);
 av_dict_set(&options, "draw_mouse", "1", 0);
 av_dict_set(&options, "video_size", "1920x1080", 0);
 ret = avformat_open_input(&pFmtCtx_In, "desktop", pInFmt, &options);
 }

 if(!pInFmt)
 {
 qDebug() << "find AVInputFormat failed." ;
 return;
 }

 if(ret < 0)
 {
 qDebug() << "open camera failed."<nb_streams; i++){
 if(pFmtCtx_In->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO){
 nVideoIndex = i;
 continue;
 }
 }

 if(nVideoIndex == -1){
 qDebug() << "cannot find video stream." ;
 return;
 }


 pCodecParam = pFmtCtx_In->streams[nVideoIndex]->codecpar;
 pCodec = avcodec_find_decoder(pCodecParam->codec_id);
 if(!pCodec)
 {
 qDebug() << "cannot find codec." ;
 return;
 }

 ret = avformat_alloc_output_context2(&pFmtCtx_Out, NULL, "flv", rtmpAddress);
 // ret = avformat_alloc_output_context2(&pFmtCtx_Out, NULL, "rtsp", rtmpAddress);
 if (ret < 0) {
 qDebug() << "cannot avformat_alloc_output_context2." ;
 return ;
 }

 for (int i = 0; i < pFmtCtx_In->nb_streams; i++) {
 AVStream *outStream = avformat_new_stream(pFmtCtx_Out, pFmtCtx_In->streams[i]->codec->codec);
 if (!outStream) {
 qDebug() << "cannot outStream." ;

 return ;
 }

 ret = avcodec_parameters_copy(outStream->codecpar, pFmtCtx_In->streams[i]->codecpar);
 if (ret < 0) {
 qDebug() << "cannot avcodec_parameters_copy." ;
 return ;
 }
 outStream->codec->codec_tag = 0;
 }
 
 av_dump_format(pFmtCtx_Out, 0, rtmpAddress, 1);

 ret = avio_open(&pFmtCtx_Out->pb, rtmpAddress, AVIO_FLAG_WRITE);
 if (ret < 0) {
 qDebug() << "cannot avio_open." <code>


An error occurs here.According to the data, the problem occurs at the input end, and the input end can display the desktop normally. How can I make it run successfully ? How do I need to modify the above code ?