Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
No such file or directory - ffmpegthumbnailer
8 juin 2016, par kajalFile Failed to thumbnail with ffmpegthumbnailer. Check ffmpegthumbnailer install and verify video is not corrupt. Original error: No such file or directory - ffmpegthumbnailer
-
FFmpeg is giving me nightmares
8 juin 2016, par GuillermoSo, I'm trying to save animations with the animation.save command. I installed ffmpeg in Windows 10 by placing a folder with its binaries in my drive C:\, I have also set the path in my system variables like C:\ffmpeg\bin, and finally, my code for the animation function saving looks like this
if save=='True': mywriter = animation.FFMpegWriter() plt.rcParams['animation.ffmpeg_path'] = 'C:/ffmpeg/bin' ani.save('mymovie.avi',writer=mywriter,fps=30)
and all other kind of variants such as:
mpl.animation.ffmpeg_path = r'C:\ffmpeg\bin' mpl.animation.ffmpeg_path = 'C:\\ffmpeg\\bin'
No matter what I do, the result is always:
File "
", line 2, in File "Plot.py", line 168, in animate ani.save('mymovie.avi',writer=mywriter,fps=30) File "c:\users\guillermo\appdata\local\enthought\canopy\user\lib\site-packages\matplotlib\animation.py", line 801, in save with writer.saving(self._fig, filename, dpi): File "C:\Users\Guillermo\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.6.1.3253.win-x86_64\lib\contextlib.py", line 17, in __enter__ return self.gen.next() File "c:\users\guillermo\appdata\local\enthought\canopy\user\lib\site-packages\matplotlib\animation.py", line 194, in saving self.setup(*args) File "c:\users\guillermo\appdata\local\enthought\canopy\user\lib\site-packages\matplotlib\animation.py", line 184, in setup self._run() File "c:\users\guillermo\appdata\local\enthought\canopy\user\lib\site-packages\matplotlib\animation.py", line 212, in _run creationflags=subprocess_creation_flags) File "C:\Users\Guillermo\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.6.1.3253.win-x86_64\lib\subprocess.py", line 710, in __init__ errread, errwrite) File "C:\Users\Guillermo\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.6.1.3253.win-x86_64\lib\subprocess.py", line 958, in _execute_child startupinfo) WindowsError: [Error 5] Access Denied Any ideas? :D
------------------------------------------------------------------------------
EDIT: I will reference this answer as it is the one that helped me the best: http://stackoverflow.com/a/27017734/6050676
It worked perfectly when using:
plt.rcParams['animation.ffmpeg_path'] = 'C:\\ffmpeg\\bin\\ffmpeg.exe'
-
FFMpeg copy streams without transcode
8 juin 2016, par ZelidI'm trying to copy all streams from several files into one file without transcoding streams. Something you usually do with
ffmpeg
utility byffmpeg -i “file_with_audio.mp4” -i “file_with_video.mp4” -c copy -shortest file_with_audio_and_video.mp4
This is the code:
int ffmpegOpenInputFile(const char* filename, AVFormatContext **ic) { int ret; unsigned int i; *ic = avformat_alloc_context(); if (!(*ic)) return -1; // Couldn't allocate input context if((ret = avformat_open_input(ic, filename, NULL, NULL)) < 0) return ret; // Couldn't open file // Get format info (retrieve stream information) if ((ret = avformat_find_stream_info(*ic, NULL)) < 0) return ret; // Couldn't find stream information for (int i = 0; i < (*ic)->nb_streams; i++) { AVStream *stream; AVCodecContext *codec_ctx; stream = (*ic)->streams[i]; codec_ctx = stream->codec; /* Reencode video & audio and remux subtitles etc. */ if (codec_ctx->codec_type == AVMEDIA_TYPE_VIDEO || codec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) { /* Open decoder */ ret = avcodec_open2(codec_ctx, avcodec_find_decoder(codec_ctx->codec_id), NULL); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Failed to open decoder for stream #%u\n", i); return ret; } } } // Dump information about file onto standard error av_dump_format(*ic, 0, filename, 0); return 0; } int main(int argc, char *argv[]) { const char *inputFilename1 = "/avfiles/video_input.mp4"; const char *inputFilename2 = "/avfiles/audio_input.mp4"; const char *filename = "/avfiles/out.mp4"; int ret; av_register_all(); AVFormatContext *ic1 = nullptr; AVFormatContext *ic2 = nullptr; AVFormatContext *oc = nullptr; if ((ret = ffmpegOpenInputFile(inputFilename1, &ic1)) < 0) return ret; // and free resources and if ((ret = ffmpegOpenInputFile(inputFilename2, &ic2)) < 0) return ret; // and free resources and AVOutputFormat *outfmt = av_guess_format(NULL, filename, NULL); if (outfmt == NULL) return -1; // Could not guess output format avformat_alloc_output_context2(&oc, outfmt, NULL, filename); if (!oc) return AVERROR_UNKNOWN; // Could not create output context // populate input streams from all input files AVStream **input_streams = NULL; int nb_input_streams = 0; for (int i = 0; i < ic1->nb_streams; i++) { input_streams = (AVStream **) grow_array(input_streams, sizeof(*input_streams), &nb_input_streams, nb_input_streams + 1); input_streams[nb_input_streams - 1] = ic1->streams[i]; } for (int i = 0; i < ic2->nb_streams; i++) { input_streams = (AVStream **) grow_array(input_streams, sizeof(*input_streams), &nb_input_streams, nb_input_streams + 1); input_streams[nb_input_streams - 1] = ic2->streams[i]; } for (int i = 0; i < nb_input_streams; i++) { AVStream *ist = input_streams[i]; // could be named 'm_in_vid_strm' // if output context has video codec support and current input stream is video if (/*oc->video_codec_id*/ oc->oformat->video_codec != AV_CODEC_ID_NONE && ist != NULL && ist->codec->codec_type == AVMEDIA_TYPE_VIDEO) { AVCodec *out_vid_codec = avcodec_find_encoder(oc->oformat->video_codec); if (NULL == out_vid_codec) return -1; // Couldn't find video encoder AVStream *m_out_vid_strm = avformat_new_stream(oc, out_vid_codec); if (NULL == m_out_vid_strm) return -1; // Couldn't output video stream m_out_vid_strm->id = 0; // XXX: ret = avcodec_copy_context(m_out_vid_strm->codec, ist->codec); if (ret < 0) return ret; // Failed to copy context } // if output context has audio codec support and current input stream is audio if (/*oc->audio_codec_id*/ oc->oformat->audio_codec != AV_CODEC_ID_NONE && ist != NULL && ist->codec->codec_type == AVMEDIA_TYPE_AUDIO) { AVCodec *out_aud_codec = avcodec_find_encoder(oc->oformat->audio_codec); if (nullptr == out_aud_codec) return -1; // couldn't find audio codec AVStream *m_out_aud_strm = avformat_new_stream(oc, out_aud_codec); if (nullptr == m_out_aud_strm) return -1; // couldn't allocate audio out stream ret = avcodec_copy_context(m_out_aud_strm->codec, ist->codec); if (ret < 0) return ret; // couldn't copy context } } // finally output header if (!(oc->flags & AVFMT_NOFILE)) { ret = avio_open(&oc->pb, filename, AVIO_FLAG_WRITE); if (ret < 0) return ret; // Could not open output file av_dump_format(oc, 0, filename, 1); ret = avformat_write_header(oc, NULL); if (ret < 0) return ret; // Error occurred when opening output file } return 0; }
avformat_write_header(oc, NULL);
always return error and I see this messages:[mp4 @ 0x7f84ec900a00] Using AVStream.codec.time_base as a timebase hint to the muxer is deprecated. Set AVStream.time_base instead. [mp4 @ 0x7f84ec900a00] Tag avc1/0x31637661 incompatible with output codec id '28' ([33][0][0][0])
But input and output streams match:
Input streams from 2 files: Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 2834 kb/s, 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc (default) Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default) Output #0, mp4, to '/Users/alex/Workspace/_qt/tubisto/avfiles/out.mp4': Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 2834 kb/s, 47.95 tbc Stream #0:1: Audio: aac (libvo_aacenc) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s
Why the error with incompatible output codec happens? What is wrong in my code and how to make it work to copy all streams from all input files to output file?
-
I want to merge two videos in golang . How can i do that ? [on hold]
8 juin 2016, par Kiran007Please provide me ways to do it.Any related Links would be helpful.
-
Android Video color effect issue using FFMPEG [on hold]
8 juin 2016, par umesh mishraI m facing one problem. when we use library for effect that i have mentioned below video is created only 1/3 of actual video size. please tell me what is issue. and also doesn't work on marshmallow. https://github.com/krazykira/VidEffects/wiki/Permanent-video-effects