Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
How to record video and audio from webcam using ffmpeg on Windows ?
19 janvier, par BabuI want to record video as well as audio from webcam using ffmpeg,
I have used the following codes to know what devices are available:
ffmpeg -list_devices true -f dshow -i dummy
And got the result:
ffmpeg version N-54082-g96b33dd Copyright (c) 2000-2013 the FFmpeg developers built on Jun 17 2013 02:05:16 with gcc 4.7.3 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp eex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo- amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs -- enable-libxvid --enable-zlib libavutil 52. 37.101 / 52. 37.101 libavcodec 55. 16.100 / 55. 16.100 libavformat 55. 8.103 / 55. 8.103 libavdevice 55. 2.100 / 55. 2.100 libavfilter 3. 77.101 / 3. 77.101 libswscale 2. 3.100 / 2. 3.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 3.100 / 52. 3.100 [dshow @ 024eb460] DirectShow video devices [dshow @ 024eb460] "Sirius USB2.0 Camera" [dshow @ 024eb460] "Vimicro USB Camera (Altair)" [dshow @ 024eb460] DirectShow audio devices [dshow @ 024eb460] "Microphone (Realtek High Defini" dummy: Immediate exit requested
I am using the following codes to get more details about the device:
ffmpeg -f dshow -list_options true -i video="Vimicro USB Camera (Altair)"
And i am getting the following results:
ffmpeg version N-54082-g96b33dd Copyright (c) 2000-2013 the FFmpeg developers built on Jun 17 2013 02:05:16 with gcc 4.7.3 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp eex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo- amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs -- enable-libxvid --enable-zlib libavutil 52. 37.101 / 52. 37.101 libavcodec 55. 16.100 / 55. 16.100 libavformat 55. 8.103 / 55. 8.103 libavdevice 55. 2.100 / 55. 2.100 libavfilter 3. 77.101 / 3. 77.101 libswscale 2. 3.100 / 2. 3.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 3.100 / 52. 3.100 [dshow @ 0249b3e0] DirectShow video device options [dshow @ 0249b3e0] Pin "Capture" [dshow @ 0249b3e0] pixel_format=yuyv422 min s=640x480 fps=30 max s=640x480 fp s=30 [dshow @ 0249b3e0] pixel_format=yuyv422 min s=640x480 fps=30 max s=640x480 fp s=30 [dshow @ 0249b3e0] pixel_format=yuyv422 min s=352x288 fps=30 max s=352x288 fp s=30 [dshow @ 0249b3e0] pixel_format=yuyv422 min s=352x288 fps=30 max s=352x288 fp s=30 [dshow @ 0249b3e0] pixel_format=yuyv422 min s=320x240 fps=30 max s=320x240 fp s=30 [dshow @ 0249b3e0] pixel_format=yuyv422 min s=320x240 fps=30 max s=320x240 fp s=30 [dshow @ 0249b3e0] pixel_format=yuyv422 min s=176x144 fps=30 max s=176x144 fp s=30 [dshow @ 0249b3e0] pixel_format=yuyv422 min s=176x144 fps=30 max s=176x144 fp s=30 [dshow @ 0249b3e0] pixel_format=yuyv422 min s=160x120 fps=30 max s=160x120 fp s=30 [dshow @ 0249b3e0] pixel_format=yuyv422 min s=160x120 fps=30 max s=160x120 fp s=30 video=Vimicro USB Camera (Altair): Immediate exit requested
When i am trying following codes to get video and audio stream:
ffmpeg -f dshow -s 320x240 -r 30 -vcodec mjpeg -i video="Vimicro USB Camera (Altair)" e:\output.mp4
I am getting an error message as "Could not set video options video=Vimicro USB Camera (Altair): Input/output error"
Following are the error details:
ffmpeg version N-54082-g96b33dd Copyright (c) 2000-2013 the FFmpeg developers built on Jun 17 2013 02:05:16 with gcc 4.7.3 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp eex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo- amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs -- enable-libxvid --enable-zlib libavutil 52. 37.101 / 52. 37.101 libavcodec 55. 16.100 / 55. 16.100 libavformat 55. 8.103 / 55. 8.103 libavdevice 55. 2.100 / 55. 2.100 libavfilter 3. 77.101 / 3. 77.101 libswscale 2. 3.100 / 2. 3.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 3.100 / 52. 3.100 [dshow @ 002f78e0] Could not set video options video=Vimicro USB Camera (Altair): Input/output error
And i am unable to find where i am doing wrong.
So if anybody can find where i am doing wrong or how to record video as well as audio from webcam using ffmpeg please help me to solve this problem.
-
output of ffmpeg comes out like yamborghini high music video
19 janvier, par chipI do this procedure when I edit a long video
- segment to 3 second videos, so I come up with a lot of short videos
- I randomly pick videos and put them in a list
- then I join these short videos together using concat
- now I get a long video again. next thing I do is segment the video 4 minute videos
After processing, the videos look messed up. I don't know how to describe it but it looks like the music video yamborghini high
For some reason, this only happens to videos I capture at night. I do the same process for day time footage, no problem.
is there a problem with slicing, merging and then slicing again?
or is it an issue that I run multiple ffmpeg scripts at the same time?
here's the script
for FILE in *.mp4; do ffmpeg -i ${FILE} -vcodec copy -f segment -segment_time 00:10 -reset_timestamps 1 "part_$( date '+%F%H%M%S' )_%02d.mp4"; rm -rf $FILE; done; echo 'slicing completed.' && \ for f in part_*[13579].mp4; do echo "file '$f'" >> mylist.txt; done ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4 && echo 'done merging.' && \ ffmpeg -i output.mp4 -threads 7 -vcodec copy -f segment -segment_time 04:00 -reset_timestamps 1 "Video_Title_$( date '+%F%H%M%S' ).mp4" && echo 'individual videos created'
-
Is there an elegant way to split a file by chapter using ffmpeg ?
18 janvier, par KatternIn this page, Albert Armea share a code to split videos by chapter using
ffmpeg
. The code is straight forward, but not quite good-looking.ffmpeg -i "$SOURCE.$EXT" 2>&1 | grep Chapter | sed -E "s/ *Chapter #([0-9]+\.[0-9]+): start ([0-9]+\.[0-9]+), end ([0-9]+\.[0-9]+)/-i \"$SOURCE.$EXT\" -vcodec copy -acodec copy -ss \2 -to \3 \"$SOURCE-\1.$EXT\"/" | xargs -n 11 ffmpeg
Is there an elegant way to do this job?
-
ffmpeg's parser_parse2 example malfunctions [closed]
18 janvier, par Binary198I'm currently using
ffmpeg
to parse MP4s; my current setup (with declarations and error-handling omitted) is:pkt = av_packet_alloc(); codec = avcodec_find_decoder(AV_CODEC_ID_MPEG4); parser = av_parser_init(codec->id); c = avcodec_alloc_context3(codec); avcodec_open2(c, codec, NULL); frame = av_frame_alloc(); while (!feof(args.fp_read)) { data_size = fread(inbuf, 1, INBUF_SIZE, args.fp_read); data = inbuf; while (data_size > 0) { ret = av_parser_parse2(parser, c, &pkt->data, &pkt->size, data, data_size, AV_NOPTS_VALUE, AV_NOPTS_VALUE, 0); data += ret; data_size -= ret; if (pkt->size) { decode(c, frame, pkt, "eggs"); } } } decode(c, frame, NULL, "eggs"); av_parser_close(parser); avcodec_free_context(&c); av_frame_free(&frame); av_packet_free(&pkt);
This is copied basically verbatim from one of the examples in the
ffmpeg
repo (eggs
is obviously just a test string), so I can get to grips with how it's done before customizing it. Unfortunately,pkt->size
seems to remain zero the whole time, so no decoding is done, despite the whole 232 KiB test file being read. Some extra logging stuff showsdata
never changes yetret
is always 4096 (until the last call), andpkt->data
andpkt->size
remainNULL
and0
, respectively:Reading file... Reading 4096 bytes from file... Read. pkt->data (nil) pkt->size 0 data 0x72ec890000a0 data_size 4096 ret 4096. Reading 4096 bytes from file... Read. pkt->data (nil) pkt->size 0 data 0x72ec890000a0 data_size 4096 ret 4096. Reading 4096 bytes from file... Read. [snip] pkt->data (nil) pkt->size 0 data 0x72ec890000a0 data_size 3959 ret 3959. Cleaning up... Bytes read: 237431.
Does anybody know how I should edit the parameters to get av_parser_parse2 properly working? I feel like it could be related to the initialization of pkt, even though calling
av_new_packet(pkt, INBUF_SIZE)
later didn't change the results. I don't think it's an issue with the actual MP4 stream being parsed - I can play the video in VLC perfectly fine. -
How can I use ffmpeg and youtube-dl to download the first frame of every video in a playlist ?
18 janvier, par Chi Long QuaI'm trying to download only the first frame of every video in a large playlist on YouTube. Does anybody know how I can use ffmpeg and youtube-dl to do this?