
Recherche avancée
Médias (91)
-
Richard Stallman et le logiciel libre
19 octobre 2011, par
Mis à jour : Mai 2013
Langue : français
Type : Texte
-
Stereo master soundtrack
17 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Audio
-
Elephants Dream - Cover of the soundtrack
17 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Image
-
#7 Ambience
16 octobre 2011, par
Mis à jour : Juin 2015
Langue : English
Type : Audio
-
#6 Teaser Music
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#5 End Title
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
Autres articles (59)
-
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. -
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
Possibilité de déploiement en ferme
12 avril 2011, parMediaSPIP peut être installé comme une ferme, avec un seul "noyau" hébergé sur un serveur dédié et utilisé par une multitude de sites différents.
Cela permet, par exemple : de pouvoir partager les frais de mise en œuvre entre plusieurs projets / individus ; de pouvoir déployer rapidement une multitude de sites uniques ; d’éviter d’avoir à mettre l’ensemble des créations dans un fourre-tout numérique comme c’est le cas pour les grandes plate-formes tout public disséminées sur le (...)
Sur d’autres sites (7799)
-
ffmpeg stops randomly with "No more output streams to write to, finishing" when reading rtsp stream [on hold]
7 juin 2016, par ImagineDragonBasically I am running the following ffmpeg command to read an h264 rtsp stream using hls muxer, under Ubuntu 14.04 64bit with i7 CPU and 8GB memory :
ffmpeg -v debug -i rtsp://172.16.11.247:554/live/ch00_0?token=hQttXvrjSPOcClQB -codec copy -flags -global_header -f hls -hls_time 5 -use_localtime 1 -hls_segment_filename '/home/eason/ffmpeg-test/%s.ts' '/home/eason/ffmpeg-test/live.m3u8'
ffmpeg version N-79139-gde1a0d4 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.1)
configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --mandir=/usr/share/man --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libfreetype --enable-gnutls --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvidstab
libavutil 55. 19.100 / 55. 19.100
libavcodec 57. 30.100 / 57. 30.100
libavformat 57. 29.101 / 57. 29.101
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 40.102 / 6. 40.102
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument 'debug'.
Reading option '-re' ... matched as option 're' (read input at native frame rate) with argument '1'.
Reading option '-i' ... matched as input file with argument 'rtsp://172.16.11.247:554/live/ch00_0?token=hQttXvrjSPOcClQB'.
Reading option '-codec' ... matched as option 'codec' (codec name) with argument 'copy'.
Reading option '-flags' ... matched as AVOption 'flags' with argument '-global_header'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'hls'.
Reading option '-hls_time' ... matched as AVOption 'hls_time' with argument '5'.
Reading option '-use_localtime' ... matched as AVOption 'use_localtime' with argument '1'.
Reading option '-hls_segment_filename' ... matched as AVOption 'hls_segment_filename' with argument '/home/eason/ffmpeg-test/%s.ts'.
Reading option '/home/eason/ffmpeg-test/live.m3u8' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input file rtsp://172.16.11.247:554/live/ch00_0?token=hQttXvrjSPOcClQB.
Applying option re (read input at native frame rate) with argument 1.
Successfully parsed a group of options.
Opening an input file: rtsp://172.16.11.247:554/live/ch00_0?token=hQttXvrjSPOcClQB.
[tcp @ 0x29c4d60] No default whitelist set
[rtsp @ 0x29c2e20] SDP:
m=video 0 RTP/AVP 96
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=640028;sprop-parameter-sets=Z2QAKKzoBQBbkA==,aO48sA==
a=control:trackID=0
m=audio 0 RTP/AVP 98
a=rtpmap:98 MPEG4-GENERIC/16000/1
a=fmtp:98 profile-level-id=1;mode=AAC-lbr;sizelength=13;indexlength=3;indexdeltalength=3;config=1408;cpresent=0;
a=control:trackID=1
[rtsp @ 0x29c2e20] video codec set to: h264
[rtsp @ 0x29c2e20] RTP Packetization Mode: 1
[rtsp @ 0x29c2e20] RTP Profile IDC: 64 Profile IOP: 0 Level: 28
[rtsp @ 0x29c2e20] Extradata set to 0x29c4ff0 (size: 22)
[rtsp @ 0x29c2e20] audio codec set to: aac
[rtsp @ 0x29c2e20] audio samplerate set to: 16000
[rtsp @ 0x29c2e20] audio channels set to: 1
[rtp @ 0x29c50a0] No default whitelist set
[udp @ 0x29c5200] No default whitelist set
[udp @ 0x29c5200] end receive buffer size reported is 131072
[udp @ 0x29d9480] No default whitelist set
[udp @ 0x29d9480] end receive buffer size reported is 131072
[rtsp @ 0x29c2e20] method SETUP failed: 461 Unsupported transport
[rtsp @ 0x29c2e20] CSeq: 3
[rtsp @ 0x29c2e20] setting jitter buffer size to 0
Last message repeated 1 times
[rtsp @ 0x29c2e20] hello state=0
[rtsp @ 0x29c2e20] All info found
[rtsp @ 0x29c2e20] rfps: 24.250000 0.018062
[rtsp @ 0x29c2e20] rfps: 24.333333 0.012911
[rtsp @ 0x29c2e20] rfps: 24.416667 0.008627
[rtsp @ 0x29c2e20] rfps: 24.500000 0.005207
Last message repeated 1 times
[rtsp @ 0x29c2e20] rfps: 24.583333 0.002653
Last message repeated 1 times
[rtsp @ 0x29c2e20] rfps: 24.666667 0.000965
Last message repeated 1 times
[rtsp @ 0x29c2e20] rfps: 24.750000 0.000142
Last message repeated 1 times
[rtsp @ 0x29c2e20] rfps: 24.833333 0.000185
Last message repeated 1 times
[rtsp @ 0x29c2e20] rfps: 24.916667 0.001093
Last message repeated 1 times
[rtsp @ 0x29c2e20] rfps: 25.000000 0.002867
Last message repeated 1 times
[rtsp @ 0x29c2e20] rfps: 25.083333 0.005507
Last message repeated 1 times
[rtsp @ 0x29c2e20] rfps: 25.166667 0.009011
[rtsp @ 0x29c2e20] rfps: 25.250000 0.013382
[rtsp @ 0x29c2e20] rfps: 25.333333 0.018618
[rtsp @ 0x29c2e20] rfps: 50.000000 0.011469
Input #0, rtsp, from 'rtsp://172.16.11.247:554/live/ch00_0?token=hQttXvrjSPOcClQB':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0, 28, 1/90000: Video: h264 (High), 1 reference frame, yuv420p(left), 1280x720, 1/180000, 24.75 tbr, 90k tbn, 180k tbc
Stream #0:1, 23, 1/16000: Audio: aac (LC), 16000 Hz, mono, fltp
Successfully opened the file.
Parsing a group of options: output file /home/eason/ffmpeg-test/live.m3u8.
Applying option codec (codec name) with argument copy.
Applying option f (force format) with argument hls.
Successfully parsed a group of options.
Opening an output file: /home/eason/ffmpeg-test/live.m3u8.
Successfully opened the file.
[file @ 0x2cae180] Setting default whitelist 'file,crypto'
[mpegts @ 0x29f7ce0] muxrate VBR, pcr every 9000 pkts, sdt every 2147483647, pat/pmt every 2147483647 pkts
Output #0, hls, to '/home/eason/ffmpeg-test/live.m3u8':
Metadata:
encoder : Lavf57.29.101
Stream #0:0, 0, 1/90000: Video: h264, 1 reference frame, yuv420p(left), 1280x720 (0x0), 1/90000, q=2-31, 24.75 tbr, 90k tbn, 90k tbc
Stream #0:1, 0, 1/90000: Audio: aac (LC), 16000 Hz, mono
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
Last message repeated 103 times
[hls @ 0x2a0fc00] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[AVIOContext @ 0x2c998c0] Statistics: 0 seeks, 155 writeouts=N/A speed=1.01x
[file @ 0x2ba60e0] Setting default whitelist 'file,crypto'
[file @ 0x2ca9fc0] Setting default whitelist 'file,crypto'
[hls @ 0x2a0fc00] EXT-X-MEDIA-SEQUENCE:0
[AVIOContext @ 0x2caa080] Statistics: 0 seeks, 1 writeouts
[AVIOContext @ 0x2c99480] Statistics: 0 seeks, 103 writeouts=N/A speed= 1x
[file @ 0x2ba60e0] Setting default whitelist 'file,crypto'
[file @ 0x2c97c60] Setting default whitelist 'file,crypto'
[hls @ 0x2a0fc00] EXT-X-MEDIA-SEQUENCE:0
[AVIOContext @ 0x2c97d20] Statistics: 0 seeks, 1 writeouts
[AVIOContext @ 0x2c99480] Statistics: 0 seeks, 104 writeouts=N/A speed= 1x
[file @ 0x2ba60e0] Setting default whitelist 'file,crypto'
[file @ 0x2c99680] Setting default whitelist 'file,crypto'
[hls @ 0x2a0fc00] EXT-X-MEDIA-SEQUENCE:0
[AVIOContext @ 0x2c99820] Statistics: 0 seeks, 1 writeouts
[AVIOContext @ 0x2c99480] Statistics: 0 seeks, 28 writeoutse=N/A speed= 1x
[file @ 0x29c50c0] Setting default whitelist 'file,crypto'
[file @ 0x2ba60e0] Setting default whitelist 'file,crypto'
[hls @ 0x2a0fc00] EXT-X-MEDIA-SEQUENCE:0
[AVIOContext @ 0x29c2ce0] Statistics: 0 seeks, 1 writeouts
[AVIOContext @ 0x2c99480] Statistics: 0 seeks, 111 writeouts=N/A speed= 1x
[file @ 0x2c97d40] Setting default whitelist 'file,crypto'
[file @ 0x2a134e0] Setting default whitelist 'file,crypto'
[hls @ 0x2a0fc00] EXT-X-MEDIA-SEQUENCE:0
[AVIOContext @ 0x2a11000] Statistics: 0 seeks, 1 writeouts
[AVIOContext @ 0x2c99480] Statistics: 0 seeks, 105 writeouts=N/A speed= 1x
[file @ 0x29c50c0] Setting default whitelist 'file,crypto'
[file @ 0x2a10c00] Setting default whitelist 'file,crypto'
[hls @ 0x2a0fc00] EXT-X-MEDIA-SEQUENCE:1
[AVIOContext @ 0x2a10cc0] Statistics: 0 seeks, 1 writeouts
[AVIOContext @ 0x2c99480] Statistics: 0 seeks, 103 writeouts=N/A speed= 1x
[file @ 0x29c50c0] Setting default whitelist 'file,crypto'
[file @ 0x2c99480] Setting default whitelist 'file,crypto'
.......repeat........
[hls @ 0x2a0fc00] EXT-X-MEDIA-SEQUENCE:71
[AVIOContext @ 0x2c97fa0] Statistics: 0 seeks, 1 writeouts
[rtsp @ 0x29c2e20] Too short data for FU-A H264 RTP packette=N/A speed= 1x
[AVIOContext @ 0x2ba60e0] Statistics: 0 seeks, 103 writeouts=N/A speed= 1x
[file @ 0x2c97b20] Setting default whitelist 'file,crypto'
[file @ 0x2c97c60] Setting default whitelist 'file,crypto'
[hls @ 0x2a0fc00] EXT-X-MEDIA-SEQUENCE:72
[AVIOContext @ 0x2c99480] Statistics: 0 seeks, 1 writeouts
[AVIOContext @ 0x2ba60e0] Statistics: 0 seeks, 156 writeouts=N/A speed= 1x
[file @ 0x2c99480] Setting default whitelist 'file,crypto'
[file @ 0x2cab600] Setting default whitelist 'file,crypto'
[hls @ 0x2a0fc00] EXT-X-MEDIA-SEQUENCE:73
[AVIOContext @ 0x2cab6c0] Statistics: 0 seeks, 1 writeouts
[AVIOContext @ 0x2ba60e0] Statistics: 0 seeks, 104 writeouts=N/A speed= 1x
[file @ 0x2cadc00] Setting default whitelist 'file,crypto'
[file @ 0x2c99480] Setting default whitelist 'file,crypto'
[hls @ 0x2a0fc00] EXT-X-MEDIA-SEQUENCE:74
[AVIOContext @ 0x29c2ce0] Statistics: 0 seeks, 1 writeouts
[AVIOContext @ 0x2ba60e0] Statistics: 0 seeks, 103 writeouts=N/A speed= 1x
[file @ 0x2a13540] Setting default whitelist 'file,crypto'
[file @ 0x2cab680] Setting default whitelist 'file,crypto'
[hls @ 0x2a0fc00] EXT-X-MEDIA-SEQUENCE:75
[AVIOContext @ 0x2c99480] Statistics: 0 seeks, 1 writeouts
No more output streams to write to, finishing.:46.09 bitrate=N/A speed=0.993x
[AVIOContext @ 0x2ba60e0] Statistics: 0 seeks, 138 writeouts
[file @ 0x29c50c0] Setting default whitelist 'file,crypto'
[hls @ 0x2a0fc00] EXT-X-MEDIA-SEQUENCE:76
[AVIOContext @ 0x2ba60e0] Statistics: 0 seeks, 1 writeouts
frame= 8423 fps= 21 q=-1.0 Lsize=N/A time=00:06:46.09 bitrate=N/A speed=0.993x
video:37031kB audio:1586kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (rtsp://172.16.11.247:554/live/ch00_0?token=hQttXvrjSPOcClQB):
Input stream #0:0 (video): 8423 packets read (37919815 bytes);
Input stream #0:1 (audio): 6345 packets read (1624337 bytes);
Total: 14768 packets (39544152 bytes) demuxed
Output file #0 (/home/eason/ffmpeg-test/live.m3u8):
Output stream #0:0 (video): 8423 packets muxed (37919815 bytes);
Output stream #0:1 (audio): 6345 packets muxed (1624337 bytes);
Total: 14768 packets (39544152 bytes) muxed
0 frames successfully decoded, 0 decoding errorsThe problem is that ffmpeg exits randomly after 5 to 20 minutes. The RTSP is a live stream so stopping every 5 minute is really not acceptable. In the ffmpeg log I can’t see any noticeable error except "No more output streams to write to, finishing." near the end. Can someone shed some light upon this ? How can I make ffmpeg run without stopping ? Thanks
-
how to merge an audio file with an image in android using javaCV
11 mai 2016, par Darshan SoniI have aleady tried some code but it is throwing exception like this,
05-11 17:34:00.449 1838-2316/darshan.fragments_demo E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: darshan.fragments_demo, PID: 1838
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:309)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.avutil
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:324)
at org.bytedeco.javacpp.Loader.load(Loader.java:413)
at org.bytedeco.javacpp.Loader.load(Loader.java:381)
at org.bytedeco.javacpp.avformat$AVFormatContext.<clinit>(avformat.java:2597)
at org.bytedeco.javacv.FFmpegFrameGrabber.startUnsafe(FFmpegFrameGrabber.java:386)
at org.bytedeco.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.java:380)
at darshan.fragments_demo.Layout1$Test.doInBackground(Layout1.java:166)
at darshan.fragments_demo.Layout1$Test.doInBackground(Layout1.java:136)
at android.os.AsyncTask$2.call(AsyncTask.java:295)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
</clinit>
Now in gradle file I’ve included some libraries my gradle file is as follow,apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/services/javax.annotation.processing.Processor'
pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/opencv/pom.properties'
pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/opencv/pom.xml'
pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/ffmpeg/pom.properties'
pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/ffmpeg/pom.xml'
}
defaultConfig {
applicationId "darshan.fragments_demo"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile group: 'org.bytedeco', name: 'javacv', version: '1.1'
compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '2.4.11-0.11', classifier: 'android-arm'
compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '2.4.11-0.11', classifier: 'android-x86'
compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '2.6.1-0.11', classifier: 'android-arm'
compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '2.6.1-0.11', classifier: 'android-x86'
}And java file is as follow,
public class Test extends AsyncTask {
ProgressDialog dialog;
FFmpegFrameRecorder recorder;
String videoPath;
protected void onPreExecute() {
dialog = new ProgressDialog(Layout1.this);
dialog.setMessage("Genrating video, Please wait.........");
dialog.setCancelable(false);
//dialog.show();
};
@Override
protected Void doInBackground(Void... params) {
File folder = Environment.getExternalStorageDirectory();
String path = folder.getAbsolutePath() + "/DCIM/Camera";
// ArrayList<string> paths = (ArrayList<string>) getListOfFiles(path, "jpg");
long millis = System.currentTimeMillis();
videoPath = path + "/" + "test_sham_"+millis+".3gp";
try {
//audio grabber
FFmpegFrameGrabber grabber2 = new FFmpegFrameGrabber(folder.getAbsolutePath()+"/bluetooth/abcd.mp3");
//video grabber
FFmpegFrameGrabber grabber1 = new FFmpegFrameGrabber(path+"/1.jpg");
grabber1.start();
grabber2.start();
recorder = new FFmpegFrameRecorder(path
+ "/" + "test_sham_"+millis+".mp4", grabber1.getImageWidth(), grabber1.getImageHeight(),2);
//recorder.setVideoCodec(5);
recorder.setVideoCodec(avcodec.AV_CODEC_ID_MPEG4);
// recorder.setVideoCodec(avcodec.AV_CODEC_ID_MP4ALS);
//recorder.setFormat("3gp");
recorder.setFormat("mp4");
recorder.setFrameRate(30);
recorder.setSampleRate(grabber2.getSampleRate());
recorder.setVideoBitrate(30);
long startTime = System.currentTimeMillis();
recorder.start();
Frame frame1, frame2 = null;
while ((frame1 = grabber1.grabFrame()) != null ||
(frame2 = grabber2.grabFrame()) != null) {
recorder.record(frame1);
recorder.record(frame2);
}
recorder.stop();
grabber1.stop();
grabber2.stop();
System.out.println("Total Time:- " + recorder.getTimestamp());
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
</string></string>I just cant figure out what is wrong with the implementation
Please help -
yet another screenshot encoding exercise with ffmpeg - stuck at getting AVFrame from ALT::CImage - VC++
11 septembre 2013, par sithTotal AV newbee here - trying to learn the ropes on using FFMpeg functions to encode movies. On searching for tutorials I found a few similar questions that I have linked here for reference :
Encoding a screenshot into a video using FFMPEG
[Libav-user] Encoding a screenshot into a video using FFMPEG
Save bitmap to video (libavcodec ffmpeg)
When converting from RGB to YUV using ffmpeg the video file the color is spread why ?
How to convert RGB from YUV420p for ffmpeg encoder ?
Encode bmp sequence with libavcodec...Help !
Not able to encode image with ffmpeg
For my setup FFMPEG is on VS12 - VC++ with MFC on win7.
With the help of above samples, I am able to get "some" output from the encoder, but I am not sure in what format or state the output has been encoded. Neither VLC nor WMP can play this file. It does not even seem to recognize the metadata in the file to display the FPS or video length. What would normally cause that ? Also any pointers on what could be going wrong and how to approach fixing the problems would be great. [1]
Here is the flow of my code :
Step1 : capture desktop on to a CImg :
int W=GetSystemMetrics(SM_CXSCREEN), H=GetSystemMetrics(SM_CYSCREEN), bpp=24;
CImage cImg; cImg.Create(W,H,bpp)
HDC hDC = cImg.GetDC();
CWindowDC winDC(GetDesktopWindow());
BitBlt(hDC, 0,0, rez.W(), rez.H(), winDC.m_hDC, 0, 0, SRCCOPY);At this point I am able to dump a screen shot into a bmp file -
using cImg.Save( _T("test.bmp"), Gdiplus::ImageFormatBMP) ;Step2 : Extract the BMP bits from the CImg.
HBITMAP hBitmap = (HBITMAP)cImg;
HDC memDC = CreateCompatibleDC(NULL);
SelectObject( memDC, hBitmap );
BITMAPINFO bmi; // initialized bmi with {W,-H, plane=1, bitCount=24, comp=BI_RGB, size=W*H*3 }
<< removed bmi init code for conciseness. >>>
BYTE *rgb24Data = new BYTE[W*H*3]; // 3 for 24bpp. 4 for 32...
int ret = GetDIBits(memDC, hBitmap, 0, H, rgb24Data, &bmi, DIB_RGB_COLORS);At this point I faithfully believe rgb24Data points to pixel data :) - copied out of the cImg bitmap
Step 3 : next I try to create an AV frame with the rgb24Data got from this CImg. Also this is where I have a massive knowledge gap. I am going to try and recover
// setup the codecs and contexts here as per mohM's post
AVCodec *currCodec = avcodec_find_encoder(CODEC_ID_MPEG4);
AVCodecContext *codeCtxt = avcodec_alloc_context(); // init this with bate=400k, W, H,
<< removed codeCtxt init code for conciseness. >>> // time base 1/25, gop=10, max_b=1, fmt=YUV420
avcodec_open(codeCtxt, currCodec);
SwsContext *currSWSCtxt = sws_getContext( W, H, AV_PIX_FMT_RGB24, // FROM
W, H, AV_PIX_FMT_YUV420P, // TO
SWS_FAST_BILINEAR,
NULL, NULL, NULL);
// allocate and fill AVFrame
int numBytes = avpicture_get_size(PIX_FMT_YUV420P, W, H);
uint8_t *buffer=new uint8_t[numBytes];
AVFrame *avFrame = avcodec_alloc_frame();
avpicture_fill( (AVPicture*)avFrame, buffer, PIX_FMT_YUV420P, W, H );Step 4 : transform the data frame into YUV420P as we fill the frame.
uint8_t * inData[1] = { rgb24Data };
int inLinesize[1] = { 3*W }; // RGB stride
sws_scale( currSWSCtxt, inData, inLinesize, 0, H,
avFrame->data, avFrame->linesize);step 5 encode the frame and write out the output buffer into a file.
int out_size = avcodec_encode_video( codeCtxt,
outBuf,
outBufSize,
avFrame );
fwrite(outBuf, 1, outBufSize, outFile );finally I close the file off with [0x00 0x00 0x01 0xb7]
The first hint of things gone haywire is that for a 50 screens of 1920X1080 at 24bpp encoded at 25fps gives me a 507MB unplayable-mpeg file.
As mentioned earlier, neither VLC nor WMP can play this file nor they even recognize the metadata in the file to display the FPS or video length. What would normally cause that ? Also any pointers on what could be going wrong and how to approach fixing the problems would be great. [2]
Any guidance is much appreciated.