
Recherche avancée
Médias (1)
-
SWFUpload Process
6 septembre 2011, par
Mis à jour : Septembre 2011
Langue : français
Type : Texte
Autres articles (54)
-
Gestion générale des documents
13 mai 2011, parMédiaSPIP ne modifie jamais le document original mis en ligne.
Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...) -
Des sites réalisés avec MediaSPIP
2 mai 2011, parCette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page. -
HTML5 audio and video support
13 avril 2011, parMediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
For older browsers the Flowplayer flash fallback is used.
MediaSPIP allows for media playback on major mobile platforms with the above (...)
Sur d’autres sites (5710)
-
Getting Error during executin native android code
3 avril 2013, par dilipkaklotarError on my console
bash : cannot set terminal process group (-1) : Inappropriate ioctl for device
bash : no job control in this shell
Your group is currently "mkpasswd". This indicates that your
gid is not in /etc/group and your uid is not in /etc/passwd.The /etc/passwd (and possibly /etc/group) files should be rebuilt.
See the man pages for mkpasswd and mkgroup then, for example, runmkpasswd -l [-d] > /etc/passwd
mkgroup -l [-d] > /etc/groupNote that the -d switch is necessary for domain users.
]0 ; -
[32mDILIP@DILIP-PC -[33m -[0m
$public class VideoBrowser extends ListActivity implements ListView.OnScrollListener {
/*this part communicates with native code through jni (java native interface)*/
//load the native library
static {
System.loadLibrary("ffmpeg");
System.loadLibrary("ffmpeg-test-jni");
}
//declare the jni functions
private static native void naInit(String _videoFileName);
private static native int[] naGetVideoResolution();
private static native String naGetVideoCodecName();
private static native String naGetVideoFormatName();
private static native void naClose();
private void showVideoInfo(final File _file) {
String videoFilename = _file.getAbsolutePath();
naInit(videoFilename);
int[] prVideoRes = naGetVideoResolution();
String prVideoCodecName = naGetVideoCodecName();
String prVideoFormatName = naGetVideoFormatName();
naClose();
String displayText = "Video: " + videoFilename + "\n";
displayText += "Video Resolution: " + prVideoRes[0] + "x" + prVideoRes[1] + "\n";
displayText += "Video Codec: " + prVideoCodecName + "\n";
displayText += "Video Format: " + prVideoFormatName + "\n";
text_titlebar_text.setText(displayText);
}
/*the rest of the file deals with UI and other stuff*/
private Context mContext;
public static VideoBrowser self;
/**
* activity life cycle: this part of the source code deals with activity life cycle
*/
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
mContext = this.getApplicationContext();
self = this;
initUI();
}
@Override
protected void onDestroy() {
super.onDestroy();
unbindDisplayEntries();
}
public void unbindDisplayEntries() {
if (displayEntries!=null) {
int l_count = displayEntries.size();
for (int i = 0; i < l_count; ++i) {
IconifiedTextSelected l_its = displayEntries.get(i);
if (l_its != null) {
Drawable l_dr = l_its.getIcon();
if (l_dr != null) {
l_dr.setCallback(null);
l_dr = null;
}
}
}
}
if (l_displayEntries!=null) {
int l_count = l_displayEntries.size();
for (int i = 0; i < l_count; ++i) {
IconifiedTextSelected l_its = l_displayEntries.get(i);
if (l_its != null) {
Drawable l_dr = l_its.getIcon();
if (l_dr != null) {
l_dr.setCallback(null);
l_dr = null;
}
}
}
}
}
/**
* Data: this part of the code deals with data processing
*/
public List<iconifiedtextselected> displayEntries = new ArrayList<iconifiedtextselected>();
public static List<iconifiedtextselected> l_displayEntries = new ArrayList<iconifiedtextselected>();;
/**load images
* this part of code deals with loading of images
*/
private File currentDirectory;
public int media_browser_load_option = 2;
private static int last_media_browser_load_option = 2;
private static int number_of_icons = 0;
private static final String upOneLevel = "..";
LoadVideoTask loadTask;
private void loadVideosFromDirectory(String _dir) {
try {
loadTask = new LoadVideoTask();
loadTask.execute(_dir);
} catch (Exception e) {
Toast.makeText(this, "Load media fail!", Toast.LENGTH_SHORT).show();
}
}
private void getVideosFromDirectoryNonRecurAddParent(File _dir) {
//add the upper one level data
if (_dir.getParent()!=null) {
this.displayEntries.add(new IconifiedTextSelected(
upOneLevel,
getResources().getDrawable(R.drawable.folderback),
false, false, 0));
}
}
private void getVideosFromDirectoryNonRecur(File _dir) {
Drawable folderIcon = this.getResources().getDrawable(R.drawable.normalfolder);
//add the
if (!_dir.isDirectory()) {
return;
}
File[] files = _dir.listFiles();
if (files == null) {
return;
}
Drawable videoIcon = null;
int l_iconType = 0;
for (File currentFile : files) {
if (currentFile.isDirectory()) {
//if it's a directory
this.displayEntries.add(new IconifiedTextSelected(
currentFile.getPath(),
folderIcon, false, false, 0));
} else {
String l_filename = currentFile.getName();
if (checkEndsWithInStringArray(l_filename,
getResources().getStringArray(R.array.fileEndingVideo))) {
if (number_of_icons < 10) {
videoIcon = null;
++number_of_icons;
l_iconType = 22;
} else {
videoIcon = null;
l_iconType = 2;
}
this.displayEntries.add(new IconifiedTextSelected(
currentFile.getPath(),
videoIcon, false, false, l_iconType));
}
}
}
}
private void getVideosFromDirectoryRecur(File _dir) {
Drawable videoIcon = null;
File[] files = _dir.listFiles();
int l_iconType = 2;
if (files == null) {
return;
}
for (File currentFile : files) {
if (currentFile.isDirectory()) {
getVideosFromDirectoryRecur(currentFile);
continue;
} else {
String l_filename = currentFile.getName();
//if it's an image file
if (checkEndsWithInStringArray(l_filename,
getResources().getStringArray(R.array.fileEndingVideo))) {
if (number_of_icons < 10) {
videoIcon = null;
++number_of_icons;
l_iconType = 22;
} else {
videoIcon = null;
l_iconType = 2;
}
this.displayEntries.add(new IconifiedTextSelected(
currentFile.getPath(),
videoIcon, false, false, l_iconType));
}
}
}
}
private void getVideosFromGallery() {
Drawable videoIcon = null;
Uri uri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
String[] projection = {MediaStore.Video.Media.DATA};
Cursor l_cursor = this.managedQuery(uri, projection, null, null, null);
int videoNameColumnIndex;
String videoFilename;
File videoFile;
int l_iconType = 2;
if (l_cursor!=null) {
if (l_cursor.moveToFirst()) {
do {
videoNameColumnIndex = l_cursor.getColumnIndexOrThrow(
MediaStore.Images.Media.DATA);
videoFilename = l_cursor.getString(videoNameColumnIndex);
videoFile = new File(videoFilename);
if (!videoFile.exists()) {
continue;
}
if (number_of_icons <= 10) {
videoIcon = null;
++number_of_icons;
l_iconType = 22;
} else {
videoIcon = null;
l_iconType = 2;
}
this.displayEntries.add(new IconifiedTextSelected(
videoFile.getAbsolutePath(),
videoIcon, false, false, l_iconType));
} while (l_cursor.moveToNext());
}
}
if (l_cursor!=null) {
l_cursor.close();
}
}
private boolean checkEndsWithInStringArray(String checkItsEnd,
String[] fileEndings){
for(String aEnd : fileEndings){
if(checkItsEnd.endsWith(aEnd))
return true;
}
return false;
}
private class LoadVideoTask extends AsyncTask {
@Override
protected void onPreExecute() {
System.gc();
displayEntries.clear();
showDialog(DIALOG_LOAD_MEDIA);
}
@Override
protected Void doInBackground(String... params) {
File l_root = new File(params[0]);
if (l_root.isDirectory()) {
number_of_icons = 0;
currentDirectory = l_root;
if (media_browser_load_option == 0) {
//list all videos in the root directory without going into sub folder
getVideosFromDirectoryNonRecurAddParent(l_root);
getVideosFromDirectoryNonRecur(l_root);
} else if (media_browser_load_option == 1) {
//list all videos in the root folder recursively
getVideosFromDirectoryRecur(l_root);
} else if (media_browser_load_option == 2) {
//list all videos in the gallery
getVideosFromGallery();
}
}
return null;
}
@Override
protected void onPostExecute(Void n) {
refreshUI();
dismissDialog(DIALOG_LOAD_MEDIA);
}
}
/**
* UI: this part of the source code deals with UI
*/
//bottom menu
private int currentFocusedBtn = 1;
private Button btn_bottommenu1;
private Button btn_bottommenu2;
private Button btn_bottommenu3;
//private Button btn_bottommenu4;
//title bar
private TextView text_titlebar_text;
private void initUI() {
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.setContentView(R.layout.video_browser);
//title bar
text_titlebar_text = (TextView) findViewById(R.id.titlebar_text);
text_titlebar_text.setText("Click a video to display info");
//bottom menu
int l_btnWidth = this.getWindowManager().getDefaultDisplay().getWidth()/4;
btn_bottommenu1 = (Button) findViewById(R.id.video_browser_btn1);
//btn_bottommenu1 = (ActionMenuButton) findViewById(R.id.main_topsecretimport_btn1);
btn_bottommenu1.setWidth(l_btnWidth);
btn_bottommenu1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
btn_bottommenu1.setEnabled(false);
btn_bottommenu2.setEnabled(true);
btn_bottommenu3.setEnabled(true);
currentFocusedBtn = 1;
last_list_view_pos = 0;
media_browser_load_option = 2;
last_media_browser_load_option = media_browser_load_option;
loadVideosFromDirectory("/sdcard/");
}
});
btn_bottommenu2 = (Button) findViewById(R.id.video_browser_btn2);
btn_bottommenu2.setWidth(l_btnWidth);
btn_bottommenu2.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
btn_bottommenu1.setEnabled(true);
btn_bottommenu2.setEnabled(false);
btn_bottommenu3.setEnabled(true);
currentFocusedBtn = 2;
last_list_view_pos = 0;
media_browser_load_option = 0;
last_media_browser_load_option = media_browser_load_option;
loadVideosFromDirectory("/sdcard/");
}
});
btn_bottommenu3 = (Button) findViewById(R.id.video_browser_btn3);
btn_bottommenu3.setWidth(l_btnWidth);
btn_bottommenu3.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
btn_bottommenu1.setEnabled(true);
btn_bottommenu2.setEnabled(true);
btn_bottommenu3.setEnabled(false);
currentFocusedBtn = 3;
last_list_view_pos = 0;
media_browser_load_option = 1;
last_media_browser_load_option = media_browser_load_option;
loadVideosFromDirectory("/sdcard/");
}
});
media_browser_load_option = last_media_browser_load_option;
if (media_browser_load_option==2) {
btn_bottommenu1.setEnabled(false);
} else if (media_browser_load_option==0) {
btn_bottommenu2.setEnabled(false);
} else if (media_browser_load_option==1){
btn_bottommenu3.setEnabled(false);
}
loadVideosFromDirectory("/sdcard/");
}
//refresh the UI when the directoryEntries changes
private static int last_list_view_pos = 0;
public void refreshUI() {
int l_btnWidth = this.getWindowManager().getDefaultDisplay().getWidth()/4;
btn_bottommenu1.setWidth(l_btnWidth);
btn_bottommenu2.setWidth(l_btnWidth);
btn_bottommenu3.setWidth(l_btnWidth);
//btn_bottommenu4.setWidth(l_btnWidth);
SlowAdapter itla = new SlowAdapter(this);
itla.setListItems(this.displayEntries);
this.setListAdapter(itla);
getListView().setOnScrollListener(this);
int l_size = this.displayEntries.size();
if (l_size > 50) {
getListView().setFastScrollEnabled(true);
} else {
getListView().setFastScrollEnabled(false);
}
if (l_size > 0) {
if (last_list_view_pos < l_size) {
getListView().setSelection(last_list_view_pos);
} else {
getListView().setSelection(l_size-1);
}
}
registerForContextMenu(getListView());
}
@Override
public void onConfigurationChanged (Configuration newConfig) {
super.onConfigurationChanged(newConfig);
refreshUI();
}
static final int DIALOG_LOAD_MEDIA = 1;
static final int DIALOG_HELP = 2;
@Override
protected Dialog onCreateDialog(int id) {
switch(id) {
case DIALOG_LOAD_MEDIA:
ProgressDialog dialog = new ProgressDialog(this);
dialog.setTitle("Load Files");
dialog.setMessage("Please wait while loading...");
dialog.setIndeterminate(true);
dialog.setCancelable(true);
return dialog;
default:
return null;
}
}
/**
* scroll events methods: this part of the source code contain the control source code
* for handling scroll events
*/
private boolean mBusy = false;
private void disableButtons() {
btn_bottommenu1.setEnabled(false);
btn_bottommenu2.setEnabled(false);
btn_bottommenu3.setEnabled(false);
}
private void enableButtons() {
if (currentFocusedBtn!=1) {
btn_bottommenu1.setEnabled(true);
}
if (currentFocusedBtn!=2) {
btn_bottommenu2.setEnabled(true);
}
if (currentFocusedBtn!=3) {
btn_bottommenu3.setEnabled(true);
}
}
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
last_list_view_pos = view.getFirstVisiblePosition();
}
//private boolean mSaveMemory = false;
public void onScrollStateChanged(AbsListView view, int scrollState) {
switch (scrollState) {
case OnScrollListener.SCROLL_STATE_IDLE:
enableButtons();
mBusy = false;
int first = view.getFirstVisiblePosition();
int count = view.getChildCount();
int l_releaseTarget;
for (int i=0; i/if outofmemory, we try to clean up 10 view image resources,
//and try again
for (int j = 0; j < 10; ++j) {
l_releaseTarget = first - count - j;
if (l_releaseTarget > 0) {
IconifiedTextSelected l_its = displayEntries.get(l_releaseTarget);
IconifiedTextSelectedView l_itsv = (IconifiedTextSelectedView)
this.getListView().getChildAt(l_releaseTarget);
if (l_itsv!=null) {
l_itsv.setIcon(null);
}
if (l_its != null) {
Drawable l_dr = l_its.getIcon();
l_its.setIcon(null);
if (l_dr != null) {
l_dr.setCallback(null);
l_dr = null;
}
}
}
}
System.gc();
//after clean up, we try again
if (l_type == 1) {
l_icon = null;
} else if (l_type == 2) {
l_icon = null;
}
}
this.displayEntries.get(first+i).setIcon(l_icon);
if (l_icon != null) {
t.setIcon(l_icon);
t.setTag(null);
}
}
}
//System.gc();
break;
case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL:
disableButtons();
mBusy = true;
break;
case OnScrollListener.SCROLL_STATE_FLING:
disableButtons();
mBusy = true;
break;
}
}
/**
* List item click action
*/
private File currentFile;
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
last_list_view_pos = position;
String selectedFileOrDirName = this.displayEntries.get((int)id).getText();
if (selectedFileOrDirName.equals(upOneLevel)) {
if (this.currentDirectory.getParent()!=null) {
last_list_view_pos = 0;
browseTo(this.currentDirectory.getParentFile());
}
} else {
File l_clickedFile = new File(this.displayEntries.get((int)id).getText());
if (l_clickedFile != null) {
if (l_clickedFile.isDirectory()) {
last_list_view_pos = 0;
browseTo(l_clickedFile);
} else {
showVideoInfo(l_clickedFile);
}
}
}
}
private void browseTo(final File _dir) {
if (_dir.isDirectory()) {
this.currentDirectory = _dir;
loadVideosFromDirectory(_dir.getAbsolutePath());
}
}
/**
* Slow adapter: this part of the code implements the list adapter
* Will not bind views while the list is scrolling
*/
private class SlowAdapter extends BaseAdapter {
/** Remember our context so we can use it when constructing views. */
private Context mContext;
private List<iconifiedtextselected> mItems = new ArrayList<iconifiedtextselected>();
public SlowAdapter(Context context) {
mContext = context;
}
public void setListItems(List<iconifiedtextselected> lit)
{ mItems = lit; }
/** @return The number of items in the */
public int getCount() { return mItems.size(); }
public Object getItem(int position)
{ return mItems.get(position); }
/** Use the array index as a unique id. */
public long getItemId(int position) {
return position;
}
/** @param convertView The old view to overwrite, if one is passed
* @returns a IconifiedTextSelectedView that holds wraps around an IconifiedText */
public View getView(int position, View convertView, ViewGroup parent) {
IconifiedTextSelectedView btv;
if (convertView == null) {
btv = new IconifiedTextSelectedView(mContext, mItems.get(position));
} else { // Reuse/Overwrite the View passed
// We are assuming(!) that it is castable!
btv = (IconifiedTextSelectedView) convertView;
btv.setText(mItems.get(position).getText());
}
if (position==0) {
if (VideoBrowser.self.media_browser_load_option==0) {
btv.setIcon(R.drawable.folderback);
} else if (mItems.get(0).getIcon()!=null) {
btv.setIcon(mItems.get(position).getIcon());
} else {
btv.setIcon(R.drawable.video);
}
}
//in busy mode
else if (mBusy){
//if icon is NULL: the icon is not loaded yet; load default icon
if (mItems.get(position).getIcon()==null) {
btv.setIcon(R.drawable.video);
//mark this view, indicates the icon is not loaded
btv.setTag(this);
} else {
//if icon is not null, just display the icon
btv.setIcon(mItems.get(position).getIcon());
//mark this view, indicates the icon is loaded
btv.setTag(null);
}
} else {
//if not busy
Drawable d = mItems.get(position).getIcon();
if (d == null) {
//icon is not loaded, load now
btv.setIcon(R.drawable.video);
btv.setTag(this);
} else {
btv.setIcon(mItems.get(position).getIcon());
btv.setTag(null);
}
}
return btv;
}
}
</iconifiedtextselected></iconifiedtextselected></iconifiedtextselected></iconifiedtextselected></iconifiedtextselected></iconifiedtextselected></iconifiedtextselected>}
-
Trying to sync audio/visual using FFMpeg and openAL
22 août 2013, par user1379811hI have been studying dranger ffmpeg tutorial which explains how to sync audio and visual once you have the frames displayed and audio playing which is where im at.
Unfortunately, the tutorial is out of date (Stephen Dranger explaained that himself to me) and also uses sdl which im not doing - this is for Blackberry 10 application.
I just cannot make the video frames display at the correct speed (they are just playing very fast) and I have been trying for over a week now - seriously !
I have 3 threads happening - one to read from stream into audio and video queues and then 2 threads for audio and video.
If somebody could explain whats happening after scanning my relevent code you would be a lifesaver.
The delay (what I pass to usleep(testDelay) seems to be going up (incrementing) which doesn't seem right to me.
count = 1;
MyApp* inst = worker->app;//(VideoUploadFacebook*)arg;
qDebug() << "\n start loadstream";
w = new QWaitCondition();
w2 = new QWaitCondition();
context = avformat_alloc_context();
inst->threadStarted = true;
cout << "start of decoding thread";
cout.flush();
av_register_all();
avcodec_register_all();
avformat_network_init();
av_log_set_callback(&log_callback);
AVInputFormat *pFormat;
//const char device[] = "/dev/video0";
const char formatName[] = "mp4";
cout << "2start of decoding thread";
cout.flush();
if (!(pFormat = av_find_input_format(formatName))) {
printf("can't find input format %s\n", formatName);
//return void*;
}
//open rtsp
if(avformat_open_input(&context, inst->capturedUrl.data(), pFormat,NULL) != 0){
// return ;
cout << "error opening of decoding thread: " << inst->capturedUrl.data();
cout.flush();
}
cout << "3start of decoding thread";
cout.flush();
// av_dump_format(context, 0, inst->capturedUrl.data(), 0);
/* if(avformat_find_stream_info(context,NULL) < 0){
return EXIT_FAILURE;
}
*/
//search video stream
for(int i =0;inb_streams;i++){
if(context->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO)
inst->video_stream_index = i;
}
cout << "3z start of decoding thread";
cout.flush();
AVFormatContext* oc = avformat_alloc_context();
av_read_play(context);//play RTSP
AVDictionary *optionsDict = NULL;
ccontext = context->streams[inst->video_stream_index]->codec;
inst->audioc = context->streams[1]->codec;
cout << "4start of decoding thread";
cout.flush();
codec = avcodec_find_decoder(ccontext->codec_id);
ccontext->pix_fmt = PIX_FMT_YUV420P;
AVCodec* audio_codec = avcodec_find_decoder(inst->audioc->codec_id);
inst->packet = new AVPacket();
if (!audio_codec) {
cout << "audio codec not found\n"; //fflush( stdout );
exit(1);
}
if (avcodec_open2(inst->audioc, audio_codec, NULL) < 0) {
cout << "could not open codec\n"; //fflush( stdout );
exit(1);
}
if (avcodec_open2(ccontext, codec, &optionsDict) < 0) exit(1);
cout << "5start of decoding thread";
cout.flush();
inst->pic = avcodec_alloc_frame();
av_init_packet(inst->packet);
while(av_read_frame(context,inst->packet) >= 0 && &inst->keepGoing)
{
if(inst->packet->stream_index == 0){//packet is video
int check = 0;
// av_init_packet(inst->packet);
int result = avcodec_decode_video2(ccontext, inst->pic, &check, inst->packet);
if(check)
break;
}
}
inst->originalVideoWidth = inst->pic->width;
inst->originalVideoHeight = inst->pic->height;
float aspect = (float)inst->originalVideoHeight / (float)inst->originalVideoWidth;
inst->newVideoWidth = inst->originalVideoWidth;
int newHeight = (int)(inst->newVideoWidth * aspect);
inst->newVideoHeight = newHeight;//(int)inst->originalVideoHeight / inst->originalVideoWidth * inst->newVideoWidth;// = new height
int size = avpicture_get_size(PIX_FMT_YUV420P, inst->originalVideoWidth, inst->originalVideoHeight);
uint8_t* picture_buf = (uint8_t*)(av_malloc(size));
avpicture_fill((AVPicture *) inst->pic, picture_buf, PIX_FMT_YUV420P, inst->originalVideoWidth, inst->originalVideoHeight);
picrgb = avcodec_alloc_frame();
int size2 = avpicture_get_size(PIX_FMT_YUV420P, inst->newVideoWidth, inst->newVideoHeight);
uint8_t* picture_buf2 = (uint8_t*)(av_malloc(size2));
avpicture_fill((AVPicture *) picrgb, picture_buf2, PIX_FMT_YUV420P, inst->newVideoWidth, inst->newVideoHeight);
if(ccontext->pix_fmt != PIX_FMT_YUV420P)
{
std::cout << "fmt != 420!!!: " << ccontext->pix_fmt << std::endl;//
// return (EXIT_SUCCESS);//-1;
}
if (inst->createForeignWindow(inst->myForeignWindow->windowGroup(),
"HelloForeignWindowAppIDqq", 0,
0, inst->newVideoWidth,
inst->newVideoHeight)) {
} else {
qDebug() << "The ForeginWindow was not properly initialized";
}
inst->keepGoing = true;
inst->img_convert_ctx = sws_getContext(inst->originalVideoWidth, inst->originalVideoHeight, PIX_FMT_YUV420P, inst->newVideoWidth, inst->newVideoHeight,
PIX_FMT_YUV420P, SWS_BILINEAR, NULL, NULL, NULL);
is = (VideoState*)av_mallocz(sizeof(VideoState));
if (!is)
return NULL;
is->audioStream = 1;
is->audio_st = context->streams[1];
is->audio_buf_size = 0;
is->audio_buf_index = 0;
is->videoStream = 0;
is->video_st = context->streams[0];
is->frame_timer = (double)av_gettime() / 1000000.0;
is->frame_last_delay = 40e-3;
is->av_sync_type = DEFAULT_AV_SYNC_TYPE;
//av_strlcpy(is->filename, filename, sizeof(is->filename));
is->iformat = pFormat;
is->ytop = 0;
is->xleft = 0;
/* start video display */
is->pictq_mutex = new QMutex();
is->pictq_cond = new QWaitCondition();
is->subpq_mutex = new QMutex();
is->subpq_cond = new QWaitCondition();
is->video_current_pts_time = av_gettime();
packet_queue_init(&audioq);
packet_queue_init(&videoq);
is->audioq = audioq;
is->videoq = videoq;
AVPacket* packet2 = new AVPacket();
ccontext->get_buffer = our_get_buffer;
ccontext->release_buffer = our_release_buffer;
av_init_packet(packet2);
while(inst->keepGoing)
{
if(av_read_frame(context,packet2) < 0 && keepGoing)
{
printf("bufferframe Could not read a frame from stream.\n");
fflush( stdout );
}else {
if(packet2->stream_index == 0) {
packet_queue_put(&videoq, packet2);
} else if(packet2->stream_index == 1) {
packet_queue_put(&audioq, packet2);
} else {
av_free_packet(packet2);
}
if(!videoThreadStarted)
{
videoThreadStarted = true;
QThread* thread = new QThread;
videoThread = new VideoStreamWorker(this);
// Give QThread ownership of Worker Object
videoThread->moveToThread(thread);
connect(videoThread, SIGNAL(error(QString)), this, SLOT(errorHandler(QString)));
QObject::connect(videoThread, SIGNAL(refreshNeeded()), this, SLOT(refreshNeededSlot()));
connect(thread, SIGNAL(started()), videoThread, SLOT(doWork()));
connect(videoThread, SIGNAL(finished()), thread, SLOT(quit()));
connect(videoThread, SIGNAL(finished()), videoThread, SLOT(deleteLater()));
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
thread->start();
}
if(!audioThreadStarted)
{
audioThreadStarted = true;
QThread* thread = new QThread;
AudioStreamWorker* videoThread = new AudioStreamWorker(this);
// Give QThread ownership of Worker Object
videoThread->moveToThread(thread);
// Connect videoThread error signal to this errorHandler SLOT.
connect(videoThread, SIGNAL(error(QString)), this, SLOT(errorHandler(QString)));
// Connects the thread’s started() signal to the process() slot in the videoThread, causing it to start.
connect(thread, SIGNAL(started()), videoThread, SLOT(doWork()));
connect(videoThread, SIGNAL(finished()), thread, SLOT(quit()));
connect(videoThread, SIGNAL(finished()), videoThread, SLOT(deleteLater()));
// Make sure the thread object is deleted after execution has finished.
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
thread->start();
}
}
} //finished main loop
int MyApp::video_thread() {
//VideoState *is = (VideoState *)arg;
AVPacket pkt1, *packet = &pkt1;
int len1, frameFinished;
double pts;
pic = avcodec_alloc_frame();
for(;;) {
if(packet_queue_get(&videoq, packet, 1) < 0) {
// means we quit getting packets
break;
}
pts = 0;
global_video_pkt_pts2 = packet->pts;
// Decode video frame
len1 = avcodec_decode_video2(ccontext, pic, &frameFinished, packet);
if(packet->dts == AV_NOPTS_VALUE
&& pic->opaque && *(uint64_t*)pic->opaque != AV_NOPTS_VALUE) {
pts = *(uint64_t *)pic->opaque;
} else if(packet->dts != AV_NOPTS_VALUE) {
pts = packet->dts;
} else {
pts = 0;
}
pts *= av_q2d(is->video_st->time_base);
// Did we get a video frame?
if(frameFinished) {
pts = synchronize_video(is, pic, pts);
actualPts = pts;
refreshSlot();
}
av_free_packet(packet);
}
av_free(pic);
return 0;
}
int MyApp::audio_thread() {
//VideoState *is = (VideoState *)arg;
AVPacket pkt1, *packet = &pkt1;
int len1, frameFinished;
ALuint source;
ALenum format = 0;
// ALuint frequency;
ALenum alError;
ALint val2;
ALuint buffers[NUM_BUFFERS];
int dataSize;
ALCcontext *aContext;
ALCdevice *device;
if (!alutInit(NULL, NULL)) {
// printf(stderr, "init alut error\n");
}
device = alcOpenDevice(NULL);
if (device == NULL) {
// printf(stderr, "device error\n");
}
//Create a context
aContext = alcCreateContext(device, NULL);
alcMakeContextCurrent(aContext);
if(!(aContext)) {
printf("Could not create the OpenAL context!\n");
return 0;
}
alListener3f(AL_POSITION, 0.0f, 0.0f, 0.0f);
//ALenum alError;
if(alGetError() != AL_NO_ERROR) {
cout << "could not create buffers";
cout.flush();
fflush( stdout );
return 0;
}
alGenBuffers(NUM_BUFFERS, buffers);
alGenSources(1, &source);
if(alGetError() != AL_NO_ERROR) {
cout << "after Could not create buffers or the source.\n";
cout.flush( );
return 0;
}
int i;
int indexOfPacket;
double pts;
//double pts;
int n;
for(i = 0; i < NUM_BUFFERS; i++)
{
if(packet_queue_get(&audioq, packet, 1) < 0) {
// means we quit getting packets
break;
}
cout << "streamindex=audio \n";
cout.flush( );
//printf("before decode audio\n");
//fflush( stdout );
// AVPacket *packet = new AVPacket();//malloc(sizeof(AVPacket*));
AVFrame *decodedFrame = NULL;
int gotFrame = 0;
// AVFrame* decodedFrame;
if(!decodedFrame) {
if(!(decodedFrame = avcodec_alloc_frame())) {
cout << "Run out of memory, stop the streaming...\n";
fflush( stdout );
cout.flush();
return -2;
}
} else {
avcodec_get_frame_defaults(decodedFrame);
}
int len = avcodec_decode_audio4(audioc, decodedFrame, &gotFrame, packet);
if(len < 0) {
cout << "Error while decoding.\n";
cout.flush( );
return -3;
}
if(len < 0) {
/* if error, skip frame */
is->audio_pkt_size = 0;
//break;
}
is->audio_pkt_data += len;
is->audio_pkt_size -= len;
pts = is->audio_clock;
// *pts_ptr = pts;
n = 2 * is->audio_st->codec->channels;
is->audio_clock += (double)packet->size/
(double)(n * is->audio_st->codec->sample_rate);
if(gotFrame) {
cout << "got audio frame.\n";
cout.flush( );
// We have a buffer ready, send it
dataSize = av_samples_get_buffer_size(NULL, audioc->channels,
decodedFrame->nb_samples, audioc->sample_fmt, 1);
if(!format) {
if(audioc->sample_fmt == AV_SAMPLE_FMT_U8 ||
audioc->sample_fmt == AV_SAMPLE_FMT_U8P) {
if(audioc->channels == 1) {
format = AL_FORMAT_MONO8;
} else if(audioc->channels == 2) {
format = AL_FORMAT_STEREO8;
}
} else if(audioc->sample_fmt == AV_SAMPLE_FMT_S16 ||
audioc->sample_fmt == AV_SAMPLE_FMT_S16P) {
if(audioc->channels == 1) {
format = AL_FORMAT_MONO16;
} else if(audioc->channels == 2) {
format = AL_FORMAT_STEREO16;
}
}
if(!format) {
cout << "OpenAL can't open this format of sound.\n";
cout.flush( );
return -4;
}
}
printf("albufferdata audio b4.\n");
fflush( stdout );
alBufferData(buffers[i], format, *decodedFrame->data, dataSize, decodedFrame->sample_rate);
cout << "after albufferdata all buffers \n";
cout.flush( );
av_free_packet(packet);
//=av_free(packet);
av_free(decodedFrame);
if((alError = alGetError()) != AL_NO_ERROR) {
printf("Error while buffering.\n");
printAlError(alError);
return -6;
}
}
}
cout << "before quoe buffers \n";
cout.flush();
alSourceQueueBuffers(source, NUM_BUFFERS, buffers);
cout << "before play.\n";
cout.flush();
alSourcePlay(source);
cout << "after play.\n";
cout.flush();
if((alError = alGetError()) != AL_NO_ERROR) {
cout << "error strating stream.\n";
cout.flush();
printAlError(alError);
return 0;
}
// AVPacket *pkt = &is->audio_pkt;
while(keepGoing)
{
while(packet_queue_get(&audioq, packet, 1) >= 0) {
// means we quit getting packets
do {
alGetSourcei(source, AL_BUFFERS_PROCESSED, &val2);
usleep(SLEEP_BUFFERING);
} while(val2 <= 0);
if(alGetError() != AL_NO_ERROR)
{
fprintf(stderr, "Error gettingsource :(\n");
return 1;
}
while(val2--)
{
ALuint buffer;
alSourceUnqueueBuffers(source, 1, &buffer);
if(alGetError() != AL_NO_ERROR)
{
fprintf(stderr, "Error unqueue buffers :(\n");
// return 1;
}
AVFrame *decodedFrame = NULL;
int gotFrame = 0;
// AVFrame* decodedFrame;
if(!decodedFrame) {
if(!(decodedFrame = avcodec_alloc_frame())) {
cout << "Run out of memory, stop the streaming...\n";
//fflush( stdout );
cout.flush();
return -2;
}
} else {
avcodec_get_frame_defaults(decodedFrame);
}
int len = avcodec_decode_audio4(audioc, decodedFrame, &gotFrame, packet);
if(len < 0) {
cout << "Error while decoding.\n";
cout.flush( );
is->audio_pkt_size = 0;
return -3;
}
is->audio_pkt_data += len;
is->audio_pkt_size -= len;
if(packet->size <= 0) {
/* No data yet, get more frames */
//continue;
}
if(gotFrame) {
pts = is->audio_clock;
len = synchronize_audio(is, (int16_t *)is->audio_buf,
packet->size, pts);
is->audio_buf_size = packet->size;
pts = is->audio_clock;
// *pts_ptr = pts;
n = 2 * is->audio_st->codec->channels;
is->audio_clock += (double)packet->size /
(double)(n * is->audio_st->codec->sample_rate);
if(packet->pts != AV_NOPTS_VALUE) {
is->audio_clock = av_q2d(is->audio_st->time_base)*packet->pts;
}
len = av_samples_get_buffer_size(NULL, audioc->channels,
decodedFrame->nb_samples, audioc->sample_fmt, 1);
alBufferData(buffer, format, *decodedFrame->data, len, decodedFrame->sample_rate);
if(alGetError() != AL_NO_ERROR)
{
fprintf(stderr, "Error buffering :(\n");
return 1;
}
alSourceQueueBuffers(source, 1, &buffer);
if(alGetError() != AL_NO_ERROR)
{
fprintf(stderr, "Error queueing buffers :(\n");
return 1;
}
}
}
alGetSourcei(source, AL_SOURCE_STATE, &val2);
if(val2 != AL_PLAYING)
alSourcePlay(source);
}
//pic = avcodec_alloc_frame();
}
qDebug() << "end audiothread";
return 1;
}
void MyApp::refreshSlot()
{
if(true)
{
printf("got frame %d, %d\n", pic->width, ccontext->width);
fflush( stdout );
sws_scale(img_convert_ctx, (const uint8_t **)pic->data, pic->linesize,
0, originalVideoHeight, &picrgb->data[0], &picrgb->linesize[0]);
printf("rescaled frame %d, %d\n", newVideoWidth, newVideoHeight);
fflush( stdout );
//av_free_packet(packet);
//av_init_packet(packet);
qDebug() << "waking audio as video finished";
////mutex.unlock();
//mutex2.lock();
doingVideoFrame = false;
//doingAudioFrame = false;
////mutex2.unlock();
//mutex2.unlock();
//w2->wakeAll();
//w->wakeAll();
qDebug() << "now woke audio";
//pic = picrgb;
uint8_t *srcy = picrgb->data[0];
uint8_t *srcu = picrgb->data[1];
uint8_t *srcv = picrgb->data[2];
printf("got src yuv frame %d\n", &srcy);
fflush( stdout );
unsigned char *ptr = NULL;
screen_get_buffer_property_pv(mScreenPixelBuffer, SCREEN_PROPERTY_POINTER, (void**) &ptr);
unsigned char *y = ptr;
unsigned char *u = y + (newVideoHeight * mStride) ;
unsigned char *v = u + (newVideoHeight * mStride) / 4;
int i = 0;
printf("got buffer picrgbwidth= %d \n", newVideoWidth);
fflush( stdout );
for ( i = 0; i < newVideoHeight; i++)
{
int doff = i * mStride;
int soff = i * picrgb->linesize[0];
memcpy(&y[doff], &srcy[soff], newVideoWidth);
}
for ( i = 0; i < newVideoHeight / 2; i++)
{
int doff = i * mStride / 2;
int soff = i * picrgb->linesize[1];
memcpy(&u[doff], &srcu[soff], newVideoWidth / 2);
}
for ( i = 0; i < newVideoHeight / 2; i++)
{
int doff = i * mStride / 2;
int soff = i * picrgb->linesize[2];
memcpy(&v[doff], &srcv[soff], newVideoWidth / 2);
}
printf("before posttoscreen \n");
fflush( stdout );
video_refresh_timer();
qDebug() << "end refreshslot";
}
else
{
}
}
void MyApp::refreshNeededSlot2()
{
printf("blitting to buffer");
fflush(stdout);
screen_buffer_t screen_buffer;
screen_get_window_property_pv(mScreenWindow, SCREEN_PROPERTY_RENDER_BUFFERS, (void**) &screen_buffer);
int attribs[] = { SCREEN_BLIT_SOURCE_WIDTH, newVideoWidth, SCREEN_BLIT_SOURCE_HEIGHT, newVideoHeight, SCREEN_BLIT_END };
int res2 = screen_blit(mScreenCtx, screen_buffer, mScreenPixelBuffer, attribs);
printf("dirty rectangles");
fflush(stdout);
int dirty_rects[] = { 0, 0, newVideoWidth, newVideoHeight };
screen_post_window(mScreenWindow, screen_buffer, 1, dirty_rects, 0);
printf("done screneposdtwindow");
fflush(stdout);
}
void MyApp::video_refresh_timer() {
testDelay = 0;
// VideoState *is = ( VideoState* )userdata;
VideoPicture *vp;
//double pts = 0 ;
double actual_delay, delay, sync_threshold, ref_clock, diff;
if(is->video_st) {
if(false)////is->pictq_size == 0)
{
testDelay = 1;
schedule_refresh(is, 1);
} else {
// vp = &is->pictq[is->pictq_rindex];
delay = actualPts - is->frame_last_pts; /* the pts from last time */
if(delay <= 0 || delay >= 1.0) {
/* if incorrect delay, use previous one */
delay = is->frame_last_delay;
}
/* save for next time */
is->frame_last_delay = delay;
is->frame_last_pts = actualPts;
is->video_current_pts = actualPts;
is->video_current_pts_time = av_gettime();
/* update delay to sync to audio */
ref_clock = get_audio_clock(is);
diff = actualPts - ref_clock;
/* Skip or repeat the frame. Take delay into account
FFPlay still doesn't "know if this is the best guess." */
sync_threshold = (delay > AV_SYNC_THRESHOLD) ? delay : AV_SYNC_THRESHOLD;
if(fabs(diff) < AV_NOSYNC_THRESHOLD) {
if(diff <= -sync_threshold) {
delay = 0;
} else if(diff >= sync_threshold) {
delay = 2 * delay;
}
}
is->frame_timer += delay;
/* computer the REAL delay */
actual_delay = is->frame_timer - (av_gettime() / 1000000.0);
if(actual_delay < 0.010) {
/* Really it should skip the picture instead */
actual_delay = 0.010;
}
testDelay = (int)(actual_delay * 1000 + 0.5);
schedule_refresh(is, (int)(actual_delay * 1000 + 0.5));
/* show the picture! */
//video_display(is);
// SDL_CondSignal(is->pictq_cond);
// SDL_UnlockMutex(is->pictq_mutex);
}
} else {
testDelay = 100;
schedule_refresh(is, 100);
}
}
void MyApp::schedule_refresh(VideoState *is, int delay) {
qDebug() << "start schedule refresh timer" << delay;
typeOfEvent = FF_REFRESH_EVENT2;
w->wakeAll();
// SDL_AddTimer(delay,
}I am currently waiting on data in a loop in the following way
QMutex mutex;
mutex.lock();
while(keepGoing)
{
qDebug() << "MAINTHREAD" << testDelay;
w->wait(&mutex);
mutex.unlock();
qDebug() << "MAINTHREAD past wait";
if(!keepGoing)
{
break;
}
if(testDelay > 0 && typeOfEvent == FF_REFRESH_EVENT2)
{
usleep(testDelay);
refreshNeededSlot2();
}
else if(testDelay > 0 && typeOfEvent == FF_QUIT_EVENT2)
{
keepGoing = false;
exit(0);
break;
// usleep(testDelay);
// refreshNeededSlot2();
}
qDebug() << "MAINTHREADend";
mutex.lock();
}
mutex.unlock();Please let me know if I need to provide any more relevent code. I'm sorry my code is untidy - I still learning c++ and have been modifying this code for over a week now as previously mentioned.
Just added a sample of output I'm seeing from print outs I do to console - I can't get my head around it (it's almost too complicated for my level of expertise) but when you see the frames being played and audio playing it's very difficult to give up especially when it took me a couple of weeks to get to this stage.
Please someone give me a hand if they spot the problem.
MAINTHREAD past wait
pts after syncvideo= 1073394046
got frame 640, 640
start video_refresh_timer
actualpts = 1.66833
frame lastpts = 1.63497
start schedule refresh timer need to delay for 123pts after syncvideo= 1073429033
got frame 640, 640
MAINTHREAD loop delay before refresh = 123
start video_refresh_timer
actualpts = 1.7017
frame lastpts = 1.66833
start schedule refresh timer need to delay for 115MAINTHREAD past wait
pts after syncvideo= 1073464021
got frame 640, 640
start video_refresh_timer
actualpts = 1.73507
frame lastpts = 1.7017
start schedule refresh timer need to delay for 140MAINTHREAD loop delay before refresh = 140
pts after syncvideo= 1073499008
got frame 640, 640
start video_refresh_timer
actualpts = 1.76843
frame lastpts = 1.73507
start schedule refresh timer need to delay for 163MAINTHREAD past wait
pts after syncvideo= 1073533996
got frame 640, 640
start video_refresh_timer
actualpts = 1.8018
frame lastpts = 1.76843
start schedule refresh timer need to delay for 188MAINTHREAD loop delay before refresh = 188
pts after syncvideo= 1073568983
got frame 640, 640
start video_refresh_timer
actualpts = 1.83517
frame lastpts = 1.8018
start schedule refresh timer need to delay for 246MAINTHREAD past wait
pts after syncvideo= 1073603971
got frame 640, 640
start video_refresh_timer
actualpts = 1.86853
frame lastpts = 1.83517
start schedule refresh timer need to delay for 299MAINTHREAD loop delay before refresh = 299
pts after syncvideo= 1073638958
got frame 640, 640
start video_refresh_timer
actualpts = 1.9019
frame lastpts = 1.86853
start schedule refresh timer need to delay for 358MAINTHREAD past wait
pts after syncvideo= 1073673946
got frame 640, 640
start video_refresh_timer
actualpts = 1.93527
frame lastpts = 1.9019
start schedule refresh timer need to delay for 416MAINTHREAD loop delay before refresh = 416
pts after syncvideo= 1073708933
got frame 640, 640
start video_refresh_timer
actualpts = 1.96863
frame lastpts = 1.93527
start schedule refresh timer need to delay for 474MAINTHREAD past wait
pts after syncvideo= 1073742872
got frame 640, 640
MAINTHREAD loop delay before refresh = 474
start video_refresh_timer
actualpts = 2.002
frame lastpts = 1.96863
start schedule refresh timer need to delay for 518MAINTHREAD past wait
pts after syncvideo= 1073760366
got frame 640, 640
start video_refresh_timer
actualpts = 2.03537
frame lastpts = 2.002
start schedule refresh timer need to delay for 575 -
popen returns output after delay ?
7 février 2013, par ScarfaceI am executing FFMPEG with
popen()
to get the result of the process. The main reason I am doing this is so I can stream constant output and build a progress bar.The issue is that the process starts and I receive some initial information. The rest of the information does not appear until after the process is done however. So essentially, the rest of the output (output on the progress) which comes on intervals when the process is going is delayed right before the process and all comes at once after the process is done which is useless.
I need the output to constantly come so I can update a progress bar. If I change 2>&1 to 2> stderr.txt that text file receives output consistently but I would like to receive in php since many processes may be running. Anyone have any ideas on solving this ? It seems noone can figure this out...and it is driving me crazy ! IF anyone helps me figure this out (and actually solve it), I will start a bounty and then accept their answer.
$handle = popen ('/usr/local/bin/ffmpeg -i /home/g/Desktop/cave.wmv -deinterlace -acodec libfaac -ab 96k -ar 44100 -vcodec libx264 -s 480x320 -f flv /home/g/Desktop/file.flv 2>&1', 'r');
if ($handle) {
while(! feof ($handle)) {
echo $read = fgets ($handle);
ob_flush();
flush();
}
pclose ($handle);
}OUTPUTS
ffmpeg version git-N-30561-g6700aa8, Copyright (c) 2000-2011 the FFmpeg developers built on Jun 5 2011 21:10:26 with gcc 4.5.2 configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-x11grab libavutil 51. 4. 0 / 51. 4. 0 libavcodec 53. 6. 1 / 53. 6. 1 libavformat 53. 2. 0 / 53. 2. 0 libavdevice 53. 1. 1 / 53. 1. 1 libavfilter 2. 13. 0 / 2. 13. 0 libswscale 0. 14. 1 / 0. 14. 1 libpostproc 51. 2. 0 / 51. 2. 0 Seems stream 0 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 29.97 (30000/1001) Input #0, asf, from '/home/geoff/Desktop/cave.wmv': Metadata: WMFSDKVersion : 11.0.5721.5145 WMFSDKNeeded : 0.0.0.0000 IsVBR : 0 Duration: 00:01:37.93, bitrate: 263 kb/s Stream #0.0(eng): Video: vc1 (Advanced), yuv420p, 320x240, 256 kb/s, PAR 1:1 DAR 4:3, 29.97 tbr, 1k tbn, 1k tbc [buffer @ 0xacae200] w:320 h:240 pixfmt:yuv420p tb:1/1000000 sar:1/1 sws_param: [scale @ 0xacbc120] w:320 h:240 fmt:yuv420p -> w:480 h:320 fmt:yuv420p flags:0x4 [libx264 @ 0xacbb7e0] Default settings detected, using medium profile [libx264 @ 0xacbb7e0] using SAR=1/1 [libx264 @ 0xacbb7e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle Cache64 [libx264 @ 0xacbb7e0] profile High, level 2.1 [libx264 @ 0xacbb7e0] 264 - core 115 r1995 c1e60b9 - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=1 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 Output #0, flv, to '/home/geoff/Desktop/file.flv': Metadata: WMFSDKVersion : 11.0.5721.5145 WMFSDKNeeded : 0.0.0.0000 IsVBR : 0 encoder : Lavf53.2.0 Stream #0.0(eng): Video: libx264, yuv420p, 480x320 [PAR 1:1 DAR 3:2], q=2-31, 200 kb/s, 1k tbn, 29.97 tbc Stream mapping: Stream #0.0 -> #0.0 Press [q] to stop, [?] for help
**THEN AFTER THE PROCESS IS COMPLETE OUTPUTS**
frame= 49 fps= 0 q=29.0 size= 17kB time=00:00:00.23 bitrate= 593.9kbits/s frame= 58 fps= 52 q=29.0 size= 29kB time=00:00:00.53 bitrate= 448.9kbits/s frame= 71 fps= 44 q=29.0 size= 48kB time=00:00:00.96 bitrate= 405.7kbits/s frame= 85 fps= 39 q=29.0 size= 69kB time=00:00:01.43 bitrate= 393.2kbits/s frame= 104 fps= 38 q=29.0 size= 90kB time=00:00:02.06 bitrate= 358.3kbits/s frame= 117 fps= 36 q=29.0 size= 104kB time=00:00:02.50 bitrate= 339.5kbits/s frame= 134 fps= 36 q=29.0 size= 119kB time=00:00:03.06 bitrate= 317.6kbits/s frame= 153 fps= 36 q=29.0 size= 137kB time=00:00:03.70 bitrate= 303.5kbits/s frame= 167 fps= 35 q=29.0 size= 153kB time=00:00:04.17 bitrate= 300.1kbits/s frame= 185 fps= 35 q=29.0 size= 173kB time=00:00:04.77 bitrate= 296.8kbits/s frame= 201 fps= 35 q=29.0 size= 199kB time=00:00:05.30 bitrate= 306.8kbits/s frame= 218 fps= 35 q=29.0 size= 222kB time=00:00:05.87 bitrate= 310.3kbits/s frame= 237 fps= 35 q=29.0 size= 245kB time=00:00:06.50 bitrate= 309.1kbits/s frame= 254 fps= 35 q=29.0 size= 267kB time=00:00:07.07 bitrate= 309.7kbits/s frame= 270 fps= 34 q=29.0 size= 285kB time=00:00:07.60 bitrate= 307.2kbits/s frame= 292 fps= 35 q=29.0 size= 314kB time=00:00:08.34 bitrate= 308.5kbits/s frame= 316 fps= 36 q=29.0 size= 334kB time=00:00:09.14 bitrate= 299.3kbits/s frame= 336 fps= 36 q=29.0 size= 356kB time=00:00:09.80 bitrate= 297.0kbits/s frame= 356 fps= 36 q=29.0 size= 381kB time=00:00:10.47 bitrate= 297.9kbits/s frame= 375 fps= 36 q=29.0 size= 405kB time=00:00:11.11 bitrate= 298.5kbits/s frame= 391 fps= 36 q=29.0 size= 431kB time=00:00:11.64 bitrate= 303.5kbits/s frame= 408 fps= 36 q=29.0 size= 456kB time=00:00:12.21 bitrate= 305.8kbits/s frame= 424 fps= 35 q=29.0 size= 479kB time=00:00:12.74 bitrate= 307.8kbits/s frame= 441 fps= 35 q=29.0 size= 503kB time=00:00:13.31 bitrate= 309.3kbits/s frame= 462 fps= 36 q=29.0 size= 526kB time=00:00:14.01 bitrate= 307.4kbits/s frame= 483 fps= 36 q=29.0 size= 546kB time=00:00:14.71 bitrate= 304.2kbits/s frame= 501 fps= 36 q=29.0 size= 583kB time=00:00:15.31 bitrate= 311.9kbits/s frame= 520 fps= 36 q=29.0 size= 609kB time=00:00:15.95 bitrate= 312.7kbits/s frame= 541 fps= 36 q=29.0 size= 636kB time=00:00:16.65 bitrate= 313.1kbits/s frame= 559 fps= 36 q=29.0 size= 668kB time=00:00:17.25 bitrate= 317.3kbits/s frame= 574 fps= 36 q=29.0 size= 698kB time=00:00:17.75 bitrate= 321.9kbits/s frame= 593 fps= 36 q=29.0 size= 732kB time=00:00:18.38 bitrate= 326.1kbits/s frame= 611 fps= 36 q=29.0 size= 760kB time=00:00:18.98 bitrate= 328.0kbits/s frame= 631 fps= 36 q=29.0 size= 788kB time=00:00:19.65 bitrate= 328.5kbits/s frame= 651 fps= 36 q=29.0 size= 817kB time=00:00:20.32 bitrate= 329.2kbits/s frame= 670 fps= 36 q=29.0 size= 842kB time=00:00:20.95 bitrate= 329.0kbits/s frame= 689 fps= 36 q=29.0 size= 868kB time=00:00:21.58 bitrate= 329.4kbits/s frame= 707 fps= 36 q=29.0 size= 896kB time=00:00:22.18 bitrate= 330.8kbits/s frame= 723 fps= 36 q=29.0 size= 924kB time=00:00:22.72 bitrate= 333.0kbits/s frame= 741 fps= 36 q=29.0 size= 955kB time=00:00:23.32 bitrate= 335.4kbits/s frame= 761 fps= 36 q=29.0 size= 999kB time=00:00:23.99 bitrate= 341.0kbits/s frame= 783 fps= 36 q=29.0 size= 1025kB time=00:00:24.72 bitrate= 339.8kbits/s frame= 802 fps= 36 q=29.0 size= 1047kB time=00:00:25.35 bitrate= 338.3kbits/s frame= 821 fps= 36 q=29.0 size= 1076kB time=00:00:25.99 bitrate= 339.3kbits/s frame= 841 fps= 36 q=29.0 size= 1104kB time=00:00:26.66 bitrate= 339.2kbits/s frame= 861 fps= 36 q=29.0 size= 1137kB time=00:00:27.32 bitrate= 340.7kbits/s frame= 881 fps= 36 q=29.0 size= 1164kB time=00:00:27.99 bitrate= 340.7kbits/s frame= 901 fps= 36 q=29.0 size= 1196kB time=00:00:28.66 bitrate= 341.9kbits/s frame= 919 fps= 36 q=29.0 size= 1223kB time=00:00:29.26 bitrate= 342.5kbits/s frame= 939 fps= 36 q=29.0 size= 1259kB time=00:00:29.93 bitrate= 344.7kbits/s frame= 954 fps= 36 q=29.0 size= 1301kB time=00:00:30.43 bitrate= 350.1kbits/s frame= 970 fps= 36 q=29.0 size= 1337kB time=00:00:30.96 bitrate= 353.7kbits/s frame= 988 fps= 36 q=29.0 size= 1373kB time=00:00:31.56 bitrate= 356.3kbits/s frame= 1005 fps= 36 q=29.0 size= 1418kB time=00:00:32.13 bitrate= 361.4kbits/s frame= 1023 fps= 36 q=29.0 size= 1448kB time=00:00:32.73 bitrate= 362.4kbits/s frame= 1040 fps= 36 q=29.0 size= 1483kB time=00:00:33.30 bitrate= 364.9kbits/s frame= 1058 fps= 36 q=29.0 size= 1519kB time=00:00:33.90 bitrate= 367.1kbits/s frame= 1074 fps= 36 q=29.0 size= 1546kB time=00:00:34.43 bitrate= 367.7kbits/s frame= 1091 fps= 36 q=29.0 size= 1573kB time=00:00:35.00 bitrate= 368.3kbits/s frame= 1111 fps= 36 q=29.0 size= 1593kB time=00:00:35.66 bitrate= 365.9kbits/s frame= 1126 fps= 36 q=29.0 size= 1612kB time=00:00:36.17 bitrate= 365.1kbits/s frame= 1140 fps= 36 q=29.0 size= 1637kB time=00:00:36.63 bitrate= 366.1kbits/s frame= 1151 fps= 35 q=29.0 size= 1657kB time=00:00:37.00 bitrate= 366.9kbits/s frame= 1170 fps= 35 q=29.0 size= 1692kB time=00:00:37.63 bitrate= 368.3kbits/s frame= 1190 fps= 35 q=29.0 size= 1724kB time=00:00:38.30 bitrate= 368.6kbits/s frame= 1208 fps= 35 q=29.0 size= 1751kB time=00:00:38.90 bitrate= 368.6kbits/s frame= 1225 fps= 35 q=29.0 size= 1776kB time=00:00:39.47 bitrate= 368.6kbits/s frame= 1242 fps= 35 q=29.0 size= 1806kB time=00:00:40.04 bitrate= 369.4kbits/s frame= 1265 fps= 35 q=29.0 size= 1840kB time=00:00:40.80 bitrate= 369.4kbits/s frame= 1283 fps= 35 q=29.0 size= 1858kB time=00:00:41.40 bitrate= 367.5kbits/s frame= 1298 fps= 35 q=29.0 size= 1874kB time=00:00:41.90 bitrate= 366.3kbits/s frame= 1317 fps= 35 q=29.0 size= 1898kB time=00:00:42.54 bitrate= 365.5kbits/s frame= 1335 fps= 35 q=29.0 size= 1931kB time=00:00:43.14 bitrate= 366.7kbits/s frame= 1353 fps= 35 q=29.0 size= 1966kB time=00:00:43.74 bitrate= 368.2kbits/s frame= 1371 fps= 35 q=29.0 size= 1996kB time=00:00:44.34 bitrate= 368.8kbits/s frame= 1391 fps= 35 q=29.0 size= 2029kB time=00:00:45.01 bitrate= 369.3kbits/s frame= 1410 fps= 35 q=29.0 size= 2062kB time=00:00:45.64 bitrate= 370.2kbits/s frame= 1430 fps= 35 q=29.0 size= 2089kB time=00:00:46.31 bitrate= 369.4kbits/s frame= 1449 fps= 35 q=29.0 size= 2114kB time=00:00:46.94 bitrate= 368.8kbits/s frame= 1469 fps= 35 q=29.0 size= 2140kB time=00:00:47.61 bitrate= 368.1kbits/s frame= 1488 fps= 35 q=29.0 size= 2169kB time=00:00:48.24 bitrate= 368.3kbits/s frame= 1506 fps= 35 q=29.0 size= 2212kB time=00:00:48.84 bitrate= 371.0kbits/s frame= 1522 fps= 35 q=29.0 size= 2248kB time=00:00:49.38 bitrate= 372.8kbits/s frame= 1540 fps= 35 q=29.0 size= 2278kB time=00:00:49.98 bitrate= 373.4kbits/s frame= 1558 fps= 35 q=29.0 size= 2314kB time=00:00:50.58 bitrate= 374.7kbits/s frame= 1577 fps= 35 q=29.0 size= 2346kB time=00:00:51.21 bitrate= 375.2kbits/s frame= 1598 fps= 35 q=29.0 size= 2377kB time=00:00:51.91 bitrate= 375.1kbits/s frame= 1615 fps= 35 q=29.0 size= 2409kB time=00:00:52.48 bitrate= 375.9kbits/s frame= 1633 fps= 35 q=29.0 size= 2440kB time=00:00:53.08 bitrate= 376.4kbits/s frame= 1651 fps= 35 q=29.0 size= 2470kB time=00:00:53.68 bitrate= 376.9kbits/s frame= 1670 fps= 35 q=29.0 size= 2501kB time=00:00:54.32 bitrate= 377.2kbits/s frame= 1690 fps= 35 q=29.0 size= 2539kB time=00:00:54.98 bitrate= 378.3kbits/s frame= 1707 fps= 35 q=29.0 size= 2570kB time=00:00:55.55 bitrate= 378.9kbits/s frame= 1725 fps= 35 q=29.0 size= 2601kB time=00:00:56.15 bitrate= 379.4kbits/s frame= 1743 fps= 35 q=29.0 size= 2632kB time=00:00:56.75 bitrate= 379.8kbits/s frame= 1762 fps= 35 q=29.0 size= 2677kB time=00:00:57.39 bitrate= 382.2kbits/s frame= 1781 fps= 35 q=29.0 size= 2706kB time=00:00:58.02 bitrate= 382.0kbits/s frame= 1800 fps= 35 q=29.0 size= 2738kB time=00:00:58.65 bitrate= 382.3kbits/s frame= 1821 fps= 35 q=29.0 size= 2765kB time=00:00:59.36 bitrate= 381.6kbits/s frame= 1841 fps= 36 q=29.0 size= 2793kB time=00:01:00.02 bitrate= 381.2kbits/s frame= 1857 fps= 35 q=29.0 size= 2822kB time=00:01:00.56 bitrate= 381.7kbits/s frame= 1875 fps= 35 q=29.0 size= 2849kB time=00:01:01.16 bitrate= 381.6kbits/s frame= 1894 fps= 35 q=29.0 size= 2874kB time=00:01:01.79 bitrate= 381.0kbits/s frame= 1914 fps= 35 q=29.0 size= 2900kB time=00:01:02.46 bitrate= 380.4kbits/s frame= 1933 fps= 35 q=29.0 size= 2924kB time=00:01:03.09 bitrate= 379.7kbits/s frame= 1954 fps= 36 q=29.0 size= 2946kB time=00:01:03.79 bitrate= 378.3kbits/s frame= 1974 fps= 36 q=29.0 size= 2971kB time=00:01:04.46 bitrate= 377.5kbits/s frame= 1991 fps= 36 q=29.0 size= 3005kB time=00:01:05.03 bitrate= 378.5kbits/s frame= 2006 fps= 35 q=29.0 size= 3043kB time=00:01:05.53 bitrate= 380.4kbits/s frame= 2024 fps= 35 q=29.0 size= 3074kB time=00:01:06.13 bitrate= 380.8kbits/s frame= 2042 fps= 35 q=29.0 size= 3099kB time=00:01:06.73 bitrate= 380.5kbits/s frame= 2059 fps= 35 q=29.0 size= 3122kB time=00:01:07.30 bitrate= 380.0kbits/s frame= 2077 fps= 35 q=29.0 size= 3149kB time=00:01:07.90 bitrate= 379.9kbits/s frame= 2096 fps= 35 q=29.0 size= 3172kB time=00:01:08.53 bitrate= 379.2kbits/s frame= 2117 fps= 35 q=29.0 size= 3196kB time=00:01:09.23 bitrate= 378.2kbits/s frame= 2129 fps= 35 q=29.0 size= 3214kB time=00:01:09.63 bitrate= 378.0kbits/s frame= 2147 fps= 35 q=29.0 size= 3246kB time=00:01:10.23 bitrate= 378.6kbits/s frame= 2167 fps= 35 q=29.0 size= 3268kB time=00:01:10.90 bitrate= 377.5kbits/s frame= 2185 fps= 35 q=29.0 size= 3298kB time=00:01:11.50 bitrate= 377.8kbits/s frame= 2204 fps= 35 q=29.0 size= 3327kB time=00:01:12.13 bitrate= 377.8kbits/s frame= 2222 fps= 35 q=29.0 size= 3359kB time=00:01:12.74 bitrate= 378.3kbits/s frame= 2242 fps= 35 q=29.0 size= 3386kB time=00:01:13.40 bitrate= 377.9kbits/s frame= 2261 fps= 35 q=29.0 size= 3428kB time=00:01:14.04 bitrate= 379.3kbits/s frame= 2280 fps= 35 q=29.0 size= 3459kB time=00:01:14.67 bitrate= 379.5kbits/s frame= 2299 fps= 35 q=29.0 size= 3494kB time=00:01:15.30 bitrate= 380.1kbits/s frame= 2318 fps= 35 q=29.0 size= 3514kB time=00:01:15.94 bitrate= 379.1kbits/s frame= 2340 fps= 36 q=29.0 size= 3539kB time=00:01:16.67 bitrate= 378.1kbits/s frame= 2360 fps= 36 q=29.0 size= 3563kB time=00:01:17.34 bitrate= 377.4kbits/s frame= 2377 fps= 36 q=29.0 size= 3586kB time=00:01:17.91 bitrate= 377.1kbits/s frame= 2393 fps= 36 q=29.0 size= 3606kB time=00:01:18.44 bitrate= 376.6kbits/s frame= 2410 fps= 35 q=29.0 size= 3625kB time=00:01:19.01 bitrate= 375.9kbits/s frame= 2427 fps= 35 q=29.0 size= 3639kB time=00:01:19.57 bitrate= 374.7kbits/s frame= 2444 fps= 35 q=29.0 size= 3656kB time=00:01:20.14 bitrate= 373.7kbits/s frame= 2461 fps= 35 q=29.0 size= 3680kB time=00:01:20.71 bitrate= 373.5kbits/s frame= 2473 fps= 35 q=29.0 size= 3702kB time=00:01:21.11 bitrate= 373.9kbits/s frame= 2488 fps= 35 q=29.0 size= 3722kB time=00:01:21.61 bitrate= 373.6kbits/s frame= 2506 fps= 35 q=29.0 size= 3764kB time=00:01:22.21 bitrate= 375.0kbits/s frame= 2522 fps= 35 q=29.0 size= 3788kB time=00:01:22.75 bitrate= 375.0kbits/s frame= 2539 fps= 35 q=29.0 size= 3820kB time=00:01:23.31 bitrate= 375.6kbits/s frame= 2556 fps= 35 q=29.0 size= 3851kB time=00:01:23.88 bitrate= 376.1kbits/s frame= 2571 fps= 35 q=29.0 size= 3885kB time=00:01:24.38 bitrate= 377.2kbits/s frame= 2587 fps= 35 q=29.0 size= 3919kB time=00:01:24.91 bitrate= 378.1kbits/s frame= 2600 fps= 35 q=29.0 size= 3949kB time=00:01:25.35 bitrate= 379.0kbits/s frame= 2616 fps= 35 q=29.0 size= 3975kB time=00:01:25.88 bitrate= 379.1kbits/s frame= 2633 fps= 35 q=29.0 size= 4003kB time=00:01:26.45 bitrate= 379.3kbits/s frame= 2653 fps= 35 q=29.0 size= 4029kB time=00:01:27.12 bitrate= 378.9kbits/s frame= 2665 fps= 35 q=29.0 size= 4045kB time=00:01:27.52 bitrate= 378.6kbits/s frame= 2682 fps= 35 q=29.0 size= 4068kB time=00:01:28.08 bitrate= 378.3kbits/s frame= 2701 fps= 35 q=29.0 size= 4084kB time=00:01:28.72 bitrate= 377.1kbits/s frame= 2719 fps= 35 q=29.0 size= 4124kB time=00:01:29.32 bitrate= 378.2kbits/s frame= 2735 fps= 35 q=29.0 size= 4154kB time=00:01:29.85 bitrate= 378.7kbits/s frame= 2753 fps= 35 q=29.0 size= 4201kB time=00:01:30.45 bitrate= 380.5kbits/s frame= 2771 fps= 35 q=29.0 size= 4230kB time=00:01:31.05 bitrate= 380.6kbits/s frame= 2788 fps= 35 q=29.0 size= 4259kB time=00:01:31.62 bitrate= 380.8kbits/s frame= 2805 fps= 35 q=29.0 size= 4287kB time=00:01:32.19 bitrate= 380.9kbits/s frame= 2825 fps= 35 q=29.0 size= 4318kB time=00:01:32.86 bitrate= 380.9kbits/s frame= 2847 fps= 35 q=29.0 size= 4334kB time=00:01:33.59 bitrate= 379.3kbits/s frame= 2866 fps= 35 q=29.0 size= 4371kB time=00:01:34.22 bitrate= 380.0kbits/s frame= 2885 fps= 35 q=29.0 size= 4395kB time=00:01:34.86 bitrate= 379.6kbits/s frame= 2903 fps= 35 q=29.0 size= 4424kB time=00:01:35.46 bitrate= 379.6kbits/s frame= 2921 fps= 35 q=29.0 size= 4450kB time=00:01:36.06 bitrate= 379.5kbits/s frame= 2934 fps= 35 q=29.0 Lsize= 4512kB time=00:01:37.86 bitrate= 377.7kbits/s dup=0 drop=1 video:4454kB audio:0kB global headers:0kB muxing overhead 1.293893% frame I:13 Avg QP:19.66 size: 13557 [libx264 @ 0x95737e0] frame P:1221 Avg QP:23.87 size: 2962 [libx264 @ 0x95737e0] frame B:1700 Avg QP:30.26 size: 451 [libx264 @ 0x95737e0] consecutive B-frames: 7.2% 33.5% 39.7% 19.6% [libx264 @ 0x95737e0] mb I I16..4: 9.6% 73.3% 17.0% [libx264 @ 0x95737e0] mb P I16..4: 0.4% 2.5% 0.4% P16..4: 37.8% 18.9% 8.1% 0.0% 0.0% skip:31.8% [libx264 @ 0x95737e0] mb B I16..4: 0.0% 0.1% 0.0% B16..8: 30.9% 1.9% 0.4% direct: 0.9% skip:65.8% L0:30.8% L1:63.8% BI: 5.4% [libx264 @ 0x95737e0] 8x8 transform intra:74.5% inter:72.0% [libx264 @ 0x95737e0] coded y,uvDC,uvAC intra: 79.7% 84.7% 50.5% inter: 14.2% 13.9% 0.7% [libx264 @ 0x95737e0] i16 v,h,dc,p: 60% 18% 4% 18% [libx264 @ 0x95737e0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 12% 10% 4% 10% 15% 7% 10% 7% [libx264 @ 0x95737e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 19% 9% 4% 10% 13% 6% 8% 4% [libx264 @ 0x95737e0] i8c dc,h,v,p: 46% 21% 22% 12% [libx264 @ 0x95737e0] Weighted P-Frames: Y:0.8% UV:0.4% [libx264 @ 0x95737e0] ref P L0: 65.4% 20.8% 10.8% 2.9% 0.0% [libx264 @ 0x95737e0] ref B L0: 91.4% 8.0% 0.6% [libx264 @ 0x95737e0] ref B L1: 95.6% 4.4% [libx264 @ 0x95737e0] kb/s:372.66