Update Transcoding Options On The Fly

About encoding, codec settings, muxers and filter usage
canichol
New Cone
New Cone
Posts: 5
Joined: 16 Aug 2007 23:36

Update Transcoding Options On The Fly

Postby canichol » 08 Oct 2008 20:54

I am currently trying to modify VLC to update the transcoding options on the fly. I want to allow a user to change the bitrate for a given codec while the video is streaming (ie. if the network becomes slow while streaming) to improve performance that the client (computer viewing the stream) sees. My current setup involves stopping the playback and then restarting playback with a new playlist item that contains my new options. I basically create the playlist item (with same mrl & start time) with the new transcoding options and add it to the playlist. I then play this playlist item. This causes a 1-2 second delay in the video stream which is undesirable.

Does anyone know how I might go about doing this? Could I possibly pause playback, close the transcoder, and then open a new transcoder? If so, where can I look to see code for opening/closing the transcoder? Which module does so?

Thanks for the help,
Corey

canichol
New Cone
New Cone
Posts: 5
Joined: 16 Aug 2007 23:36

Re: Update Transcoding Options On The Fly

Postby canichol » 03 Nov 2008 21:45

If you are still curious to know, I have figured out dynamic bit rate assignment. I will not go into detail unless requested, but here is the idea. You can create your own GUI window and open it from the view menu. Add a combo box for the desired audio and video bit rates. Add an update and a close button and whatever else you desire. Now in the update action you will need to change a variable. I associated this varibale with the playlist as described next. To set the variable call setVar(...) after getting the playlist object. I used vlc_find_object(...), but from what I have read it is not favored.

So in playlist.c where the playlist object is initialized and its thread spawned you can create another playlist variable. There are lots of examples within that same function.

Now in transcode.c you need to find the function Send. In the case statement for ES_VIDEO right before the break use an if statement to check if the bit rate has changed. Use varGet(...) to get your new bit rate value and check it against p_sys->i_vbitrate. If different, then change the settings for p_sys and the encoder. Now close the encoder and reopen it. The new bit rate settings will take place. You can see the close and open function for how to close and open the encoder.

I see no performance drop and the changes are immediate. Its pretty neat.

Cheers.

Poulpatine
Blank Cone
Blank Cone
Posts: 10
Joined: 02 Oct 2008 11:18

Re: Update Transcoding Options On The Fly

Postby Poulpatine » 06 Nov 2008 13:16

It would be very nice if this option were integrated in vlc :)


Return to “VLC stream-output (sout)”

Who is online

Users browsing this forum: No registered users and 13 guests