Tools/Techniques for investigating video corruption -- ffmpeg / libavcodec - c

In my current work I'm trying to encode some images to h264 video using the FFMPEG's C library. The resulting video plays fine in VLC, but has no preview image. The video can play in VLC and Mplayer on ubuntu, but won't play on Mac or PC (in fact, it causes a "VTDecoderXPCService quit unexpectedly" error on Mac).
If I run the resulting file through FFMPEG using the command line, the resulting file has a preview image, and plays correctly everywhere.
Apparently the file that I get out of the program is corrupt in some weird place, but I don't have any output during my compilation or run to indicate where. I can't share my code at the moment (work code isn't open source yet :-( ), but I have tried a number of things:
Writing only header and trailer data (av_write_trailer) and no frames
writing frames only minus the trailer (using avcodec_encode_video2 and av_write_frame)
Adjusting our time_base and frame pts values to encode only one frame per second
Removing all variable frame rate code
Numerous other variants that I won't bother you with here
In creating my project, I've also followed the following tutorials:
Dr. Anger's FFMPEG tutorial
FFmpeg's Own Tutorials
An older tutorial from FFmpeg
And consulted the deprecated ffmpeg functions list
And compiled FFMPEG on ubuntu according to the official doc
And consulted numerous StackOverflow questions:
Raw H264 frames in mpegts container using libavcodec
How to encode Bitmaps into a video using MediaCodec?
How to convert RGB from YUV420p for ffmpeg encoder?
Encoding H.264 video using FFmpeg C API
ffmpeg: how to save h264 raw data as mp4 file
But every run of the program runs into the exact same problem.
My question is, is there anything obvious that causes a programmatic run of FFMpeg to differ from a console run (e.g., an incomplete finalization, some threading issues, etc.)? Like some obvious reason that a console run could repair a corrupted file? Or is there a decent tool/method for inspecting a video file and finding the point of corruption?

Give it a run through: http://forum.doom9.org/showthread.php?t=123076 and see what you get.

Related

Create a binary file extension reader for mobile

It is an ancient binary file extension, actually a video file created by Inter-Tel Web Conference software. It contains a screen recording video and voice audio, and also can capture the keyboard chat log, attendees and the document manager window during a conference. It can be played with Inter-Tel Collaboration Player, a standalone application included with the Web Conference software package.
What I am trying to do now is finding a way to play these files on mobile, although Inter-Tel Collaboration Player offers exporting the files in AVI format, I want to know how to make a command line script for that because the application have lots of problems with Windows 7,8,10 and don't have a Mac OS version.
What is the way to create a new player for that kind of extensions?
"Linktivity stopped support on this app, http://linktivity.com even disappeared from the web..."
It seems they were bought out by Mitel Software so now everything is under the Mitel brand name.
"I just want to find a way to manipulate this file extension, a new good player for mobile and computer"
To open/edit those .lrec files with modern software you'll have to look at their :
Collaboration products.
Unified Communication products.
I tried :
To contact them just to double-check facts but they expect a realtime phone conversation with a salesperson so it wasn't an option. I'd be a fake potential customer, but you can provide a real-world issue (with background details) to see if they can solve it.
Also downloaded for Android the MiCollab app but it needs login details before even starting anything (so no progress to just check if an .lrec file from PC would open within Android).
Export videos for mobile playback :
I've tried the desktop software. Unfortunately it does not accept external commands so there is no way to make a script that takes multiple lrecs and gives back multiple AVI.
The only option is to extract frames from .lrec bytes and use a tool like FFmpeg to combine the images (since appears to do image grabs as frames) into one .MP4 video. MP4 is then playable on mobile devices.
Also any of your existing AVI files should be converted with FFmpeg to MP4.
You can download FFmpeg for Windows here (just the big blue button, ignore other options).
Copy the ffmpeg.exe file to some folder like c:\ffmpeg and put your avi's there.
Now open Command prompt and do cd C:\ffmpeg to reach folder, then type : ffmpeg -i filename.avi filename.mp4 (replace filename with preferred for input and output)
If you know how, just include ffmpeg.exe path to Control Panel PATH settings so that FFmpeg can be accessed from any folder (no need to move files to its own folder).
PS:
I am still researching how to get the frames it's an akward format without the specs (bytes order is Big Endian but then entry values are filled as Little Endian, then also not sure whether to reverse every two or four bytes cos it's mixed up like that etc and the pixel bytes themselves seem to have compression but it's not JPEG more like ZIP or whatever). Only confirmed bytes so far are for video width and video height. It seems doable though if the .lrec only contains screen recordings.
After some research, I found that Media Player Classic can play .lrec files. I don't know, if this helps you a bit.
For a own video player for your company, you would need the encoding infos or a decoder directly from Inter-Tel since they own the licences, without it you can't create one.
Edit: Deprecated info see comments.

Is there a size limit in Videogular?

I have a 86MB file that won't play but have other smaller mp4 that will. Is Videogular a streaming component or does it load the entire mp4 and then play it. I also do not get any errors, just the loading screen/circle goes forever.
thx
Ralph
There is no limit but your file should be correctly encoded to play your file on-demand.
If you have problems with your MP4 just try the file that we have at our website.
If you need help encoding your files you can use a transcoding software like eRightSoft SUPER or an online service like Zencoder or Encoding.

Editing/Decoding AVI files using system-installed proprietary codecs

I've been searching for this for a few days now, but nothing seems to quite answer or work for me, so please forgive me if I'm asking a stupid question or one that seems to have been answered elsewhere.
I have an AVI file encoded using the GMP4 video codec, currently installed on my computer so I can PLAY the file in Windows Media Player for instance. What I'm trying to do is open/decode the file for editing purposes, in order to be able to stitch two video files together. I do not require it to be output in the same format, but rather only opened for editing, get the frames and then I can output to a more standard format.
The problem I'm getting is that there is no DirectShow filter created for this format, so it won't open using that for me (haven't worked too deeply into it, but all samples fail to load the video file). FFMPEG tries to read the file, states that the header is incorrect but it'll attempt to read it anyway, then dies stating that I need the GMP4 codec. As I'd stated earlier, I have the particular codec installed but FFMPEG doesn't seem to notice or have access to it.
Is there anything that will allow me to use the system-installed codecs to decode the video frames? It seems strange to me that Windows Media Player can do something, but I can't programatically repeat it. I'm not restricted to C++ or C#, though C# would definitely be a preferred language.
Thanks All,
Alex
I spent all day with the same problem. Solution is to install AVISynth, and then you can load with ffmpeg any AVI file for whom the system has a VfW codec. Instead of passing ffmpeg your AVI input file, create an .avs file with a single line containing AviSource("your-avi-filename") and passing ffmpeg the .avs filename.
Suppose you want to convert your input.avi in a proprietary video CODEC into an h263 format (supposing your input.avi has a supported h263 frame size):
echo AviSource("input.avi") > input.avs
ffmpeg -i inputs.avs -vcodec h263 output.avi
Nuno has a great answer, but you want to avoid command line converts, you can use the AForge.Net c# library to access AfW codecs, FFMpeg codecs or even DShow codecs (some CCTV DVRs do encode in DShow).
There is also a way to open Windows Media Player as a c# object and grab frames from it. Email me if you want more information - it sounds like we're working on similar projects.

how to take video and audio from a stream and output to a video file as well as images

I am currently trying to make a program that will take a stream coming in, like a webcam and a microphone, and I am trying to save both the video and audio into an AVI file and be able to save out the information out to images. I've tried to do this with DirectShow and OpenCV, but I've had some trouble since I have audio that I would like to include in the AVI file, but cannot see a way to use OpenCV to save Audio information.
I've also looked into FFMPEG, but I don't see much online about working with streams coming in from Windows.
Any information or documentation would be great.
I am trying to develop this on a Windows compatible machine.
Thanks
We have a cross platform vision system framework that may solve your needs:
http://www.simplecv.org
Here is how you do it in our code:
from SimpleCV import *
import time
cam = Camera()
visstream = VideoStream("foo.avi")
while(True):
image = cam.getImage()
image.save("c:/blah.png")
image.save(visstream)
time.sleep(0.05)

Produce video from OpenGL C program

I have a C program that runs a scientific simulation and displays a visualisation in an OpenGL window. I want to make this visualisation into a video, which will eventually go on YouTube.
Question: What's the best way to make a video from a C / OpenGL program?
The way I've done it in the past is to use a screen capture program, but this is very labour-intensive (have to start/stop the screen capture program, save the video file, etc...). It seems like there should be a way to automate the process of making a video from within the C program. Then I can leave it running overnight and have 20 videos to look through in the morning, and choose the best one to put on YouTube.
YouTube recommend "MPEG4 (Divx, Xvid) format at 640x480 resolution".
I'm using GLUT 3.7.6_3, if that makes a difference. I can change windowing system if there's a good reason.
I'm running Windows (XP), so would prefer answers that work on Windows, but Linux answers are ok too. I can use Linux if it's not possible to do the video stuff easily on Windows. I have a friend who makes a .png image for each frame of the video and then stitches them together using "mencoder" on Linux.
you can use the glReadPixels function (see example)
But if the stuff you are trying to display is made of simple objects (i.e. spheres, rods, etc..), I would "export" each frame into a POV-ray files, render these, and then make a video out of these pictures. you will reach a much higher quality like that.
Use a 3rd party application like FRAPS to do the job for you.
Fraps can capture audio and video up
to 2560x1600 with custom frame rates
from 1 to 120 frames per second!
All movies are recorded in outstanding
quality.
They have video samples on the site. They seem good.
EDIT:
You could execute a tool to record the screen from your C application by calling it like system("C:\screen_recorder_app.exe -params"). Check camstudio, it has a command line version.

Resources