Saving incoming stream to a file

About encoding, codec settings, muxers and filter usage
tanir
New Cone
New Cone
Posts: 8
Joined: 28 Jun 2007 14:48

Saving incoming stream to a file

Postby tanir » 28 Jun 2007 15:03

Dear All, I already know how to save an incoming stream to a file but my problem is slightly different. When VLC saves an incoming stream to a file, the saved file usually has higher quality than the 'real-time' displayed version. I believe the reasoning behind this is that, the server side sends video packets even if their playout deadlines have passed. When these packets are received at the client, they can be used for improving the quality of the saved file, but not for the 'real-time' displayed version. So the version viewed at the client side while streaming has lower quality.

I want both versions to have the same quality. Is there a way that I can save incoming video exactly as it is actually displayed in real time? I need this for my scientific research.

Regards,
Tanir

dionoea
Cone Master
Cone Master
Posts: 5157
Joined: 03 Dec 2003 23:09
Location: Paris, France

Re: Saving incoming stream to a file

Postby dionoea » 09 Jul 2007 12:50

You can dump video frames to images using the image video output (just append "-V image" to your command line) and then compare the images. Or maybe just increase the cache size on the client's size to make sure that it never misses late packets.
Antoine Cellerier
dionoea
(Please do not use private messages for support questions)

yinglcs
Blank Cone
Blank Cone
Posts: 48
Joined: 06 Dec 2006 17:04

Re: Saving incoming stream to a file

Postby yinglcs » 10 Jul 2007 17:44

Hi,
Can you please tell me how do you save a incoming stream to a file using just command line parameters?

Thank you.

dionoea
Cone Master
Cone Master
Posts: 5157
Joined: 03 Dec 2003 23:09
Location: Paris, France

Re: Saving incoming stream to a file

Postby dionoea » 10 Jul 2007 17:53

Code: Select all

vlc <input> --sout file/ts://somefile.ts
Antoine Cellerier
dionoea
(Please do not use private messages for support questions)

yinglcs
Blank Cone
Blank Cone
Posts: 48
Joined: 06 Dec 2006 17:04

Re: Saving incoming stream to a file

Postby yinglcs » 10 Jul 2007 21:09

I am using these parameter for transcoding ,and it works (#1):

Code: Select all

#transcode{vcodec=mp4v,vb=400,acodec=mpga,ab=128}:rtp{dst=127.0.0.1,port-video=1234,port-audio=1235,sdp=a.sdp}
But when I change it to this, it does not work (#2):

Code: Select all

#transcode{vcodec=mp4v,vb=400,acodec=mpga,ab=128}:standard{access=rtp,dst=127.0.0.1,port-video=1234,port-audio=1235,sdp=a.sdp}
From my understanding, I need to do this to save and boardcast a stream:

Code: Select all

#transcode{vcodec=mp4v,vb=400,acodec=mpga,ab=128}:duplicate{dst={standard{access=file, name='1.mp4'}, dst={standard{access=rtp,dst=127.0.0.1,port-video=1234,port-audio=1235,sdp=a.sdp}}}
and that is why I want to above #2 to work.

Please correct me if I am wrong.
Thank you.

dionoea
Cone Master
Cone Master
Posts: 5157
Joined: 03 Dec 2003 23:09
Location: Paris, France

Re: Saving incoming stream to a file

Postby dionoea » 10 Jul 2007 22:58

#2 has been deprecated in favor of #1 which is why it doesn't work anymore. And you're allowed to use rtp{} in duplicate too :)
Antoine Cellerier
dionoea
(Please do not use private messages for support questions)

yinglcs
Blank Cone
Blank Cone
Posts: 48
Joined: 06 Dec 2006 17:04

Re: Saving incoming stream to a file

Postby yinglcs » 11 Jul 2007 00:46

Thanks for your help.

I have change my transcode parameter to this, per your advice:

Code: Select all

#transcode{vcodec=mp4v,vb=400,acodec=mpga,ab=128}:duplicate{dst={standard{access=file, name=file:///tmp/1.mp4}} , dst={rtp{dst=63.23.35.161,port-video=1234,port-audio=1251,sdp=file:///tmp/1.sdp}} }
The boradcast work, i.e. the part dest={rtp{.....}} works.

But I don't see any file get generated in /tmp/1.mp4. Can you please tell me why this part does not work:

Code: Select all

:duplicate{dst={standard{access=file, name=file:///tmp/1.mp4}}
Thank you.

yinglcs
Blank Cone
Blank Cone
Posts: 48
Joined: 06 Dec 2006 17:04

Re: Saving incoming stream to a file

Postby yinglcs » 11 Jul 2007 01:03

I think I fix my problem by doing this:

Code: Select all

dst={standard{access=file, mux=mp4, dst=1.mp4}

I have have 1 question which is
If I do this, does that mean vlc will transcode the stream for me once? or twice (one for broadcasting, one for saving it to a file)?

Code: Select all

'#transcode{vcodec=mp4v,vb=400,acodec=mpga,ab=128}:duplicate{dst={standard{access=file, mux=mp4 dest=1.mp4}, dst={standard{access=rtp,dst=127.0.0.1,port-video=1234,port-audio=1235,sdp=a.sdp}}}
Thank you for any pointers.

dionoea
Cone Master
Cone Master
Posts: 5157
Joined: 03 Dec 2003 23:09
Location: Paris, France

Re: Saving incoming stream to a file

Postby dionoea » 11 Jul 2007 11:34

It will transcode it only once.
Antoine Cellerier
dionoea
(Please do not use private messages for support questions)

yinglcs
Blank Cone
Blank Cone
Posts: 48
Joined: 06 Dec 2006 17:04

Re: Saving incoming stream to a file

Postby yinglcs » 12 Jul 2007 01:22

Thanks again.

I am using this argument to transcode from flv to mp4:

#transcode{vcodec=mp4v,vb=400,acodec=mpga,ab=128,width=176,height=144}

My question is why my final mp4 file is bigger (almost double) then my original flv:
original flv: 12430891
final mp4: 22409186

During the transoformation, I scale the video down (to 176X144). So I expect the mp4 file is smaller than flv.

Can you please tell me why?

Thank you.

tanir
New Cone
New Cone
Posts: 8
Joined: 28 Jun 2007 14:48

Re: Saving incoming stream to a file

Postby tanir » 16 Jul 2007 11:41

The picture size is not the only determining factor for video size in bytes. You will have to reduce the transcoding bitrate (audio/video) if you want to reduce the mp4 file size.

dionoea
Cone Master
Cone Master
Posts: 5157
Joined: 03 Dec 2003 23:09
Location: Paris, France

Re: Saving incoming stream to a file

Postby dionoea » 17 Jul 2007 16:20

What video and audio bitrate did the original FLV file use? (You can view those in the "Stream and Media Info" dialog in VLC)
Antoine Cellerier
dionoea
(Please do not use private messages for support questions)


Return to “VLC stream-output (sout)”

Who is online

Users browsing this forum: No registered users and 4 guests