I try to get thumbnail like http://www.wowza.com/forums/content.php?229-How-to-take-a-single-frame-snapshot-of-a-live-stream-for-thumbnail-creation-(ModuleCreateSnapshot)
But I get error like in last post of this forum.
[flv # 0x7ff42380e600] Could not find codec parameters for stream 0 (Video: h264): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[flv # 0x7ff42380e600] Could not find codec parameters for stream 1 (Audio: none, 0 channels): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
dLR.flv.flv: could not find codec parameters
Input #0, flv, from 'dLR.flv.flv':
Metadata:
creationdate : Fri Jul 17 17:03:12
Duration: 00:00:00.00, start: 0.000000, bitrate: N/A
Stream #0:0: Video: h264, 1k tbr, 1k tbn, 1k tbc
Stream #0:1: Audio: none, 0 channels
Output #0, image2, to 'q.flv.png':
Metadata:
creationdate : Fri Jul 17 17:03:12
Output file #0 does not contain any stream
Related
I am trying to calculate PSNR of two images that have slightly different width/height:
ffmpeg -y -i /tmp/ff-021407597-sn-1029-516-C-0-956542137
-i /tmp/ff-021407597-ff-1029-516-C-0-362227908
-filter_complex "[0:v]crop=1028:514;[1:v]crop=1028:514"
-filter_complex "psnr" %03d.png
This does not work and I get this error:
Input #0, png_pipe, from
'/tmp/ff-021407597-sn-1029-516-C-0-956542137': Duration: N/A,
bitrate: N/A
Stream #0:0: Video: png, rgb24(pc), 1029x515, 25 tbr, 25 tbn, 25 tbc Input #1, png_pipe, from
'/tmp/ff-021407597-ff-1029-516-C-0-362227908': Duration: N/A,
bitrate: N/A
Stream #1:0: Video: png, rgb24(pc), 1029x516, 25 tbr, 25 tbn, 25 tbc Cannot find a matching stream for unlabeled input pad 0 on filter
Parsed_psnr_0
Is there some way to map the outputs of the crop filter so that it is passed into the psnr filter?
Use
ffmpeg -y -i /tmp/ff-021407597-sn-1029-516-C-0-956542137
-i /tmp/ff-021407597-ff-1029-516-C-0-362227908
-filter_complex "[0:v]crop=1028:514[a];[1:v]crop=1028:514[b];[a][b]psnr" -f null -
I'm seeing some strange behaviour where an .mp4 video file (located in /assets/images/) streams perfectly well without anything registered in mime_types.rb. But, if I register the video/mp4 mime-type, the video will not stream.
mime_types.rb:
Mime::Type.register "video/mp4", :mp4
Safari displays the first picture of the video, but cannot stream the video. This is only an issue with Safari and only with Unicorn (not Webrick).
We need the mime-type registered, because we're responding to mp4 requests in other locations of the app.
Any ideas how to solve this?
Rails 4.1.3
Ruby 2.1.2
Unicorn 4.8.3
Video details from ffmpeg -I
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'background_video.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 2015-03-06 14:03:09
encoder : Lavf54.6.100
Duration: 00:00:11.29, start: 0.000000, bitrate: 893 kb/s
Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1114x494, 903 kb/s, 30 fps, 30 tbr, 30 tbn, 60 tbc (default)
Metadata:
creation_time : 2015-03-06 14:03:09
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 2 kb/s (default)
Metadata:
creation_time : 2015-03-06 14:03:09
handler_name : SoundHandler
Moving the videos files to the /public/ folder fixes the issue.
My MPEG-TS video has problem playing on iOS via HTTP Live Streaming. The iPhone can play the file, but it seems it lost half of its frames. The video is slow and not continuous and smooth on the iPhone, but the VLC can play the stream without problems. I have posted the information of the mpegts file, it was encoded under profile High#L4.0 H264. iPhone 5c or 5s should have the ability to handle it.
Information probed by mediainfo command:
General
ID : 1 (0x1)
Complete name : segment00007.ts
Format : MPEG-TS
File size : 169 KiB
Duration : 5s 990ms
Overall bit rate mode : Variable
Overall bit rate : 216 Kbps
Video
ID : 65 (0x41)
Menu ID : 1 (0x1)
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High#L4.0
Format settings, CABAC : Yes
Format settings, ReFrames : 1 frame
Codec ID : 27
Duration : 6s 63ms
Bit rate : 206 Kbps
Width : 640 pixels
Height : 480 pixels
Display aspect ratio : 4:3
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Stream size : 152 KiB (90%)
$ avconv -i segment00007.ts
avconv version 9.14-6:9.14-0ubuntu0.14.04.1, Copyright (c) 2000-2014 the Libav developers
built on Jul 15 2014 13:57:40 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
[mpegts # 0x16e7840] Invalid timestamps stream=0, pts=327815314, dts=327815357, size=7191
[mpegts # 0x16e7840] Invalid timestamps stream=0, pts=327997410, dts=327997563, size=7232
[mpegts # 0x16e7840] Invalid timestamps stream=0, pts=328104538, dts=328104565, size=1458
[mpegts # 0x16e7840] Invalid timestamps stream=0, pts=328117902, dts=328118015, size=1476
[mpegts # 0x16e7840] Invalid timestamps stream=0, pts=328141590, dts=328141634, size=1573
[mpegts # 0x16e7840] Invalid timestamps stream=0, pts=328165614, dts=328165629, size=1913
[mpegts # 0x16e7840] Invalid timestamps stream=0, pts=328180354, dts=328180554, size=7192
[mpegts # 0x16e7840] max_analyze_duration reached
Input #0, mpegts, from 'segment00007.ts':
Duration: 00:00:06.08, start: 3642.385822, bitrate: 227 kb/s
Program 1
Stream #0.0[0x41]: Video: h264 (High), yuv420p, 640x480, 30.08 fps, 90k tbn
At least one output file must be specified
I am using JavaCV and it's FFmpegFrameGrabber in my project. It loads and player files OK, when I launch the project from Eclipse, but shows either a black screen or a still 1st frame when I run a compiled project. Sometimes comming with this error:
Input #0, avi, from 'C:/path/Start_Cut.avi':
Duration: 00:00:20.03, start: 0.000000, bitrate: 26002 kb/s
Stream #0.0: Video: mpeg4, yuv420p, 1920x1080, 30 tbr, 30 tbn, 30 tbc
Cannot allocate memory. com.googlecode.javacv.FrameGrabber$Exception: Cannot initialize the conversion c ontext.
at com.googlecode.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.jav a:280)
and sometimes with
[mpeg4 # 6A95DF20] Invalid and inefficient vfw-avi packed B frames detected
Input #0, avi, from 'C:/path/Start_Cut.avi':
Duration: 00:00:20.03, start: 0.000000, bitrate: 26002 kb/s
Stream #0.0: Video: mpeg4, yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 25 tbr, 30
tbn, 25 tbc
does anyone has a clue on this?
UPDATE:
I have been able to narrow down the problem. For some reason, FFmpegFrameGrabber returns null upn calling the grab() method. Why does it work in Eclipse and does not work in standalone build? All libraries are included and I suppose, it would come up with an error if they did not.
Upgrading to the 2.4.0 version of OpenCV and to the current version of JavaCV did the trick. If someone gets in the same situation (which is unlikely), just perform a brand new installation following the instruction on the JavaCV website.
I have some H.264-encoded videos which render in HTML5 correctly in the web browser, but do not render correctly on the iPad. When I use a H.264 video I downloaded off the internet, my video renders correctly on the iPad, so it is not an HTML problem.
Here is the ffmpeg info about my videos --
My original .mov video:
Seems stream 1 codec frame rate differs from container frame rate: 6000.00 (6000/1) -> 30.00 (30/1)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'a_video.mp4':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
Duration: 00:00:42.74, start: 0.000000, bitrate: 220 kb/s
Stream #0.0(eng): Audio: aac, 44100 Hz, stereo, s16, 94 kb/s
Stream #0.1(eng): Video: h264, yuv420p, 762x464, 122 kb/s, 30 fps, 30 tbr, 3k tbn, 6k tbc
After using Handbrake to convert my .mov to a mp4, yet doesn't render on the iPad:
Seems stream 0 codec frame rate differs from container frame rate: 180000.00 (180000/1) -> 29.97 (30000/1001)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'a_video.m4v':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isomavc1
encoder: HandBrake 0.9.5 2011010300
Duration: 00:00:42.77, start: 0.000000, bitrate: 169 kb/s
Stream #0.0(und): Video: h264, yuv420p, 752x464 [PAR 381:376 DAR 381:232], 35 kb/s, PAR 145161:141376 DAR 145161:87232, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc
Stream #0.1(eng): Audio: aac, 44100 Hz, stereo, s16, 128 kb/s
Here is a .mp4 I found online which does render on the iPad:
Seems stream 1 codec frame rate differs from container frame rate: 180000.00 (180000/1) -> 25.00 (25/1)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'a_video_3_emu.mp4':
Metadata:
major_brand : M4VP
minor_version : 1
compatible_brands: M4VPM4A mp42isom
encoder : CoreMediaAuthoring 677, CoreMedia 420.17, i386
Duration: 00:01:38.01, start: 0.000000, bitrate: 1023 kb/s
Stream #0.0(und): Audio: aac, 32000 Hz, mono, s16, 97 kb/s
Stream #0.1(und): Video: h264, yuv420p, 480x360 [PAR 1:1 DAR 4:3], 914 kb/s, 25 fps, 25 tbr, 90k tbn, 180k tbc
Does anyone see something wrong with the way I am encoded my videos?
Edit
At first my theory was that the iPad was sensitive to different container formats; but that appears not to be the case. I took a video which does render correctly on the iPad and converted it to a .mov, and it still played correctly on the iPad. So there must be a problem with how the iPad deals with the underlying H.264 stream.
If you have a H.264 video stream -- regardless of the container (mov, m4v, mp4) -- and your HTML5 video renders in a web browser but doesn't render on the iPad, there are two possible fixes:
The first solution is to convert the H.264 video stream to mpeg4.
ffmpeg -i video_h264_not_working.mov -acodec copy -vcodec mpeg4 video_mpeg.mov
(Alternatively, you can select MPEG4 instead of H.264 in Handbrake.)
The second solution is to re-process the H.264 video with the following parameters:
ffmpeg -i video_h264_not_working.mov -vcodec libx264 -r 25 -b 516k -bt 516k -crf 22 -vpre normal video_h264.mov
The second solution came from: http://houseoflaudanum.com/navigate/howtos/html5-video-no-webm/
I'm guessing in the former case, the mpeg4 codec is more relaxed on the iPad; and in the latter case, the iPad didn't like some of the stream parameters from the original H.264 encoding, so a "cleaning" was necessary.
To determine what your video stream actually is, just do ffmpeg -i myvideo.mov.
I've had great success encoding and transcoding HTML5 video using the free Miro Video Converter (OS X, Windows) as recommended in the Video on the Web section of Dive Into HTML5 by Mark Pilgrim.
Miro Video Converter can convert virtually any video file to MP4, Theora, or MP3 (the audio only). It has presets that will convert video to the correct sizes and formats for popular phones, iPods, and other media players. Just convert your video and copy it to your device.
It's a super simple way to convert almost any video to MP4, WebM (vp8), Ogg Theora, or for Android, iPhone, and more. You'll feel good that it's 100% Free and open-source, too.
An another veritable video conversion utility is Video Monkey, a free video encoding application exclusively for Mac. It was created after the demise of the great tool Visual Hub. Video Monkey borrows heavily from the Visual Hub video conversion tool, both conceptually and from the original code dump posted to SourceForge as TranscoderRedux.
sudo port install ffmpeg and try this secret sauce:
#!/bin/bash
BR=512k
WIDTH=640
HEIGHT=272
input=${1}
# strip off the file extension
output=$(echo ${input} | sed 's/\..*//' )
# works for most videos
ffmpeg -y -i ${input} -f mpegts -acodec libmp3lame -ar 48000 -ab 64k -s ${WIDTH}x${HEIGHT} -vcodec libx264 -b ${BR} -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 7 -trellis 0 -refs 0 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 200k -maxrate ${BR} -bufsize ${BR} -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 30 -qmax 51 -qdiff 4 -level 30 -aspect ${WIDTH}:${HEIGHT} -g 30 -async 2 ${output}-iphone.ts
Adjust width and height to the original video and set the bitrate as you see fit. Pass the original video as parameter to the script. Works with almost any source format. You need macports for the port command.