Newest 'ffmpeg' Questions - Stack Overflow

http://stackoverflow.com/questions/tagged/ffmpeg

Les articles publiés sur le site

  • How to display and capture webcam stream at the same time ? [migrated]

    5 octobre 2011, par 12hys

    This command works perfectly for saving a webcam stream to a file:

    ffmpeg -f alsa -i default -itsoffset 00:00:00 -f video4linux2 -s 1280x720 -r 25 -i /dev/video0  out.avi
    

    How would I simultaneously display this captured stream on my computer screen?

  • A way to convert bitrate/format of audio files (between upload & storage to S3)

    5 octobre 2011, par Jonathan Coe

    Currently using PHP 5.3.x & Fedora

    Ok. I'll try to keep this simple. I'm working on a tool that allows the upload & storing of audio files on S3 for playback. Essentially, the user uploads a file (currently only allowing mp3 & m4a) to the server, and the file is then pushed to S3 for storage via the PHP SDK for amazon aws.

    The missing link is that I would like to perform a simple bitrate & format conversion of the file prior to uploading the file. (ensuring that all files are 160kbs and .mp3).

    I've looked into ffmpeg, although it seems that the PHP library only allows for reading bitrates and other meta, not for actual conversion.

    Does anyone have any thoughts on the best way to approach this? Would running a shell_exec() command that performs the conversion be sufficient to do this, or is there a more efficient/better way of doing this?

    Thanks in advance! Any help or advice is much appreciated.

  • DirectShow RTSP SourceFilter with MPEG-4 Video Stream

    5 octobre 2011, par 6.45.Vapuru

    I create a simple direct show source filter using FFmpeg.I read rtp packets from RTSP source and give them to decoder. It works for h264 stream.

    MyRtspSourceFilter[H264 Stream] ---> h264 Decoder --> Video Renderer
    

    The bad news is that it does not work for MPEG-4. I can able to connect my rtsp source filter with MPEG-Decoder. I got no exception but video renderer does not show anything. Actually just show one frame then nothing [just stop]... Decoders and Renderers are 3rd party so i can not debug them.

    MyRtspSourceFilter[MP4 Stream] ---> MPEG-4 Decoder --> Video Renderer
    

    I can able to get rtp packets from MPEG-4 RTSP Source using FFmpeg sucessfully.There is no problem with it.

    It seems that i have not set something(?) in my Rtsps Source Filter which is not necessary for H264 stream but may be important for MPEG-4 stream

    What may cause this h264 stream and MPEG-4 stream difference in a direct show rtsp source filter? Any ideas.

    More Info:

    -- First i try some other rtsp source filters for MPEG-4 Stream...Although my rtsp source is same i see different subtypes in their pin connections.

    -- Secondly i realy get suspicious if the source is really MPEG-4 SO i check with FFmpeg...FFmpeg gives the source codec id as "CODEC_ID_MPEG4".

    Update: [ Hack ]

    I just set m_bmpInfo.biCompression = DWORD('xvid') it just worked fine...But it is static. How to dynamically get/determine this value using ffmpeg or other ways...

  • What is the minimum buffer size needed to initialize .ts (transport stream) file using FFMPEG

    5 octobre 2011, par user783692

    I can play .ts files using FFMPEG by passing full file. Now I have to play .ts as a buffer. Now I'm reading a ts file say 188*200 means 200 packets. Can anybody tell me what is minimum buffer size or minimum number packets needed to initialize ts playback.

  • How can I capture audio AND video simultenaous with ffmpeg from an USB capture device

    5 octobre 2011, par oban

    I'm capturing a video by means of an USB Terratec Grabster AV350 (which is based on the em2860 chip).

    I don't succeed to get the audio when it is played . If I play the captured video with vlc or with ffplay I got only 3 seconds sound and then a silence for the rest of the video ...

    During the capturing I don't get any errors. At the end it indicates the size of the video and audio captured ....

    I'm using the ffmpeg command for this :

    ffmpeg -f alsa -ac 2 -i hw:3 -f video4linux2 -i /dev/video0 -acodec ac3 -ab 128k -vcodec mpeg4 -b 6000k -r 25 test5.avi

    The log is :

    [alsa @ 0x9bcd420]Estimating duration from bitrate, this may be inaccurate Input #0, alsa, from 'hw:3': Duration: N/A, start: 69930.998994, bitrate: N/A Stream #0.0: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s [video4linux2 @ 0x9bf5d30]Estimating duration from bitrate, this may be inaccurate Input #1, video4linux2, from '/dev/video0': Duration: N/A, start: 1307111377.654173, bitrate: -2147483 kb/s Stream #1.0: Video: rawvideo, yuyv422, 720x576, -2147483 kb/s, 1000k tbr, 1000k tbn, 1000k tbc [ac3 @ 0x9bf9590]No channel layout specified. The encoder will guess the layout, but it might be incorrect. Output #0, avi, to 'test5.avi': Metadata: ISFT : Lavf52.64.2 Stream #0.0: Video: mpeg4, yuv420p, 720x576, q=2-31, 6000 kb/s, 25 tbn, 25 tbc Stream #0.1: Audio: ac3, 44100 Hz, stereo, s16, 128 kb/s Stream mapping: Stream #1.0 -> #0.0 Stream #0.0 -> #0.1 Press [q] to stop encoding frame= 1283 fps= 25 q=2.3 Lsize= 38677kB time=51.32 bitrate=6173.9kbits/s video:37755kB audio:846kB global headers:0kB muxing overhead 0.198922%

    If I reduce the command for only capturing audio, then the audio file can be played successfully :

    ffmpeg -f alsa -ac 2 -i hw:3,0 -acodec ac3 -ab 128k test5.avi

    [alsa @ 0x8ede420]Estimating duration from bitrate, this may be inaccurate Input #0, alsa, from 'hw:3,0': Duration: N/A, start: 70395.998935, bitrate: N/A Stream #0.0: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s [ac3 @ 0x8eebac0]No channel layout specified. The encoder will guess the layout, but it might be incorrect. Output #0, avi, to 'test5.avi': Metadata: ISFT : Lavf52.64.2 Stream #0.0: Audio: ac3, 44100 Hz, stereo, s16, 128 kb/s Stream mapping: Stream #0.0 -> #0.0 Press [q] to stop encoding size= 227kB time=13.62 bitrate= 136.8kbits/s video:0kB audio:213kB global headers:0kB muxing overhead 6.902375%

    If I run the command for only video capturing then vlc or ffplay can play the video successfully :

    ffmpeg -f video4linux2 -i /dev/video0 -vcodec mpeg4 -b 12000k -r 25 test5.avi

    [video4linux2 @ 0x91d6420]Estimating duration from bitrate, this may be inaccurate Input #0, video4linux2, from '/dev/video0': Duration: N/A, start: 1307112044.025687, bitrate: -2147483 kb/s Stream #0.0: Video: rawvideo, yuyv422, 720x576, -2147483 kb/s, 1000k tbr, 1000k tbn, 1000k tbc Output #0, avi, to 'test5.avi': Metadata: ISFT : Lavf52.64.2 Stream #0.0: Video: mpeg4, yuv420p, 720x576, q=2-31, 12000 kb/s, 25 tbn, 25 tbc Stream mapping: Stream #0.0 -> #0.0 Press [q] to stop encoding frame= 388 fps= 25 q=2.0 Lsize= 12963kB time=15.52 bitrate=6842.5kbits/s video:12949kB audio:0kB global headers:0kB muxing overhead 0.114584%

    Strange behaviour I noticed is that when I tried capturing video and audio, I can not capture the audio afterwards any more, unless I unplug the AV350 first.

    The G350 is located at card 3 :

    htpc@htpc-01:/proc/asound/G350/pcm0c$ more info card: 3 device: 0 subdevice: 0 stream: CAPTURE id: USB Audio name: USB Audio subname: subdevice #0 class: 0 subclass: 0 subdevices_count: 1 subdevices_avail: 1

    The OS is a Linux 2.6.38-8-generic with the Ubuntu Natty Narwhal version

    Any help on how to tackle this issue would be great ....

    Thanks !