
Convert hd/mpg into ps3 compatible file•
Hi! I'm new aroound here, and I have a problem I've tried to solve fore some weeks now. I have a FireDTV tv card that records SD and HD tv. This is conneted to a Mythtv server, provinding stream access to my PS3, which is hoooked up to the TV. Almost all is working well, the SD recordings are showing nice, but the HD (720 p) are without sound. I've played the actual file with vlc, and there is sound. So, I'd like some advice of converting the file into something that plays well om the ps3. mplayer -identify on the HD file gives ID_AUDIO_ID=2321 ID_AID_2321_LANG=dan ID_AUDIO_ID=2321 ID_AID_2321_LANG=dan ID_FILENAME=1006_20100511233500_orig.mpg ID_DEMUXER=mpegts ID_VIDEO_FORMAT=0x10000005 ID_VIDEO_BITRATE=0 ID_VIDEO_WIDTH=0 ID_VIDEO_HEIGHT=0 ID_VIDEO_FPS=50.000 ID_VIDEO_ASPECT=0.0000 ID_AUDIO_FORMAT=MP4A ID_AUDIO_BITRATE=0 ID_AUDIO_RATE=0 ID_AUDIO_NCH=0 ID_LENGTH=0.00 ID_SEEKABLE=1 ID_CHAPTERS=0 ID_VIDEO_CODEC=ffh264 ID_AUDIO_BITRATE=128000 ID_AUDIO_RATE=48000 ID_AUDIO_NCH=2 ID_AUDIO_CODEC=faad ID_EXIT=EOF so, I tried dumping the video and audio with mplayer -dumpvideo -dumpfile raw.264 filename.mpg mplayer -dumpaudio -dumpfile raw.aac filename.mpg and muxing it together with ffmpeg -f h264 -i raw.264 -vcodec copy -i raw.aac -acodec faac out.mp4 and 1000 other combinations, including use of mencoder and MP4Box I usually end up with something that does not play at all, and occationly, no video but sound, or no sound but video. Any advice of how to dump and mux it in a better way? Eventually, it will run on the linuxbox as a script, do cli is preffered. /BJörn
•
looks like s atream mapping problem. [Björn Lundin] "ffmpeg -f h264 -i raw.264 -vcodec copy -i raw.aac -acodec faac out.mp4" Can you post the command line result of FFmpeg? Also, can you use FFmpeg to report on the original .ts: ffmpeg -i yourfile.ts There is a good chance FFmpeg will handle the whole process. Michael "half-way to world domination A.K.A. the belligerent blue bike shed"
•
>Can you post the command line result of FFmpeg? There's a lot of output bnl@tova:/usr/bnl_tmp$ ffmpeg -f h264 -i raw.264 -vcodec copy -i raw.aac -acodec faac out.mp4 FFmpeg version SVN-r19352-4:0.5+svn20090706-2ubuntu2.2, Copyright (c) 2000-2009 Fabrice Bellard, et al. configuration: --extra-version=4:0.5+svn20090706-2ubuntu2.2 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --extra-cflags=-I/build/buildd/ffmpeg-0.5+svn20090706/debian/include --enable-shared --disable-static libavutil 49.15. 0 / 49.15. 0 libavcodec 52.20. 0 / 52.20. 0 libavformat 52.31. 0 / 52.31. 0 libavdevice 52. 1. 0 / 52. 1. 0 libavfilter 0. 4. 0 / 0. 4. 0 libswscale 0. 7. 1 / 0. 7. 1 libpostproc 51. 2. 0 / 51. 2. 0 built on Apr 23 2010 15:05:49, gcc: 4.4.1 [NULL @ 0x888c970]non-existing PPS referenced [h264 @ 0x888c970]B picture before any references, skipping [h264 @ 0x888c970]decode_slice_header error [h264 @ 0x888c970]no frame! ... skipped alot similar lines [h264 @ 0x888c970]non-existing PPS referenced [h264 @ 0x888c970]B picture before any references, skipping [h264 @ 0x888c970]decode_slice_header error [h264 @ 0x888c970]no frame! [h264 @ 0x888c970]number of reference frames exceeds max (probably corrupt input), discarding one Seems stream 0 codec frame rate differs from container frame rate: 100.00 (100/1) -> 50.00 (100/2) Input #0, h264, from 'raw.264': Duration: N/A, bitrate: N/A Stream #0.0: Video: h264, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], 50 tbr, 1200k tbn, 100 tbc raw.aac: Unknown format bnl@tova:/usr/bnl_tmp$ so, this combo was no good at all. ffmpeg -i myfile.mpg (not ts) gives bnl@tova:/usr/bnl_tmp$ ffmpeg -i 1006_20100511233500_orig.mpg FFmpeg version SVN-r19352-4:0.5+svn20090706-2ubuntu2.2, Copyright (c) 2000-2009 Fabrice Bellard, et al. configuration: --extra-version=4:0.5+svn20090706-2ubuntu2.2 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --extra-cflags=-I/build/buildd/ffmpeg-0.5+svn20090706/debian/include --enable-shared --disable-static libavutil 49.15. 0 / 49.15. 0 libavcodec 52.20. 0 / 52.20. 0 libavformat 52.31. 0 / 52.31. 0 libavdevice 52. 1. 0 / 52. 1. 0 libavfilter 0. 4. 0 / 0. 4. 0 libswscale 0. 7. 1 / 0. 7. 1 libpostproc 51. 2. 0 / 51. 2. 0 built on Apr 23 2010 15:05:49, gcc: 4.4.1 [NULL @ 0x8a1cc30]non-existing PPS referenced [h264 @ 0x8a1cc30]B picture before any references, skipping [h264 @ 0x8a1cc30]decode_slice_header error [h264 @ 0x8a1cc30]no frame! [h264 @ 0x8a1cc30]non-existing PPS referenced [h264 @ 0x8a1cc30]B picture before any references, skipping [h264 @ 0x8a1cc30]decode_slice_header error [h264 @ 0x8a1cc30]no frame! ... same as aboce, a lot of similar lines cut [h264 @ 0x8a1cc30]B picture before any references, skipping [h264 @ 0x8a1cc30]decode_slice_header error [h264 @ 0x8a1cc30]no frame! [h264 @ 0x8a1cc30]non-existing PPS referenced [h264 @ 0x8a1cc30]B picture before any references, skipping [h264 @ 0x8a1cc30]decode_slice_header error [h264 @ 0x8a1cc30]no frame! [h264 @ 0x8a1cc30]number of reference frames exceeds max (probably corrupt input), discarding one Seems stream 0 codec frame rate differs from container frame rate: 100.00 (100/1) -> 50.00 (50/1) Input #0, mpegts, from '1006_20100511233500_orig.mpg': Duration: 10:51:25.89, start: 25752.630656, bitrate: 215 kb/s Program 1 Stream #0.0[0x907]: Video: h264, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], 50 tbr, 90k tbn, 100 tbc Stream #0.1[0x91f](dan): Subtitle: dvbsub Stream #0.2[0x920](dan): Subtitle: dvbsub At least one output file must be specified bnl@tova:/usr/bnl_tmp$ So, it seems like ffmpeg does not see the audio, at least as I understand it. However the file plays well in vlc and mplayer on a linuxbox. So, by using mplayer -ao pcm -vc null -vo null filename.mpg I get a file audiodump.wav Which i convert to audiodump.aac with this command faac -q 100 -c 44100 -b 192 --mpeg-vers 4 audiodump.wav If I then run ffmpeg -f h264 -i raw.264 -vcodec copy -i audiodump.aac -acodec libfaac out.mp4 I get bnl@tova:/usr/bnl_tmp$ ffmpeg -f h264 -i raw.264 -vcodec copy -i audiodump.aac -acodec libfaac out.mp4 ........ [h264 @ 0x90f0970]no frame! [h264 @ 0x90f0970]number of reference frames exceeds max (probably corrupt input), discarding one Seems stream 0 codec frame rate differs from container frame rate: 100.00 (100/1) -> 50.00 (100/2) Input #0, h264, from 'raw.264': Duration: N/A, bitrate: N/A Stream #0.0: Video: h264, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], 50 tbr, 1200k tbn, 100 tbc Input #1, aac, from 'audiodump.aac': Duration: 00:21:20.56, bitrate: 142 kb/s Stream #1.0: Audio: aac, 48000 Hz, stereo, s16, 142 kb/s Output #0, mp4, to 'out.mp4': Stream #0.0: Video: libx264, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], q=2-31, 90k tbn, 50 tbc Stream #0.1: Audio: libfaac, 48000 Hz, stereo, s16, 64 kb/s Stream mapping: Stream #0.0 -> #0.0 Stream #1.0 -> #0.1 Press [q] to stop encoding [NULL @ 0x90f0970]missing picture in access unit947.65 bitrate=8002.5kbits/s frame=47627 fps=372 q=-1.0 Lsize= 932260kB time=950.34 bitrate=8036.2kbits/s video:924288kB audio:7445kB global headers:0kB muxing overhead 0.056549% This gets me a file out.mp4 if I run it with mplayer I get ......... Error while decoding frame! [h264 @ 0x6408960]B picture before any references, skipping [h264 @ 0x6408960]decode_slice_header error [h264 @ 0x6408960]no frame! Error while decoding frame! Too many audio packets in the buffer: (4096 in 699812 bytes). Maybe you are playing a non-interleaved stream/file or the codec failed? For AVI files, try to force non-interleaved mode with the -ni option. A: 0.2 V: 0.0 A-V: 0.201 ct: 0.000 0/ 0 ??% ??% ??,?% 3492 0 and mplayer exits. ffmpget -i out.mp4 gives lt on Apr 23 2010 15:05:49, gcc: 4.4.1 Seems stream 0 codec frame rate differs from container frame rate: 100.00 (100/1) -> 50.00 (50/1) Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mp4': Duration: 00:15:52.54, start: 0.000000, bitrate: 8017 kb/s Stream #0.0(und): Video: h264, yuv420p, 1280x720, 50 tbr, 50 tbn, 100 tbc Stream #0.1(und): Audio: aac, 48000 Hz, stereo, s16 which to me sems alright? Thanks for your reply. /Björn
•
Hi Björn, Sorry for the delay.... been learning to #bash recently which has taken up some time. Highly recommended for automating FFmpeg. [Björn Lundin] So, by using mplayer -ao pcm -vc null -vo null filename.mpg I get a file audiodump.wav Which i convert to audiodump.aac with this command faac -q 100 -c 44100 -b 192 --mpeg-vers 4 audiodump.wav ffmpeg -f h264 -i raw.264 -vcodec copy -i audiodump.aac -acodec libfaac out.mp4 Why not use FFMpeg for all of this? What is the source? Not much experience using mencoder but keep it simple unless you really need complex. Can you please post the source info? $ ffmpeg -i ORIGINAL_FILE_NAME [Björn Lundin] "[h264 @ 0x888c970]non-existing PPS referenced [h264 @ 0x888c970]B picture before any references, skipping [h264 @ 0x888c970]decode_slice_header error [h264 @ 0x888c970]no frame! [h264 @ 0x888c970]number of reference frames exceeds max (probably corrupt input), discarding one" You cannot start on a B-frame! It seems your input to FFmpeg is truncated. (B stands for bidirectional and are thus related to frames on both sides) [Björn Lundin] "[h264 @ 0x888c970]decode_slice_header error [h264 @ 0x888c970]no frame! [h264 @ 0x888c970]number of reference frames exceeds max (probably corrupt input), discarding one" This looks REALLY bad;-) Why not use intermediate container instead of raw streams? You could use mp4 for video and maybe mp3 or ac3 for audio. The time base in the header of the container might help get rid of some of the nasty frame errors you have been getting but might not work without an intermediate step to fix the malformed stream header. Instead of: $ ffmpeg -f h264 -i raw.264 -vcodec copy -i audiodump.aac -acodec libfaac out.mp4 ...try: $ ffmpeg -i raw.mp4 -i audiodump.aac -map 0:0 -map 1:0 -vcodec copy -acodec copy out.mp4 The .mpg format/codec with the "-same q" flag is excellent for an intermediate at very near lossless transcoding. Finally, upgrade your FFmpeg. Due to the nature of FFmpeg's development adhering to a stable trunk when in SVN version, it is safe to assume that the latest version will probably have less bugs and more functionality. Michael "half-way to world domination A.K.A. the belligerent blue bike shed"
•
[Michael Rampe] "Sorry for the delay.... been learning to #bash recently which has taken up some time. Highly recommended for automating FFmpeg." Yeah, bash is useful. [Michael Rampe] "Why not use FFMpeg for all of this? What is the source? Not much experience using mencoder but keep it simple unless you really need complex. Can you please post the source info? $ ffmpeg -i ORIGINAL_FILE_NAME" well, ahem, I did, look in my last post. But the interesting part looks like Seems stream 0 codec frame rate differs from container frame rate: 100.00 (100/1) -> 50.00 (50/1) Input #0, mpegts, from '1006_20100511233500_orig.mpg': Duration: 10:51:25.89, start: 25752.630656, bitrate: 215 kb/s Program 1 Stream #0.0[0x907]: Video: h264, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], 50 tbr, 90k tbn, 100 tbc Stream #0.1[0x91f](dan): Subtitle: dvbsub Stream #0.2[0x920](dan): Subtitle: dvbsub At least one output file must be specified [Michael Rampe] "Why not use intermediate container instead of raw streams?" Because I'm a newbie on this. I found the mplayer dumpfile while googling, and sofar, this is the only thin that got any useful data out of the file. Well, except for VLC which plays it... I'm willing to try just about anything... [Michael Rampe] "...try: $ ffmpeg -i raw.mp4 -i audiodump.aac -map 0:0 -map 1:0 -vcodec copy -acodec copy out.mp4" Hmm, but where do I get raw.mp4? The raw.264 above is produced by mplayer -dumpvideo -dumpfile raw.264 filename.mpg and the raw.aac is produced by mplayer -dumpaudio -dumpfile raw.aac filename.mpg which then is converted to audiodump.aac via faac and whatnot. I'm certainly willing to keep it as simple as I can, as long as it works ;-) So I tried $ ffmpeg -i filenaem.mpg -i audiodump.aac -map 0:0 -map 1:0 -vcodec copy -acodec copy out.mp4 but it left me with an unplayable file. No sound, no video, but lots of errors like [h264 @ 0x98ec960]B picture before any references, skipping [h264 @ 0x98ec960]decode_slice_header error [h264 @ 0x98ec960]no frame! Error while decoding frame! [h264 @ 0x98ec960]B picture before any references, skipping [h264 @ 0x98ec960]decode_slice_header error [h264 @ 0x98ec960]no frame! Error while decoding frame! when mplayer tried it. I'm glad that someone is giving this a try :-) Thanks so far. /Björn
•
Sorry, I thought that was one of the failed outputs;-) [Björn Lundin] "Program 1 Stream #0.0[0x907]: Video: h264, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], 50 tbr, 90k tbn, 100 tbc Stream #0.1[0x91f](dan): Subtitle: dvbsub Stream #0.2[0x920](dan): Subtitle: dvbsub" FFmpeg cannot see ANY audio streams. The "dvbsub" streams indicate to me that this file came from a television broadcast. This explains how you have a file starting on the B-frame. (DVB=digital video broadcasting and is the standard in most non-USA countries for digital television broadcast.) I am assuming you are in a PAL European country (possibly Denmark) due to the file info you have posted which uses the DVB standard. A DVB transport stream can contain multiple video streams, multiple audio streams, subtitles, EPG and other information. Very tricky to work with. I cannot help with this using FFmpeg. [Björn Lundin] "I'm willing to try just about anything..." If it is indeed DVB broadcasts you are capturing, get yourself a cheap USB DVB decoder which will allow you to capture the file in a proper way to your computer. Google: "USB DVB tuner". There are lots of devices on the market for this. You can then use FFmpeg if required to make it into a suitable format for your PS3. Sorry I cannot be more helpful. Michael "half-way to world domination A.K.A. the belligerent blue bike shed"
•
[Michael Rampe] "If it is indeed DVB broadcasts you are capturing, get yourself a cheap USB DVB decoder which will allow you to capture the file in a proper way to your computer. Yes, you are correct. I started the thread with 'I have a FireDTV tv card that records SD and HD tv. This is conneted to a Mythtv server' But I should have been more clear. Yes, the file is indeed a dvb-t recording from Denmark, eventhough I'm, swedish. (I live close to denmark) It is from a HD-channel. (yes PAL-land) The FireDTV card is a firewire tv card with CA-modules, needed for pay-tv around here. you stick a card into it, and pay the bill... Free channels are not in majority here, eventhough this particular channel is free. Anyway, thanks for your efforts. /Björn
•
[Björn Lundin] " Yes, you are correct. I started the thread with 'I have a FireDTV tv card that records SD and HD tv. This is conneted to a Mythtv server' But I should have been more clear. Yes, the file is indeed a dvb-t recording from Denmark, eventhough I'm, swedish. (I live close to denmark)" Sorry but it has been a long week but it is the weekend now;-) (that should let you work out where I am from). Basically, I think all your issues are being caused by the truncated stream you are getting from the source (starting on B-frame as identified earlier.) Sync issues in the picture stream can most definitely cause problems with playing back the associated audio stream and trying to mux a broken stream with another stream will always lead to issues. Trying to fix these issues after the fact is also problematic. So you have a "card" connected to the server. I looked into both devices you mentioned. http://www.digital-everywhere.com/en/alcms/index.php?sid=1190404664 http://www.mythtv.org/ Which one is dumping the file you are using (straight from the FireDTV or from the MythTV DVR)?. Have you tried to disconnect the server to capture locally only ie. Connect the box to your computer. Are you on linux, Windows or OSX? Supposedly, FFmpeg can capture from firewire (I have never tried it). From man FFmpeg: "Audio/Video grab options -vc channel Set video grab channel (DV1394 only). -tvstd standard Set television standard (NTSC, PAL (SECAM)). -isync Synchronize read on input." I also read somewhere that adding the -dv1394 flag enables this but again not tested. Michael "half-way to world domination A.K.A. the belligerent blue bike shed"
•
[Michael Rampe] "Basically, I think all your issues are being caused by the truncated stream you are getting from the source (starting on B-frame as identified earlier.)" Ok, so this is were to start;I shold get rid of starting on a B-frame. Seems like I need to read up on the different parts of a video. [Michael Rampe] "Which one is dumping the file you are using (straight from the FireDTV or from the MythTV DVR)?" Good question. This is how i imagine it works. It's on Linux The card makes /dev/dvb/somedevice avialable to mythtv. Mythtv changes the channel, to the wanted one, and reads from the device. It the flushes the file to disk. No encoding or anything is done in mythtv, since it runs on an old PIII machine. It does not have the power to do anything useful in a short period of time. The movie/recording is copied to a laptop, on which I experimented. Also Linux. But since vlc can read and play the movie, something must be correct in the stream. I think I'll try to use cvlc to extract the different streams instead. The ffmpeg is the one that arrives with ubuntu 9.10, ie the second latest. So, it is since october 2009, but I know, things happens fast in this area. I've used the card with mac (eye-tv) it can also playback the recorded stream, but I had that only for a short period of time, so I do not have any recordings left to compare with. But that might be a trail as well. analyze the mac recording, and compare with the linux one. That gives the answer to if mythtv saves a untouched stream to disk. Anyway thanks for trying /Björn
|