
Recherche avancée
Médias (1)
-
Richard Stallman et le logiciel libre
19 octobre 2011, par
Mis à jour : Mai 2013
Langue : français
Type : Texte
Autres articles (107)
-
Emballe médias : à quoi cela sert ?
4 février 2011, parCe plugin vise à gérer des sites de mise en ligne de documents de tous types.
Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ; -
MediaSPIP Player : problèmes potentiels
22 février 2011, parLe lecteur ne fonctionne pas sur Internet Explorer
Sur Internet Explorer (8 et 7 au moins), le plugin utilise le lecteur Flash flowplayer pour lire vidéos et son. Si le lecteur ne semble pas fonctionner, cela peut venir de la configuration du mod_deflate d’Apache.
Si dans la configuration de ce module Apache vous avez une ligne qui ressemble à la suivante, essayez de la supprimer ou de la commenter pour voir si le lecteur fonctionne correctement : /** * GeSHi (C) 2004 - 2007 Nigel McNie, (...) -
Encoding and processing into web-friendly formats
13 avril 2011, parMediaSPIP automatically converts uploaded files to internet-compatible formats.
Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
All uploaded files are stored online in their original format, so you can (...)
Sur d’autres sites (9745)
-
Alsa audio playback program occurs underrun errors frequency
15 juillet 2021, par Tank2006My environment is Raspberry Pi 3B/Raspberry Pi OS, and I'm building remotely from Visual Studio 2019 on Windows 10.


I want to play PCM audio decoded by FFmpeg in ALSA(C language API).
But this code returns Underrun error(EPIPE) at "snd_pcm_writei" and plays a cracky sound.


Probably the way the resources are managed is wrong, but I don't know how to optimize it.


avres AlsaPlayer::OpenOutputDevice(AlsaDeviceType ao_type, OutputMode omode)
{
 memset(&output_format, 0, sizeof(InterfaceFormat));

 avres res;

 string dname = GetAlsaDeviceName(false, (ao_type == AD_DIGITAL));
 res = snd_pcm_open(&play_handle, dname.c_str(), SND_PCM_STREAM_PLAYBACK, 0);

 if (AV_FAILED(res)) return res;

 unsigned int sample_rate = DEFAULT_OUTPUT_RATE;
 uint64_t ch_layout = (ao_type == AD_ANALOG_6CH) ? AV_CH_LAYOUT_5POINT1 : AV_CH_LAYOUT_STEREO;
 int channels = av_get_channel_layout_nb_channels(ch_layout);

 snd_pcm_hw_params_t *hw_params;
 res = snd_pcm_hw_params_malloc(&hw_params);

 snd_pcm_hw_params_any(play_handle, hw_params);

 res = snd_pcm_hw_params_set_access(play_handle, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED);
 res = snd_pcm_hw_params_set_format(play_handle, hw_params, SND_PCM_FORMAT_S16_LE);
 res = snd_pcm_hw_params_set_channels(play_handle, hw_params, channels);
 res = snd_pcm_hw_params_set_rate_near(play_handle, hw_params, &sample_rate, 0);
 res = snd_pcm_hw_params(play_handle, hw_params);

 snd_pcm_uframes_t frames; 
 snd_pcm_hw_params_get_period_size(hw_params, &frames, 0);
 snd_pcm_hw_params_get_period_time(hw_params, &out_period_time, 0);

 snd_pcm_hw_params_free(hw_params);

 if (AV_FAILED(res)) return res;

 output_format.channels = channels;
 output_format.ch_layout = ch_layout;
 output_format.format = AV_SAMPLE_FMT_S16;
 output_format.frame_size = channels * 16 / 8;
 output_format.mode.output = omode;
 output_format.sample_rate = sample_rate;

 out_period_size = (int)frames * output_format.frame_size;
 out_buf_size = 10 * out_period_size;
 output_fifo = av_fifo_alloc(out_buf_size);

 return res;
}

void AlsaPlayer::RenderThread()
{
 while (av_fifo_size(output_fifo) == 0) usleep(1000);

 avres res;
 int frame_size = (output_format.mode.output == OutputMode::Analog) ? output_format.frame_size : 4;
 uint8_t *dst = new uint8_t[out_buf_size];
 while (need_exit == false) {
 int sz = FFMIN(out_buf_size, av_fifo_size(output_fifo));
 int frames = sz / frame_size;
 if (sz > frame_size) {
 res = av_fifo_generic_read(output_fifo, dst, sz, nullptr);
 res = (int)snd_pcm_writei(play_handle, dst, frames);

 if (AV_FAILED(res)) {
 if (AV_FAILED(snd_pcm_recover(play_handle, res, 0))) {
 need_exit = true;
 SendComErrorMessage(false, res, "dest_device_error");
 break;
 }
 }
 }
 }
 delete[]dst;
}



Can I pick your brains ?


-
DE-10 FFMPEG Raw YCbCr 4:2:2 Frame to PNG or Video leads to bad result
22 mai 2021, par Anouar TouatiSo i am trying to record analog video from analog-video in port of the DE10-standard board.


the raw frames are 4:2:2 720x480 hence frame size should be 720*480 * 2 = 691200bytes,however i get 2 more bytes with hex value 0 at the beginning of the frametwo leading bytes.


ffmpeg complains about wrong buffer size so i removed them.


using
ffmpeg -y -s 720x480 -pix_fmt yuv422p -i input_frame.yuv output_image.png

the result is way off.

analog video fed to the board has still image (photo taken by phone from TV) Reference Pic.
and the result from ffmpeg is FFMPEG output.


i used HxD editor and mirrored that single frame many times to create a larger file then used the following command to encode it to MP4 file which give the same result.


ffmpeg -y -s 720x480 -pix_fmt yuv422p -i dump_video.yuv output_video.mp4
.

i hope someone can help to fix the issue or point me in the right direction as i dont know if the problem is from hardware or from ffmpeg command. Thnx.


-
Using ffmpeg on Ubuntu, how can the audio and video from an audio-video USB capture device be recorded ?
11 avril 2022, par BlandCorporationI have a USB audio-video capture device, something used to digitize video cassettes. I want to record both the video and audio from the device to a video file that has dimensions 720x576 and video codec H.264 and good audio quality.


I am able to record video from the device using ffmpeg and I am able to see video from the device using MPlayer. I am able also to see that audio is being delivered from the device to the computer by looking at Input tab of the Sound Preferences window or by recording the audio using Audacity, however the audio gets delivered from the device apparently only when the video is being accessed using ffmpeg or MPlayer.


I have tried to get ffmpeg to record the audio and I have tried to get MPlayer to play the audio and my efforts have not been successful.


The device is "Pinnacle Dazzle DVC 90/100/101" (as returned by
v4l2-ctl --list-devices
). The sound cards listing shows it as "DVC100" :

$ cat /proc/asound/cards 
 0 [PCH ]: HDA-Intel - HDA Intel PCH
 HDA Intel PCH at 0x601d118000 irq 171
 1 [DVC100 ]: USB-Audio - DVC100
 Pinnacle Systems GmbH DVC100 at usb-0000:00:14.0-4, high speed
29 [ThinkPadEC ]: ThinkPad EC - ThinkPad Console Audio Control
 ThinkPad Console Audio Control at EC reg 0x30, fw N2LHT33W



The PulseAudio listing for the device is as follows :


$ pactl list cards short
0 alsa_card.pci-0000_00_1f.3 module-alsa-card.c
14 alsa_card.usb-Pinnacle_Systems_GmbH_DVC100-01 module-alsa-card.c



The following ffmpeg command successfully records video, but records severely distorted, broken and out-of-sync audio :


ffmpeg -y -f rawvideo -f alsa -thread_queue_size 2048 -ar 48000 -i hw:0 \
 -c:a aac -video_size 720x576 -pixel_format uyvy422 -i /dev/video2 out.mp4



The following MPlayer command successfully displays the video but does not play the audio :


mplayer -tv driver=v4l2:norm=PAL:device=/dev/video2:width=720:height=576 \
 -ao alsa:device=hw=1.0 -vf pp=lb tv://



Now, when the above MPlayer command is running (not the ffmpeg command) and displaying the input video in a window, Audacity can be opened and set recording audio, and it records the audio from the device clearly and in good quality. While Audacity is doing this, the input device is listed in
pavucontrol
as "Dazzle DVC Audio Device Analogue Stereo". Equivalently, arecord can be used also to record the audio using the following command (with output shown) :

$ arecord -vv -D plughw:DVC100 -fdat out.wav
Recording WAVE 'out.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
Plug PCM: Hardware PCM card 1 'DVC100' device 0 subdevice 0
Its setup is:
 stream : CAPTURE
 access : RW_INTERLEAVED
 format : S16_LE
 subformat : STD
 channels : 2
 rate : 48000
 exact rate : 48000 (48000/1)
 msbits : 16
 buffer_size : 24000
 period_size : 6000
 period_time : 125000
 tstamp_mode : NONE
 tstamp_type : MONOTONIC
 period_step : 1
 avail_min : 6000
 period_event : 0
 start_threshold : 1
 stop_threshold : 24000
 silence_threshold: 0
 silence_size : 0
 boundary : 6755399441055744000
 appl_ptr : 0
 hw_ptr : 0



Looking at the output of
arecord -L
, I tried a variety of audio device input names with ffmpeg and none of them seemed to work. So, for example, I tried commands like the following :

ffmpeg -y -f rawvideo -f alsa -i plughw:DVC100 \
 -video_size 720x576 -pixel_format uyvy422 -i /dev/video2 out.mp4



And tried the following audio device names :


plughw:DVC100
plughw:CARD=DVC100,DEV=0
hw:CARD=DVC100,DEV=0
plughw:CARD=DVC100
sysdefault:CARD=DVC100
iec958:CARD=DVC100,DEV=0
dsnoop:CARD=DVC100,DEV=0



So, how might I get ffmpeg to record the audio successfully to the video file ? Is there some alternative approach to this problem ?



EDIT : The relevant output from the command
pactl list sources
is as follows :

Source #20
 State: SUSPENDED
 Name: alsa_input.usb-Pinnacle_Systems_GmbH_DVC100-01.analog-stereo
 Description: Dazzle DVC100 Audio Device Analogue Stereo
 Driver: module-alsa-card.c
 Sample Specification: s16le 2ch 48000Hz
 Channel Map: front-left,front-right
 Owner Module: 45
 Mute: no
 Volume: front-left: 99957 / 153% / 11.00 dB, front-right: 99957 / 153% / 11.00 dB
 balance 0.00
 Base Volume: 35466 / 54% / -16.00 dB
 Monitor of Sink: n/a
 Latency: 0 usec, configured 0 usec
 Flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY 
 Properties:
 alsa.resolution_bits = "16"
 device.api = "alsa"
 device.class = "sound"
 alsa.class = "generic"
 alsa.subclass = "generic-mix"
 alsa.name = "USB Audio"
 alsa.id = "USB Audio"
 alsa.subdevice = "0"
 alsa.subdevice_name = "subdevice #0"
 alsa.device = "0"
 alsa.card = "1"
 alsa.card_name = "DVC100"
 alsa.long_card_name = "Pinnacle Systems GmbH DVC100 at usb-0000:00:14.0-4, high speed"
 alsa.driver_name = "snd_usb_audio"
 device.bus_path = "pci-0000:00:14.0-usb-0:4:1.1"
 sysfs.path = "/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.1/sound/card1"
 udev.id = "usb-Pinnacle_Systems_GmbH_DVC100-01"
 device.bus = "usb"
 device.vendor.id = "2304"
 device.vendor.name = "Pinnacle Systems, Inc."
 device.product.id = "021a"
 device.product.name = "Dazzle DVC100 Audio Device"
 device.serial = "Pinnacle_Systems_GmbH_DVC100"
 device.string = "front:1"
 device.buffering.buffer_size = "352800"
 device.buffering.fragment_size = "176400"
 device.access_mode = "mmap+timer"
 device.profile.name = "analog-stereo"
 device.profile.description = "Analogue Stereo"
 device.description = "Dazzle DVC100 Audio Device Analogue Stereo"
 alsa.mixer_name = "USB Mixer"
 alsa.components = "USB2304:021a"
 module-udev-detect.discovered = "1"
 device.icon_name = "audio-card-usb"
 Ports:
 analog-input-linein: Line In (priority: 8100)
 Active Port: analog-input-linein
 Formats:
 pcm



I tested the name from this with ffmpeg (version 4.3.1, compiled with
-enable-libpulse
) in the following way :

ffmpeg -y -f video4linux2 -f pulse \
 -i alsa_input.usb-Pinnacle_Systems_GmbH_DVC100-01.analog-stereo \
 -video_size 720x576 -pixel_format uyvy422 -i /dev/video2 out.mp4



Unfortunately this hasn't worked.